Skip to content

Releases: a2ys/chess-ai

Major release with huge optimizations

23 Apr 15:53
Compare
Choose a tag to compare

Summary

The program has been optimized to the heights of my capability, and has got many bugs squashed except for one mentioned in board.py file, which will soon be fixed in a following patch. I've temporarily disabled sounds, which will be reintroduced in a future release with some optimizations. Scheduled for another future release on my TODO list, I've kept a fully functional window to be implemented which can be used for customizing the graphics, importing custom FENs, saving a game, reporting a bug, checking for updates. Well this is a lot, and is in process of its making.

Major additions

  • The program now uses the set data type for storage of all types of data, which has played the major role in drastically improving the efficiency of the program.
  • The Move object has now been made hashable with the __hash()__ and __eq()__ methods implemented, to facilitate its usage with the set data type.
  • Enums have been created for every value which was repeatedly being used in the program, and also to increase the efficiency and make the program less prone to typos. The Enum values have been made integer values so as to increase the efficiency of dependent algorithms.
  • Game Modes have been added where you may choose to play against another person, against the AI as both WHITE and BLACK, or you may choose to let the AI create chaos by letting it play against itself and enjoy the show. :)
  • Tests have been made depth based, instead of manually writing every test for different depths. Now any person can test the program to any specified depth. (default is 5, fails onwards)

Minor additions

  • The game now uses predefined sets for checking special moves, facilitating efficient validation of moves.
  • The Piece.get_alpha() now returns a single char instead of a string of 2 characters, so as to increase readability as well as increasing the efficiency of comparison steps by a minor bit.
  • Created a new is_whitespace_under_attack() method to check for attacks on squares with no pieces.
  • match ... case blocks have been added for efficient comparison where the value to be compared is fixed.
  • The efficiency of special_moves() method has been improved by adding correct checks in the correct order, compared to the previous version of the method.
  • The main.py file has been edited to accommodate different game modes.

Bug fixes

  • A bug where the colors were not reset on double clicking on the same square has been fixed.

Remaining bugs and current halts

  • The production of appropriate sounds for different types of moves have been put to a halt, and will be implemented in the next patch or minor update.
  • The FEN k7/6p1/8/q4P1K/8/8/8/8 b KQkq - 0 1, and similar FENs with the same arrangement of the King, Queen and the pawns, allow the King to be captured due to a bug in validation of the En-passant move. This will be fixed in the next minor update or major update.
  • The tests fail at a depth of 5, logs of which can be found in the GitHub workflow runs.

Scheduled features for future releases

  • A logger for easy issue tracking, and quicker resolution.

  • A fully fledged window incorporating the following:

    • A way to import custom FENs;
    • Save the current game state in a file, and load it when necessary;
    • Change the game modes;
    • Tweak the colors of the game;
    • Enable/disable sounds;
    • Report bugs and issues and check for updates;

and many more ...

You may also contribute to the project to help facilitate quicker development, and help make new features accessible to everyone early on. Thanks for your time reading the update notes. :)

The game is complete! (without AI)

05 Oct 13:06
Compare
Choose a tag to compare

A playable game

I've worked a lot on this project, and since I was alone I had to take care of many things, the hardest being the testing for bugs, but still the game is bug-free, with some hidden in the far corners, which I'll try to eliminate. Still the engine is slower, first due to it being written in Python, and second one being the algorithmic efficiency of the program, which reaches a polynomial time-complexity fairly easily.

Major additions

  • Developed the checkmate function, and added a custom sound for checkmate.
  • Developed all the special moves, free from bugs (mostly) namely Castling, Pawn Promotions and En-passant
  • Developed the stalemate function, and added a custom sound for it.
  • Extended support for FEN string up-to castling, others will be added in the upcoming updates.
  • Added a really important feature, unit-testing, as checking for every move not not possible artificially, although the program is failing the tests after the fourth move, which I'll try to fix to the extent I can.

Bug fixes:

  • Promotion causes every other move to fail
  • Fixed many castling bugs
  • Fix the thin white lines on border of window, they were caused by board dimensions not being a multiple of 8, as the fractional part is ignored for a better GUI.

Rules and Rules!

30 Sep 14:53
Compare
Choose a tag to compare
Rules and Rules! Pre-release
Pre-release

The project contained some bugs so I fixed that and added many new features described below, and now the project is bug free. I'll now work on other major features.

Major Changes/Additions

  • Move rules have been defined in the game, now chaos has been settled :)
  • Now the legal moves will be highlighted upon clicking any piece.
  • Implemented a function which checks if the king is in check.
    • When in check, only the king can be moved, or any piece can be moved to block the check.
    • The piece defending the check will be pinned.

Bug fixes:

  • Fixed a bug which caused the program to crash when the Pawn reached the end of board by fixing IndexError for rank and file in moves.py.
  • When king is captured, it will throw a custom error which depicts the program has a bug.
  • Fixed the bug where pawns were able to jump over pieces on first move. (This was hilarious to see 😂)

Changes in GUI and UI

  • The color scheme has been updated to be more elegant to the eyes.
  • Custom sounds are produced depending on sounds of moves.

First pre-release

08 Jul 14:16
274b47a
Compare
Choose a tag to compare
First pre-release Pre-release
Pre-release

The first release!

Excited to tell that the project has kickstarted its development!

This first version contains the following features:

  1. A responsive GUI window made with Pygame library with a grid to accommodate the chess pieces.

image

  1. Given a basic moving functionality to the chess pieces, not yet defined the rules.

  2. Game is still playable, with chaos all around :)

Development is still going on, your contributions are welcome!