Skip to main content

Making AI Play Games


The Artificial Intelligence era has started only a while ago and it is drastically augmenting and amplifying our lives But in this sphere of development, the developers have had a big problem to test their AI.

This is where great minds like Elon Musk step in and create adroit and efficient resources to test the Intelligence that we create. His vision and aspiration led to the start of OpenAI, a free open source library and a company specializing in research. They create toolkits for Deep Learning developers like us to deploy models and make AI play games. This helps us to analyze the power of the intelligence by simulating game environments. 

OpenAI provides enthusiasts with 2 toolkits to work with

Gym - Toolkit for comparing and developing deep reinforcement learning algorithms...

Universe - A collection of gym environments to train and measure an AI's general intelligence...





Today we are going to write a simple script in python to help build a model that plays Dusk-Drive. The model will train itself and become better and better as we allow it to train. This is the code:-

import gym
import universe  # register the universe environments

env = gym.make('flashgames.DuskDrive-v0')
env.configure(remotes=1)  # automatically creates a local docker container
observation_n = env.reset()

while True:
  action_n = [[('KeyEvent', 'ArrowUp', True)] for ob in observation_n]  # your agent here
  observation_n, reward_n, done_n, info = env.step(action_n)
  env.render()

If you try to run your model , it will creash along the bylanes but will gradually improve over time. The console will Print certain statistics that will help you measure your AI's general Intellegence. This is a great tool for harnessing the power of AI , and I will surely keep you posted ...



Comments

Popular posts from this blog

Recommender System using Python

Recommender systems are everywhere. Amazon recommends buys we like, google recommends searches, Youtube recommends systems and Facebook recommends people. All of these implementations describe Recommender Systems. There are 2 types of Recommender Systems. Collaborative Systems - Systems that recommend information based on what you like and what the others like. Content Based Systems- Based on what you have viewed This is a simple ML based recommender System in python. It uses the LightFM library as the dataset import numpy as np from lightfm import LightFM from fetch_lastfm import fetch_lastfm data = fetch_lastfm() model = LightFM( loss = ' warp ' ) model.fit(data[ ' matrix ' ], epochs = 30 , num_threads = 2 ) # Get recommendationns function def get_recommendations ( model , coo_mtrx , users_ids ): n_items = coo_mtrx.shape[ 1 ] for user in users_ids: # TODO create known positives # Artists the model pred...

The complete GCI Journey

A summary of my experience this year... The GCI 2017 - 18 opened up arms for teenagers on 27th of November, 2017 for students to attempt tasks encompassing of coding, outreach, quality assurance and user interface problems. The competition comprised of organizations who had an open - source structure. I started my journey a month late, on 27th December, but I still managed to attempt a fair few number of tasks. Many of them for a great organization like LibreHealth, Mifos and Liquid Galaxy Project. I spent the highest fraction of my time, working with a great Health IT company called LibreHealth. My main goal was to expand on my sector of design. This included wireframe generation, web component designs, presentation, and artworks. I really enjoyed it, I never thought I would design mockups or dashboards for a proper company :) There were parts where things did not seem too good … Over my GCI participation was also a load for exam preparation. A rigorous schedu...

Book Review : Zero to One by Peter Thiel

Introduction Zero to One is a  condensed and updated version of a highly popular set of online notes taken by Masters for the CS183 class on startups taught by Thiel at  Stanford University  in Spring 2012 [Source: Wikipedia ] . In short, it's about creating value in the world. Business Background of the Author Peter Thiel was the founder of Confinity, a company making electronic payment systems which merged with Elon Musk's " X.com", a similar venture to create what we now know as Paypal, which is now a $40 billion company with one share worth $ 80. He owned a 3.7 per cent stake at Paypal. Not long after eBay ... the online retail giant, made an acquisition offer to Paypal valuing the entire company at $1 billion. After taxes and financial customs, Peter Thiel netted $55 Million, making him filthy rich. He started a hedge fund and private equity firm named Clarium funds and made an angel investment in Facebook, which made him $1.2 Billion dollars. He...