"Will code for travel"

Search technical info
Snakes and Ladders
Written: 2023-05-20 19:22:47 Last update: 2024-03-18 19:54:06

My son who is learning software programming shown me his simple C code to create a simple game of Snakes and Ladders, his code just the game logic and display the game running status using printf output to log.

We had a long discussion about how to create the game and what logics are required in his code, the long discussion gave me an inspiration to create a simple game GUI for the game with simple animation just to show him what is the game should feel like, a few days after the discussion I had a free time then I decided to start to create the game using HTML Canvas with vanilla Javascript, the created GUI is very simple, the game board uses the maximum screen area, initially the board size is a square but then I changed it to follow the screen size and the board could be a rectangle in portrait mode or landscape, on smartphone with lower screen resolution the board size will be less than PC desktop using 4K monitor, the total cells may be just under 100 to almost 400 cells, if it is too many cells then please adjust the browser size and refresh the page.

Do you feel lucky today? try your luck, click and choose which player will be the winner, enjoy the thrilling animation !

Play Snakes and Ladders
Snakes and Ladders flow logic
Notes:
  1. The game has an additional feature compared to the original Snakes and Ladders game, if a player arrived at a spot which has other player then the other player will be kicked back to first position.
  2. The number of Snakes and Ladders will be random, Snakes could be more or less than Ladders.
  3. Every time the web is refreshed, the locations of Snakes and Ladders will be changed.
  4. If player arrived in Snake position then the player position will go down.
  5. If player arrived in Ladder position then the player position will go up.
  6. The total players is fixed at 4, Chicken, Panda, Monkey, and Pig.
  7. Feel free to see the JS code, it is very simple and only to show what are the required steps and logic.
Search more info