Skip to content

An AI which learns to play Nim by playing against itself.

Notifications You must be signed in to change notification settings

KrishM123/Nim-AI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

Nim-AI

An AI which learns to play Nim by playing against itself.

Recall that in the game Nim, we begin with some number of piles, each with some number of objects. Players take turns: on a player’s turn, the player removes any non-negative number of objects from any one non-empty pile. Whoever removes the last object loses.

There’s some simple strategy you might imagine for this game: if there’s only one pile and three objects left in it, and it’s your turn, your best bet is to remove two of those objects, leaving your opponent with the third and final object to remove. But if there are more piles, the strategy gets considerably more complicated. An AI was built to learn the strategy for this game through reinforcement learning. By playing against itself repeatedly and learning from experience, eventually our AI will learn which actions to take and which actions to avoid.

Usage: python play.py

Harvard.CS50.Intro.To.AI.With.Python.Nim.Demonstration.mp4

About

An AI which learns to play Nim by playing against itself.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages