MichaelMrt / ChessPHP

Programming Chess in PHP
1 stars 0 forks source link

moving pieces with square selection #40

Closed MichaelMrt closed 6 months ago

MichaelMrt commented 6 months ago

You can now move pawns with inputs.

Click on a piece you'd like to select and then on a square you'd like to go to.

The work is not finished yet, some controlling features are missing but I'll fix it in the future.

MichaelMrt commented 6 months ago

I do not understand why but when you open chessgame.php once and then try to open it another time you always get the error

Warning: Undefined array key "whitesturn" in C:\dev\XAMPP\htdocs\ChessPHP\src\logic\logic.php on line 89 Fatal error: Uncaught TypeError: Cannot assign null to property Logic::$whitesturn of type bool in C:\dev\XAMPP\htdocs\ChessPHP\src\logic\logic.php:89 Stack trace: #0 C:\dev\XAMPP\htdocs\ChessPHP\src\logic\logic.php(32): Logic->reconstruct_chessboard_from_json('{"1":{"1":"","2...') #1 C:\dev\XAMPP\htdocs\ChessPHP\src\controller.php(11): Logic->construct() #2 C:\dev\XAMPP\htdocs\ChessPHP\src\chessgame.php(21): Controller->construct() #3 {main} thrown in C:\dev\XAMPP\htdocs\ChessPHP\src\logic\logic.php on line 89

You have to restart apache to be able to open it up again without an error.

MichaelMrt commented 6 months ago

You do not need to restart apache but you have to restart the browser. The $_SESSION always stores the chessboard and when you open a new tab the board will be at the same state unless you restart your browser.

I do not think it is that bad because you can still jump back into the game, but we for sure need a restart button now.

MichaelMrt commented 6 months ago

Closes #30