zhutoutoutousan / chess-game

A basic chess game application with a simple AI

Home Page:https://mxxtherfxxing-chess-game.herokuapp.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

chess-game

A simple chess game with basic AI

Tech stack

  • ES6
  • Object Oriented Programming
  • P5.js
  • Express
  • Node.js

File structure

|--- server.js   // main entry node file to be executed by the server
|--- procfile // what to input on heroku dyno interface
|--- package.json
|--- package-lock.json
|--- view --- index.ejs // board view
|--- public ---|--- img
               |--- css // body and chessboard
               |--- js ---|--- libraries // p5.js
                          |--- script ---|- Pieces.js
                                         |- board.js
                                         |- chess-ai.js
                                         |- sketch.js

Packages and dependencies

Front-end

  • p5.js

Back-end

  • DX
    • Framework
      • express
    • Template Engine
      • ejs
    • Resource management
      • serve-favicon
      • css-loader
    • Hot reload
      • nodemon
  • ENV
    • Heroku
    • package.json ---> devDependencies

Testing and automation

  • jest

Progress

  • Chessboard
  • Game mechanics
    • When you win, the game is stuck
    • Create save game
    • Create records of movements
  • Chess Pieces
    • Initial design
    • ? The black bishop sometimes disappear
      • ? diagsweep add logic
    • If you click the queen twice, it just disappear
      • In QUEEN: canMove function, the basicCondition returns the wrong value
      • Although it cannot Move, it still sees it as attacking and took itself.
      • Source : The execution order of boolean
    • Rook can move through pieces vertically(not horizontally)
      • Source : Still the execution order of boolean
    • Pawn can travel out of bounds
    • Pawn doesn't promote
    • Pawn doesn't en passant
      • There is a firstTurn indicator, but it doesn't work
        • When a pawn has been moved, there is no telling whether it is consecutive or not
      • Develop the canEnPassant boolean logic
      • Use pawn class property canBeEnPassent
        • The property switch back to false before the next move
          • It happened in the RunAI() function
            • Thinking over this question surpasses the current mental capacity, write it down
          • WORKAROUND: maybe you can add store Enpassant and store it back
      • Chrome devTool technique(optional)
        • Gather as much information as you can
    • Black bishop can move sideways while white can't
    • Pawn can't march if it can attack
    • Pawn can march and attack
  • AI
    • Algorithms
    • Enemy loves moving pawn
      • Check the canMove area
      • Check if AI function is working the right way
        • Found an error in canMove in Piece class
  • Decoration
    • Start the game
    • Restart the game
    • Initialize the CSS layout
  • Multiplayer
    • Choose mode
    • Networking
  • Serving
  • Project architecture
    • Add 'sass-loader'
    • Add 'webpack' for better performance

About

A basic chess game application with a simple AI

https://mxxtherfxxing-chess-game.herokuapp.com/


Languages

Language:JavaScript 99.9%Language:EJS 0.1%