p-chess / chess Goto Github PK
View Code? Open in Web Editor NEWPHP Chess engine
License: MIT License
PHP Chess engine
License: MIT License
I think that composer.lock should be ignored, since this is a library (not a product).
Scenario: I was about to update vendors in my local copy, then I realized that such action would update composer.lock to my environment (for example, I use php 7.4 but this lib is compatible with php ^7.2).
The only drawback I see is that CI could be a bit slower, since it can't rely on composer.lock while installing vendor libs.
I am not sure what I am doing wrong, but it seems as if a certain illegal move is not validated as falseful.
Move order as example:
1.e4 (c5)
2.Bc4 (e6)
3.Nf3 (Nf6)
4.Kg1 (Nxe4)
Kg1 is an illegal move, except if O-O (castling) which would put the King on g1.
But simply playing Kg1 is allowed when played, and the rook stays on h1.
Does this have to do with the implementation of the castling rule?
Thanks!
Following properties in Move are integers: from
, to
, flags
.
Anyway, the prettyMove
method in Chess
is chaning such properties to strings.
Problem is also present in original library, so we need to investigate the logic.
For what I understand, from
and to
are indicating the squares where the move is starting and engind, and there's two possible representations: as integers (from 0 to 119) and in string notation of rank and file (e.g. e2
). We need to understand where/how to apply such different representations (for example, I guess that in history it makes more sense the latter, but mabye the former can be used when undoing?)
For flags
, I've got no clue.
Currently, board is hashed via json_encode
, that encodes the array of squares.
This produce a string that is hard to read and ridiculously long.
Then, such string is also used as a key, producing ugly arrays.
I think that we could use a FEN string, that is far shorter and simpler
Currently, some methods accept an array of options. This should be changed to explicit parameters (so we can add typing).
Moreover, generateMoves
method is accepting options but never called with any option inside Chess class (only in ChessPublicator for perft
method). So we probably should remove such options
We got an $header
property, I was wondering if we could remove it.
I see that is just an array holding two keys: "setUp" and "FEN", but it's not clear to me how such informations can be useful.
It could be useful to view history moves using Algebraic notation.
Some useful links:
https://www.chess.com/terms/chess-notation
and https://www.chess.com/article/view/chess-notation
If this is something you would like to see I can help implement and create a MR.
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.