Skip to content

drabart/Splendor_ai

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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).

About

Neural network playing splendor

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published