Skip to content

Built an engaging two-player game with real-time score updates and interactive elements. The score needs to be hold strategically as at the moment the dice hits 1, the player is switched automatically .The 1st that reaches 100 wins.

Notifications You must be signed in to change notification settings

MaddiePst/Pig-Game.github.io

Repository files navigation

The Pig Game

The Pig Game project is a fun, interactive two-player dice game with simple mechanics and engaging features. The goal of the game is for one player to reach a score of 100 before the other, making strategic choices about whether to continue rolling the dice or hold their current score. The game showcases proficiency in DOM manipulation, event handling, and state management on the front end.

Project Description In the Pig Game, each player takes turns rolling a dice. Players accumulate points on each roll but lose their turn if they roll a 1, which resets their round score to zero. During a turn, players have the option to “hold,” which saves their accumulated points to their overall score and passes the turn to the other player. The first player to reach 100 points wins the game. The app’s interface provides real-time feedback on each roll, score updates, and displays the winner.

Unique Features from a Front-End Developer Perspective

-- Dynamic Score and Turn Management: The app dynamically updates each player’s current and total score after every roll or hold action, creating a seamless user experience. Each action triggers UI updates to reflect the game state accurately. This feature highlights the developer's ability to handle and display dynamic data effectively, using JavaScript for DOM manipulation to provide instant feedback to players.

-- Interactive UI with Real-Time Feedback: The app includes real-time notifications for each player's action (e.g., when a 1 is rolled, or when a player chooses to hold their score). Visual indicators highlight the active player and help players track game progress. This enhances user experience by offering immediate, interactive feedback and demonstrates proficiency in using event-driven programming in JavaScript.

-- Turn-Based Game Logic with Conditional Programming: The app features logic that automatically switches turns when a player rolls a 1 or chooses to hold. This involves conditional checks and programmatic state management to ensure the correct player's turn. Implementing this logic showcases an understanding of game mechanics and flow, as well as skill in developing smooth, condition-based user interactions that make the game fair and enjoyable.

-- Reset and Restart Functionality: Players can restart the game at any point, resetting all scores and returning to the starting state. This feature improves the user experience by providing flexibility and allowing players to quickly start a new round without refreshing the page. This feature demonstrates understanding in creating a reusable game state, resetting variables, and updating the UI accordingly—all essential for a user-friendly game application.

The Pig Game project is an excellent demonstration of a front-end developer’s ability to create engaging and interactive applications. By implementing dynamic score updates, turn-based logic, and real-time feedback, this project showcases a strong grasp of JavaScript programming and event handling. It highlights both technical skills and a focus on creating an enjoyable user experience.

About

Built an engaging two-player game with real-time score updates and interactive elements. The score needs to be hold strategically as at the moment the dice hits 1, the player is switched automatically .The 1st that reaches 100 wins.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published