Code Monkey home page Code Monkey logo

splendor_ai's Introduction

Splendor AI

In this project I create a program to play bard game Splendor and create neural network playing it. Whole program is terminal based with minimal UI, but simulates all aspects of Splendor board game.

My attempt of creating AI to play the game was to create a neural network taking in game state as input and returning the moves with coefficients of how good every possible move the AI thinks is.

How to train

Change variables and hyperparameters in GeneticAlgorithm.cpp
If you want to change amount of tokens on board (from 7, 5 default) do this in SplendorGame.h in constructor at top
If you don't want to play game after change name of 'train' function to 'main' compile and run.
Otherwise change the 'training' variable in interface.cpp and compile and run interface.cpp

How to run and interact with interface

If you want to train network for yourself change 'training' variable in interface.cpp check 'how to train' section to train correctly

To change number of players and add more / remove bots from game change variables 'player_count', 'ai_player_count'.
After this fill 'sitting' vector with the order of players you want (0 for bot, 1 for human).

Compile interface.cpp and run it

Commands:

  • 'b' [where from] [place] Buy a card

    • [where from] 'b' [tier(1-3)] [position(1-4)] Buy card in position 'position' from tier 'tier'
    • [where_from] 'r' [position(1-3)] Buy card previously reserved in position 'position'
  • 'r' [tier(1-3)] [position(1-5)] Reserve a card from a board (5 for the hidden card on top of the deck)

  • 't' [tokens] Take 'tokens' from the board

    • [tokens] are in format xxxxx where x is any digit (will accept only legal takes) eg. 02000, 11010

eg.
b b 2 3 (buys 3rd card from 2nd tier from board).
t 01101 (takes 0 green, 1 white, 1 blue, 0 black, 1 red).
r 1 4 (reserves 4th card from 1st tier).

splendor_ai's People

Contributors

drabart avatar

Stargazers

 avatar  avatar

Watchers

 avatar

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.