nickjamesio / chess Goto Github PK
View Code? Open in Web Editor NEWThis is my implementation of the chess game using python and flask
This is my implementation of the chess game using python and flask
Currently assumes data is valid for generate_fen()
This method does not check if the piece placing the king in checkmate can be captured or if the patch can be blocked. Need to add these checks
ChessBoard class needs to know if a king is currently in check. Add a method to perform this check.
ChessBoard class needs to know there is a stalemate. Add a method to perform this check.
Also create test case for this
When creating a Board object, it should accept a Fen obj. If no Fen object is passed in, create empty board, else, assign pieces where they belong.
Remove has_moved from Piece class
Approach
Test cases from PieceMovementTest can be moved into other test files to make this file smaller and more targeted.
Ex. There could be one file for capturing, another for legal moves, another for moving pieces
All classes currently have getter and setter methods. Refactor them to use properties.
I want to make use of the EPD notation to setup a game board. As part of of the notation, you can specify the position a pawn could move to in order to perform an en passant move. It does not let you know if en passant is possible though. There may not be an opponent pawn present to take advantage. Basically it always points to the square right behind a pawn that just moved forward two spaces. In the following example EPD string, the g6
square is the target en passant position
rnbqkbnr/pppppp1p/8/6pP/8/8/PPPPPPP1/RNBQKBNR w KQkq g6
Each time a pawn moves two spaces, a the en_passant_target_position
field would be updated to contain the en passant target position. If there is an opponent pawn to the left or right of the pawn that just moved two, en passant is possible. If not, en passant not possible. Each time a piece other than a pawn moves, the en_passant_target_position
field will be set to None
See http://portablegamenotation.com/EPD.html for more info
Need test for following methods
generate_fen()
Test cases
ChessBoard class needs to know if a king is currently in checkmate. Add a method to perform this check.
Create method and test for this
Finish implementing methods on ChessGame class
ChessGame class needs some tests
move_piece()
current_player()
get_winner()
Create method and test for this
Many methods in ChessBoard class accept an algebraic notation as an argument. These methods assume the value passed in is valid. Exceptions should be thrown when the value is not correct.
Update all existing test to use new FEN string setup for creating a chess board
This new test suite should test check, checkmate, and any other public methods in the ChessBoard class.
Given a direction, the method should return the position of the nearest piece in that direction. If there is no piece in that direction, return none.
Implement GameState class. This will be useful when writing a UI. GameState object should let the UI know what is happening. State can be queried from ChessGame class
Return following info
Need custom test runner that will run all automated tests so it does not need to be done one at a time
Finish implementing stub test cases
I discovered a bug where all movement was programmed from white's perspective. All movement offsets, such as forward, are relative. So if you tried to move a black piece forward, it would actually end up moving backwards. The bug was fixed but test need to be updated to confirm all cases work and prevent future regressions.
This will be handy in setting up a game from a previous state. On board creation, accept EPD notation string. Same with Game class. See http://portablegamenotation.com/EPD.html
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.