You are browsing as a guest. Sign up (or log in) to start making projects!

4h 57m 16s logged

I got sick 🤧🥀

Updates:

  • Make pieces position perfectly to square in chessboard
  • Moved chessboard states and refs to ChessboardContext.jsx
  • Fixed pieces sometimes being group together in one square when chessboard offsetWidth is null
  • Added destSquare element on click for all possible moves of rook

Last time I did position the squares but when I changed the background color of pieces there was a slight misalignment. I started searching what was causing that to happen. It was due to the height and width of chessboard being in decimals. I checked to see what lichess were doing and found out the height and width of the chessboard were always divisible by four. I did the same for my website and now it’s perfectly aligned and that’s what I love to see.


Moved the states and refs from chessboard.jsx to chessboardContext.jsx to make the chessboard code less cluttered. The code relevent to puzzles page is in the chessboardContext while the code revelent to vision page is still in the chessboard page.


When the page was loaded for the first time the pieces were being group together at the top left square. It was being fixed automically when the page was reloaded. It also happened while navagating from home page. I found out this was happenning due to chessboardWidth being null at start. To fix this I created a useState for the chessboardWidth so the page rerendered after the value was changed.


My goal today was to make the rook move but I could only work up to generating the destSquares when the piece is clicked. I achieved this by creating a useState array and if user now clicks on the rook it calculates all the possible squares that the rook can move to and then that array is mapped using math to place destSquares perfectly on top of squares. The destSquares have a dot insided them which will be replaced by a icon but that’s the reason they’re not aligned centered currently. I did have a hard time doing this. Let’s not talk about it. 😭


I’ve written everything in short so that I don’t hit the 4000 characters limit and also ig it’s better for people reading (if any 🥀).


I got sick yesterday and was just able to work on my project for 1 hr. Today I thought didn’t work much but it seems today I did 3 and half hrs. I am happy about today.


I really don’t know if I can create the puzzle but I’ll try my best to do so. Everything I try to do seems to come with their own set of challenges and take time to overcome those challenges. Let’s see what happens 😔

0
10

Comments 2

@AngelCMHxD

Hewo! Hope you are doing better

For puzzles, you might want to check out Lichess’ puzzles DB. They have 6M+ puzzles available, so you can have at least a base to work with. They mostly just have a FEN string, some tags, and the moves the player should do to solve the puzzle, hope it’s useful :P

https://database.lichess.org/#puzzles

@Sam

I’m doing fine now @AngelCMHxD. Thanks for asking 💖. Also thanks for letting me know about lichess puzzles db. My plan was to use the lichess db for the puzzles. Hope you are also doing well 🤞🫶