Skip to content

Writing a chess engine + pgn parser/analyzer to learn Java. AI has some intelligence when it comes to taking pieces (although a bit too eager to trade), but has trouble taking the offensive (frequently violates threefold-repetition) and forcing endgames. Early development.

Notifications You must be signed in to change notification settings

dcdholder/gluggle-chess

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OVERVIEW
--------
This is my stab at writing a chess engine in Java.
I want the AI to be able to play better than me, which isn't setting the bar too high.
This will be my third attempt at writing something like this (first in C, then in C++, now in Java). Hopefully I can make it work this time.
Should help me get familiar with Java abstract classes, nested/local classes, subclasses and interfaces.
Not going to win any awards.

GLUGGLE-CHESS GAME PLAN
------------------
- Write a .pgn parser (translate from a human-readable format into a move sequence)
- Write a method to follow the sequence and confirm that it is legal
- Write tests to make sure that the parser only accepts valid input (purposely introduce bugs into the file) //make sure that it properly handles comments and other nonmove text
- Write tests and add .pgn files to check normal and special piece moves, checks, checkmates and stalemates
- Write a method to "screenshot" games and write them to a log file (important for visually inspecting test results)
- Implement all arbiter methods (stalemates, checkmates included) DONE
- Write a command-line interface for human play DONE
- Make sure that all tests run, games can be played from start to finish against oneself
- Check into prod/master
- Add a random move AI, write a test which has two of them fight each other (print the results) DONE
- Check into prod/master
- Write a method to evaluate the value of a board for a given player
- Add an arbitrary-number-of-folds AI
- Write a method for confirming that the "better" AIs overwhelmingly outplay worse AIs
- Check into prod/master
- Add an optional randomness factor to prevent matches from being totally deterministic (assign next-move probabilities based on scores, with best having the highest probability)
- Check into prod/master
- Write glue scripts to play against another chess engine (preferably one which is open-source)
- Gauge capabilities of various AIs based on a number of games (script a number of playthroughs), further verify correctness
- Check into prod/master
- Add the capability to save games (in .pgn format), and to load them for a human or AI player
- Check into prod/master
- Add game-tree trimming capability to AIs (start with N-fold-cost-analysis brute-force, start trimming)
- Confirm that the new AIs beat the old ones a certain percentage of the time
- Check into prod/master
- Networked play? Client-to-AI-server play? GUI version (who cares)?

VALID CHECKMATE
---------------

1□■□■□■□■
2■□■□■□♙□
3□■□■□■♟■
4■□♔□♙□■□
5□■□■□♗□■
6♞♖■□■□■□
7♖■□■♙■□■
8■□♚□■□■□
 hgfedcba

White player wins after 201 plies

VALID STALEMATE (50-MOVE RULE)
------------------------------

8□■□■□■□♚
7■□■□■□■□
6□■□■□■□■
5■□■□♔□■□
4□■□■□■□■
3■□■□■□■□
2□■□■□■□■
1■□■□■□■□
 abcdefgh

Game ends in stalemate after 554 plies (277 ply/s!)

About

Writing a chess engine + pgn parser/analyzer to learn Java. AI has some intelligence when it comes to taking pieces (although a bit too eager to trade), but has trouble taking the offensive (frequently violates threefold-repetition) and forcing endgames. Early development.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages