CS110 · CS110 - Programming Fundamentals
Snakes and Ladders
A multiplayer Snakes and Ladders coursework game originally created in C++ and recreated as an animated browser experience with dice rolling, token movement, fixed snakes and ladders, and winner detection.
Overview
Snakes and Ladders was developed as a Programming Fundamentals coursework project using C++ and the Windows Console API.
The game uses a traditional 10×10 board containing one hundred numbered positions, fixed snakes and ladders, animated player movement, dice rolling, and support for one to four local players.
The project was later recreated as a responsive browser game using HTML, CSS, and Vanilla JavaScript.
Original C++ Implementation
The original application creates a serpentine board numbered from 1 to 100.
Each player is represented by one of four symbols:
- A
- B
- C
- D
The game supports between one and four local players.
The Windows Console version includes:
- Colored board output
- Mouse-controlled dice rolling
- Animated dice values
- Step-by-step token movement
- Player-position tracking
- Snake detection
- Ladder detection
- Winner detection
- Exact landing requirement for position 100
Board Rules
The board contains the following fixed snakes:
- 95 to 77
- 99 to 60
- 47 to 15
- 89 to 70
- 94 to 73
The board contains the following fixed ladders:
- 3 to 22
- 8 to 29
- 44 to 76
- 50 to 88
- 62 to 98
- 21 to 58
A move that would pass position 100 is rejected.
The player must land exactly on position 100 to win.
Browser Recreation
The web version includes:
- One to four local players
- Custom player names
- Traditional 10×10 serpentine board
- Fixed coursework snakes and ladders
- Animated dice rolling
- Animated token movement
- Distinct player colors and symbols
- Player-position display
- Turn management
- Exact-roll finish rule
- Game activity log
- Prominent winner message
- Restart controls
- Responsive desktop and mobile layout
Technical Approach
The C++ board numbering, snake arrays, ladder arrays, player positions, turn rotation, and exact-finish rule were translated into JavaScript game state.
Browser animations replace the Windows Console cursor movement and timed screen refreshes used by the original implementation.
Corrections
The corrected C++ version conservatively improves:
- Mouse-event validation
- Dice-box click detection
- Non-numeric player-count input
- Player names containing spaces
- Player-name buffer safety
- Player-specific movement colors
- Unnecessary second-click behavior
- Dead and unreachable movement code
The gameplay rules and fixed board mapping remain unchanged.
Repository Structure
The repository includes:
cpp/— corrected C++ coursework sourcecpp/original/— original submitted source- website root — browser recreation
docs/— fixes and feature-parity documentation
Outcome
The project demonstrates two-dimensional arrays, serpentine board mapping, random dice generation, player-state management, console drawing, mouse-event handling, animation, fixed transition rules, and browser-based game presentation.