Skip to content

Latest commit

 

History

History
94 lines (72 loc) · 2.64 KB

README.md

File metadata and controls

94 lines (72 loc) · 2.64 KB

A Chess Engine Framework for Neural Network Evaluation functions

Made by: Bernardo Rocha 23214074 requires: Python 3.8 TensorFlow 2.13 Numpy 1.24.3 chess 1.10

Basic Overview

A code framework to program chess engines in Python. This framework was then used to created Neural Network based evaluation functions It has searching, evaluation and feature functions, that I explain better later

Table of contents

  1. Instalation
  2. Usage
  3. Structure of the code file

Instalation

To use this project, download the Project_code.py file Then call it from a python interface as you would a normal package

Usage

To create a chess engine (here called BotPlayer) you need 2 things.

1 create a Searcher using SearcherDirector

SearcherDirector has the written searching functions as functions for the class. Currently there are 5 functions: minimax, Minimax_NN, AB_pruning, AB_prunning_NN and ID_AB_pruning All of them have a parameter that represents depth.

2 create a list of Feature using FeatureDirector (Only for hand-crafted evaluation)

Before starting this step you need to know if you want a NN evaluation function or a Manual evaluatin function. The FeatureDirector has all the functions already prepared, you just need to set a a parameter.

3 create an Evaluator using the EvaluatorDirector

This will take the list of features as argument if you are creating a hand-crafted function If creating a NN evaluation function the arguments are the model and the minply

There are 9 models: "Single256","Single128","Single64","Single32","Pair256","Double128","Single256_Double256_128","Single128_Double128" and 5 possible values for minply "0","15","30","45","60"

4 Assemble everything under the BotPlayer

Create an object class BotPlayer that takes 3 arguments, a name (string, not relevant), a Searcher and an Evaluator

5 play the simulations

Use the function simulateChessGame or simulateMultipleGames, using 2 Players of your choice (They can be the same, a HumanPlayer works aswell and needs no arguments when being created)

Structure of the code file

  1. Imports
  2. Global Variable
  3. Main functions
  4. Playing functions
  5. Player
  6. Search
  7. Evaluation
    1. Manual Evaluation
      1. Manual calc_funct
    2. NNEvaluation
      1. NeuralNetworks
  8. Trait
    1. ManualTrait
    2. NNTrait
  9. Builders
  10. Misc functions
  11. Preset instances
    1. Lists of options
    2. Traits
    3. Evaluations
    4. Bots