Chess Project Learning Journal


Jan 8, 2023
I got code from https://chat.openai.com/chat to start this project.
chatGPT INPUT LINE:

write javascript code that creates a chessboard

chatGPT OUTPUT LINE:

      function drawChessBoard() {
        let board = "";
        for (let i = 0; i < 8; i++) {
          for (let j = 0; j < 8; j++) {
            if ((i + j) % 2 === 0) {
              board +=
                " #";
            } else {
              board += " ";
            }
          }
          board += "\n";
        }
        console.log(board);
      }

      drawChessBoard();
    

I got code from the AI and pasted it in. I turned it into usable code by tunning it up.s


Jan 15, 2023
I needed chess pieces for the chess board. The pieces come in unicode. My idea was to go on Wikipedia and copy the unicode for each piece https://en.wikipedia.org/wiki/Chess_symbols_in_Unicode.

I did some math in the code for positioning the chess pieces. This math is hard but I got some of it right with the rook and the pawns.


Jan 29, 2023
I completed making all the pieces, which are written in unicode. My new learning this week was putting the pieces in the correct squares.

I learned how to make the pieces draggable. The pieces are now draggable but now they need to be placable. I am using the following link as a recourse to try and understand that. https://web.dev/drag-and-drop/.


Feb 6, 2023
I am using the URL below as a reference.

https://www.w3schools.com/html/html5_draganddrop.asp.


Feb 9, 2023
Today my dad helped me make the pieces move without snapping back into the original position. I used this link for a reference. https://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_ondragover


Feb 11, 2023
I fixed a problem with the pawns. They had the same ID string. I generated a random number and attached it to the ID. I also fixed the color of the pieces by changing and getting rid of color schemes in the css classes.


Feb 15, 2023
Today, I made I fixed a problem with the chess pieces not elimenating one another and to do that I added a thing called captured and moved.