Skip to content

dmaddalone/GameAI

Repository files navigation

GameAI v0.8.6 November 19, 2015

CONTENTS
---------------------------------------

* Introduction
* Installation
* Operating Instructions
* File Manifest
* Copyright and Licensing
* Known Bugs
* Credits and Acknowledgements
* Contact Information

Introduction
---------------------------------------
GameAI is a set of board games written in C++.  The games include Tic-Tac-Toe, 
Connect Four,  Reversi, Chess, and Chess variants.  Each game may be played by 
two players, either human or computer.  The computer player is engineered on 
the Minimax algorithm with  Alpha-beta pruning enabled.  Players may be on 
networked computers in a client-server mode.

The key to the Minimax algorithm are the heuristics measuring the advantage of
one player over the other.  These heuristics are contained in the 
EvaluateGameState method of the games.  Improvements in these methods will 
improve the AI.

Specific future improvements to EvaluateGameState:
- Evaluate board state with a weighted sum of diffefrent measures, including
    peice location, control of position, and calculation of momentum 
- Implement a learning mode, where the weights of the different measures are
  compared to the win or loss of a game and adjusted accordingly 
  (maybe "hill climbing")




Installation
---------------------------------------
Requirements:
* C+11 compiler
* Make utility
* open-source-parsers/jsoncpp

1) Download and install jsonspp (https://github.com/open-source-parsers/jsoncpp).  
   Follow the instructions on generating an amalgamated source and header.
2) Install source code (see File Manifest below) to a folder on the same level as jsoncpp.
3) Run make using GameAI.cbp.mak.* where * is the operating system.  Targets
   include debug and release for Linux operating systems and debug_windows and 
   release_windows for Windows operating systems.




Operating Instructions
---------------------------------------
Run a Game AI program

Required Options:
    -1 TYPE,  --player1=TYPE  assign TYPE of player to Player 1
    -2 TYPE,  --player2=TYPE  assign TYPE of player to Player 2
    -g GAME,  --game=GAME     play GAME

Non Required Options:
    -h,       --host=HOSTNAME host address or name of the server.  Required for TYPE server.
              --port=PORT     port for network communications.  REQUIRED for TYPE of server and client.
    -i FILE,  --input=FILE    read game moves from FILE
    -o FILE,  --output=FILE   write game moves to FILE
              --name1=NAME    assign a name to player 1
              --name2=NAME    assign a name to player 2
    -p PLIES, --plies=PLIES   assign the number of PLIES that ai players will use
              --plies1=PLIES  assign the number of PLIES to Player 1, if ai
              --plies2=PLIES  assign the number of PLIES to Player 2, if ai
    -v LEVEL, --verbose=LEVEL display game information
    -V,       --version       display version and exit
    -H,       --help          display this help message and exit

PORT is a port specification for a server and client to communicate over.  The default is 60000.
HOST is a host name or address for a server.  The default is 127.0.0.1.
TYPE is either human, ai, client, or server.  Start a server before staring a client.
PLIES are from 1 to 9.  The default is 4.
GAME is one of the following:
    connectfour chess         chess-jm         war
    reversi     chess-attack  chess-los-alamos go-fish
    ttt         chess-baby    chess-petty      rummy
                chess-elena   chess-quick      
                chess-gardner chess-speed      
LEVEL is an integer 0 to 3.  The default is 1.
    0 = display start and ending announcements
    1 = display game move-by-move
    2 = display AI scoring of moves and basic operations
    3 = display AI evaluation of moves and detailed operations

Examples:
Start a game on a single computer:
GameAI -1 human -2 ai -g ttt

Start a game across two computers:
GameAI -1 human  -2 client -g connetcfour --port=60001
GameAI -1 server -2 human  -g connectfour --port=60001 --host=192.168.0.1




File Manifest
---------------------------------------
GameAI/GameAI.cbp                    -- Code::Blocks project file
GameAI/GameAI.cbp.mak.mac            -- Make file for Mac
GameAI/GameAI.cbp.mak.unix           -- Make file for UNIX
GameAI/GameAI.cbp.mak.windows        -- Make file for Windows

GameAI/main.cpp                      -- Run the game

GameAI/src/AIPlayer.cpp              -- The computer player
GameAI/src/AllowedMoves.cpp          -- Manage multiple move opportunities during a turn
GameAI/src/Blackboard.cpp            -- Manage known and probability information for an AI Player
GameAI/src/BoardGame.cpp             -- Virtual class for any board game
GameAI/src/Card.cpp                  -- A playing card
GameAI/src/CardGameBasicRummy.cpp    -- Basic Rummy card game
GameAI/src/CardGame.cpp              -- Virtual card game parent
GameAI/src/CardGameGoFish.cpp        -- Go Fish card game
GameAI/src/CardGameWar.cpp           -- War card game
GameAI/src/ChessAttack.cpp           -- Chess Attack game
GameAI/src/ChessBaby.cpp             -- Baby Chess game
GameAI/src/Chess.cpp                 -- Orthodox Chess game
GameAI/src/ChessElena.cpp            -- Elena Chess game
GameAI/src/ChessGame.cpp             -- Virtual chess game parent
GameAI/src/ChessGardner.cpp          -- Gardner Chess game
GameAI/src/ChessJacobsMeirovitz.cpp  -- Jacobs-Meirovitz Chess game
GameAI/src/ChessLosAlamos.cpp        -- Los Alamos Chess game
GameAI/src/ChessPetty.cpp            -- Petty Chess game
GameAI/src/ChessQuick.cpp            -- Quick Chess game
GameAI/src/ChessSpeed.cpp            -- Speed Chess game
GameAI/src/Client.cpp                -- Client player (proxy for server)
GameAI/src/ConnectFour.cpp           -- Connect Four game
GameAI/src/Deck.cpp                  -- A deck of playing cards
GameAI/src/Game.cpp                  -- Virtual game class
GameAI/src/GameMove.cpp              -- Game move 
GameAI/src/GameVocabulary.cpp        -- Game vocabulary between server and client 
GameAI/src/Hand.cpp                  -- A hand of playing cards
GameAI/src/Human.cpp                 -- Human player
GameAI/src/LinearGame.cpp            -- Virtual linear game
GameAI/src/Logger.cpp                -- Support logging
GameAI/src/NetworkPlayer.cpp         -- Parent class for Server and Client
GameAI/src/Player.cpp                -- Virtual game player
GameAI/src/PlayingCards.cpp          -- Playing cards
GameAI/src/Reversi.cpp               -- Reversi game
GameAI/src/Server.cpp                -- Server player (proxy for client)
GameAI/src/Socket.cpp                -- Socket parent class NetworkPlayer
GameAI/src/TTT.cpp                   -- Tic-Tac-Toe game

GameAI/include/AIPlayer.h
GameAI/include/AllowedMoves.h
GameAI/include/Blackboard.h           
GameAI/include/BoardGame.h   
GameAI/include/Card.h                  
GameAI/include/CardGameBasicRummy.h
GameAI/include/CardGame.h          
GameAI/include/CardGameGoFish.h        
GameAI/include/CardGameWar.h                   
GameAI/include/ChessAttack.h           
GameAI/include/ChessBaby.h                   
GameAI/include/Chess.h                           
GameAI/include/ChessElena.h                   
GameAI/include/ChessGame.h                    
GameAI/include/ChessGardner.h                
GameAI/include/ChessJacobsMeirovitz.h    
GameAI/include/ChessLosAlamos.h            
GameAI/include/ChessPetty.h                     
GameAI/include/ChessQuick.h                    
GameAI/include/ChessSpeed.h                         
GameAI/include/Client.h       
GameAI/include/ConnectFour.h              
GameAI/include/Deck.h     
GameAI/include/GameAIException.h     -- Custom logic exception
GameAI/include/GameAIVersion.h       -- Version information
GameAI/include/Game.h
GameAI/include/GameMove.h
GameAI/include/GamePiece.h           -- Game piece
GameAI/include/GameVocabulary.h
GameAI/include/hand.h     
GameAI/include/Human.h
GameAI/include/LinearGame.h
GameAI/include/Logger.h
GameAI/include/NetworkPlayer.h
GameAI/include/Player.h
GameAI/include/PlayingCards.h
GameAI/include/Reversi.h
GameAI/include/Server.h
GameAI/include/SocketException.h     -- Custom runtime exception
GameAI/include/Socket.h
GameAI/include/TTT.h




Copyright and Licensing
---------------------------------------
GameAI is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

GameAI is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with GameAI.  If not, see <http://www.gnu.org/licenses/>.




Known Bugs
---------------------------------------
- In Reversi, the NO MOVE will confuse network play
- hostname does not work, only host address
- See TODOs




Credits and Acknowledgements
---------------------------------------
Zobrist, Albert L., "A New Hashing Method with Application for Game Playing"
  Technical Report #88, The University of Wisconsin,  April 1970

Luger, George F., Stubblefield, William A.  "Artifical Intelligence and the 
  Design of Expert Systems"  New Mexico: The Benjamin/Cummings Publishing 
  Company, 1989.

Tougher, Rob "Linux Socket Programming in C++", Linux Gazette, Issue 74, 
  January 2002

Sheinwood, Alfred "101 Best Family Card Games", New York: Sterling Publishing
  Co., 1992




Contact Information
---------------------------------------
Dom Maddalone dominick dot maddalone at gmail dot com

About

GameAI is a set of games written in C++.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages