Odin Project: Rock, Paper, Scissors
This is a simple implementation of the classic game "rock, paper, scissors" written in JavaScript and HTML. The logic has been updated to include a button-based UI, enabling user interactions for a better experience.
Description
The user can play the game by clicking on buttons to make their choice to play against the computer. The computer makes a random choice each round. The game basis is first to five points. The status is displayed in the browser after each round and the user is notified if they have won or lost the game via a text output, which also tallies the final result. This updated iteration includes a simple button UI to improve user experience.
What I Learned
- How to use vanilla JavaScript logic to implement a game
- How to generate random numbers using Math.random()
- How to use conditionals and loops to control program flow and repeat actions
- How to handle user inputs using event listeners and how to validate input using conditionals
- How to use console.log() to output messages to the console for debugging and game status feedback
- How to manipulate the DOM to create a better user experience using buttons and event listeners
Thoughts and Observations
This project helped me to deepen my understanding of JavaScript fundamentals and apply them to a fun and engaging project. I enjoyed the process of adding a UI to the game using event listeners and DOM manipulation which was challenging but rewarding. I feel the updated version is more engaging and user-friendly. While The UI has not been fully styled yet, I intend to return to the project in the future to improve the user experience further. However, as it stands it is a functional game which meets all the brief requirements.