Giter VIP home page Giter VIP logo

checkers-ai's Introduction

checkers-ai

Project repository for CS-405 (Intro to AI)

Docker

Configs

To build the git portiion of the checkers-ai/docker-tournament.cfg file needs to be filled in. This is used to get the networks out of the container.

[git]
username = <github username here>
password = <github password here>
url = <link to github repo>

Building

Once the config file is done, build the container while in the directory with the docker file with

docker build -t train .

Running

To start up the container run

docker run train .

If theres is an error for some reason you can use

docker run -it train bash

this gets you inside the container to poke around. To start everything off run

./docker-run.sh

Benchmarks

There is a pretty significant performance hit from using containers for processing. The times are to run a tournament consiting of 100 games. Units are in seconds.

Benchmarks

checkers-ai's People

Contributors

williamh890 avatar duaneshaffer avatar hadimarchi avatar raltyinferno avatar

Watchers

James Cloos avatar

checkers-ai's Issues

Implement Alpha-Beta search

  • Implement Alpha-Beta pruning
  • measurements: boards expanded during search, internal nodes vs. leaf nodes, average search time per move, etc.
  • Calculate average savings for alpha-beta vs. minimax
  • Sort nodes when searching using BEF
  • Implement Iterative Deepening Search

In-Class Tournament Integration

Find out what is required to allow networks to face each other in class and implement necessary components.

  • Network communication
  • Board sending method
  • Which of our networks is selected

NN Generator modification

Modify your random neural network generator to
Create a value for Kings: K=U(1.0,3.0)
Create a value for each weight: w=U(-0.2,0.2)
Create an initial value for sigma for each weight: =0.05
Save the results to a file

Tournament Control Software

  • If needed, call networkManagement passing it a 0 and user ID to setup a folder for networks and fill it with networks.
  • Create threads for all games. Each network plays 5 (Blondie24) games on red side vs a random network.
  • Locally save resulting performance for involved networks (thread safe!).
  • When all games are done, call networkManagement passing it a 1, user ID, and array of performances to change all networks to reflect performances.
  • Git pull and push

EITHER

  • call networkManagement passing it a 2 and userID to create evolved networks from four all folders
    OR
  • call networkManagement passing it a 3 to evolve only the users networks

**Stretch goal - create a more robust final tournament that more conclusively chooses the best network from the top 13 of each user

From the PDF:
○ Initialize with a random population of p neural networks
○ For each generation g
■ Play a tournament to rank the p neural networks
● Save each game played during tournament
■ Copy the p/2 winners into g+1
■ Generate one offspring for each winner and store in g+1

Project 2 - Add a minimax search with a simple piece count evaluation function

Add an option to your gameplay from Part 1 to execute a minimax search instead of picking a random move. This will improve the computer’s play and be a simple search function you will extend & optimize later. Your interface should be similar to MiniMax(Board, Player, depth) which can be easily extended to implement the Iterative Deepening Search later by repeatedly calling this with increasing depth.

Create networkManagement

Program that supports the needs of the tournament control software:

  • 0.Initializing the networks.
  • 1.Storing the performances to file (so that other computers can evolve the best ones)
  • 2.Take best networks from current users and fill top half of my networks with my best and their best. Evolve the resulting networks.
  • 3.Evolve only user networks
  • Program requires task selection input to know which task to do
  • Program requires userID to know which folder to alter networks in
    -----userID is saved in a file
  • Program requires an array of performances to complete task 2

Human Input

The human can move any piece and can move it wherever they like.

Switch to cmake

  • main program
  • tests
  • network manager stuff
  • add a new way of install deps

Stretch goals - Searches constantly

Enable the network to be searching into a deeper ply while waiting for the opponent to give back a move. Will hopefully be able to select a branch related to the opponents move (might be trivial since that branch is related to a specific thread?)

Bug: moving off the board/out of moves

Short: Red can move off the bottom of the board. When it's by jumping, the game doesn't recognize that it is a forced jump but allows it. In addition, the red piece can be moved from (8, 4) to (6,7) on the next move (The game didn't end when there were no red pieces on the board).
0 1 2 3 4 5 6 7
0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
1 | b | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
3 | 0 | 0 | b | 0 | b | 0 | 0 | 0 |
4 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | b |
5 | b | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
6 | 0 | b | 0 | b | 0 | b | 0 | r |
7 | 0 | 0 | 0 | 0 | b | 0 | b | 0 |

This representation is lame but that's what happens when the font can't be changed to a monospaced font. Oh and it's tons of fun making this editor think that spaces are significant in order to have the board represented somewhat reasonably. /s

So, it's red's turn and the game should be over yet it isn't. Perhaps the game thinks red can jump that black piece? Indeed, that's what happened. Further testing, the red piece can move back. Can I create pieces then? Yes, I moved from (8,1) to (7,0) and an "L" was placed in that square.

I then use this "L" piece to jump a black piece [7,0 to 5,2] When black then tries to jump it the game crashes:
terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc

Ensure offspring correctness

Create a test program that shows our offspring are correct - come up with a test or tests to convince Genetti that our code is correct.

Compute and Graph Gaussian numbers

Test program to determine you are generating Gaussian pseudo-random numbers correctly - e.g. generate 1000 values, compute the amount in each range, and plot the height of the ranges using a spreadsheet or graphing package for several values of sigma and verify shape of curve.

Compile Testing Results

Get testing results compiled into a comprehensive form. I'm not sure what the requirements for assignment 2 are, but it would be nice to have graphs of all this stuff.

Board Representation

King's aren't being represented on the board differently than regular checkers. They are able to move properly so, they are being properly crowned.

NN Evolution

Given a Neural Network, create an offspring - The last step in each generation is to create offspring from each survivor, so your code should
Read a neural network from a file
Generate a new instance, with all parameters identical
Evolve Parameters
evolutionrequirements

Nj(0,1) is a pseudo-random Gaussian
Store the resulting neural network to a new file

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.