Coder Social home page Coder Social logo

reddragonwebdesign / php-chess Goto Github PK

View Code? Open in Web Editor NEW
4.0 4.0 2.0 70 KB

Play chess on the web. Legal move generator working 100%. PHP, optimized, OOP code.

Home Page: https://www.reddragonwebdesign.com/projects/php-chess/

JavaScript 1.33% CSS 1.61% PHP 97.06%
chess chess-game game move-validator oop php

php-chess's People

Contributors

reddragonwebdesign avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

php-chess's Issues

Null error when no king in FEN

When reading this FEN. Related to ChessRulebook

8/8/8/3pp3/4P3/3P1N2/PPP1BPPP/RNBQK2R w KQkq d6 0 5

`Fatal error: Uncaught TypeError: Argument 3 passed to ChessRulebook::square_is_attacked() must be an instance of ChessSquare, null given, called in D:\Dropbox\Code\chess\chess_v2.2 [before putting on Red Dragon Web Design]\models\ChessRulebook.php on line 675 and defined in D:\Dropbox\Code\chess\chess_v2.2 [before putting on Red Dragon Web Design]\models\ChessRulebook.php on line 794

TypeError: Argument 3 passed to ChessRulebook::square_is_attacked() must be an instance of ChessSquare, null given, called in D:\Dropbox\Code\chess\chess_v2.2 [before putting on Red Dragon Web Design]\models\ChessRulebook.php on line 675 in D:\Dropbox\Code\chess\chess_v2.2 [before putting on Red Dragon Web Design]\models\ChessRulebook.php on line 794`

Ambiguous legal moves

When importing the FEN 'r1bqkb1r/ppp2ppp/2n2n2/3pp3/4P3/3P1N2/PPP1BPPP/RNBQK2R w KQkq d6 0 5' the script lists several legal moves. One of them is 'Nd2', but that's ambiguous. It should be clarified to 'Nbd2' and 'Nfd2'.

Add tests

This should be very unit testable in something like PHPUnit. Add unit tests.

Catch and handle exceptions. Invalid FEN causes fatal error

4k3/8/8/8/8/5N2/8/1N2K3 w KQkq d6 0 5

Fatal error: Uncaught Exception: Invalid FEN - Castling permissions set to TRUE but rook is missing in D:\Dropbox\Code\chess\chess_v2.2 [before putting on Red Dragon Web Design]\models\ChessRulebook.php on line 646

8/8/2n2n2/3pp3/4P3/3P1N2/PPP1BPPP/RNBQK2R w KQkq d6 0 5

Fatal error: Uncaught TypeError: Argument 3 passed to ChessRulebook::square_is_attacked() must be an instance of ChessSquare, null given, called in D:\Dropbox\Code\chess\chess_v2.2 [before putting on Red Dragon Web Design]\models\ChessRulebook.php on line 675 and defined in D:\Dropbox\Code\chess\chess_v2.2 [before putting on Red Dragon Web Design]\models\ChessRulebook.php on line 794

Make sure caching is disabled

Went to test something right now, and it was displaying an old version of the page until I did a hard refresh. Maybe send some headers that guarantee that no caching is used.

Faster perft (use recursion)

Faster Perft - use recursion instead of storing lists of ChessMoves at each depth. Then you just need to store the board/move list above you in the tree

User friendly perft page

Make a fast, live perft page. No other perft generators appear to be online/live, they're all offline. There's probably a need for test engine makers to use a quick, easy online perft.

Could even do the current perft, and give it a good user interface, and have it time out after 10 or 30 seconds.

Perft would be perfect for JavaScript. Client side resource usage instead of server side resource usage.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.