Skip to content

✨ Welcome to the Pig Game! This game is a simple dice game where players take turns rolling a dice and accumulating points. The objective of the game is to be the first player to reach a certain score, typically 100 points. The Pig Game is a classic dice game that is both fun and easy to play. Each player takes turns rolling a six-sided die and add

Notifications You must be signed in to change notification settings

tucecifci/Pig-Game

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pig-Game

Hello everybody! 👋
✨ Welcome to the Pig Game! This game is a simple dice game where players take turns rolling a dice and accumulating points. The objective of the game is to be the first player to reach a certain score, typically 100 points. The Pig Game is a classic dice game that is both fun and easy to play. Each player takes turns rolling a six-sided die and adds the result to their current score. However, if a player rolls a 1, they lose all of their current points and their turn ends. The game continues until one player reaches the target score and wins the game.

👀 Overview

📷 Screenshot

screencapture-tucecifci-github-io-Pig-Game-2024-04-02-20_08_09 screencapture-tucecifci-github-io-Pig-Game-2024-04-02-20_08_33

screencapture-tucecifci-github-io-Pig-Game-2024-04-02-20_09_39

🔗 Links

My process

💡 Built with

The Pig Game is built using the following technologies:

  • HTML5: Used for structuring the webpage content and layout.
  • CSS3: Used for styling the game interface, including colors, typography, and layout.
  • JavaScript: Used for implementing the game logic, including dice rolling, turn management, and score calculation.

🧠 What I learned

While working on the Pig Game project, I learned:

  • How to implement game logic using JavaScript.
  • How to manipulate the DOM to create an interactive user interface.
  • How to handle user input and respond to user actions.
  • How to manage game state and track player scores.
  • How to incorporate randomness and probability into game design.
const switchPlayer = function () {
  document.getElementById(`current--${activePlayer}`).textContent = 0;
  currentScore = 0;
  activePlayer = activePlayer === 0 ? 1 : 0;
  player0El.classList.toggle('player--active');
  player1El.classList.toggle('player--active');
};
  btnNew.addEventListener('click', init);

👩🏼‍💻 Features

The Pig Game offers the following features:

  • Dice Rolling: Players can roll a six-sided die to accumulate points.
  • Turn-Based Gameplay: Players take turns rolling the dice and making decisions.
  • Point Accumulation: Players accumulate points with each successful roll.
  • Risk and Strategy: Players must decide whether to continue rolling and risk losing their points or end their turn and bank their points.
  • Win Condition: The game ends when one player reaches the target score and is declared the winner.

🤔 How to Play

To play the Pig Game:

  1. Open the index.html file in your web browser.
  2. Enter the target score (the score required to win the game).
  3. Click the "Roll Dice" button to roll the dice and accumulate points.
  4. Click the "Hold" button to bank your points and end your turn.
  5. Avoid rolling a 1, as this will cause you to lose all of your current points and end your turn.
  6. Continue playing until one player reaches the target score and wins the game.

🤌🏻 Useful resources

🙏 Special Thanks

  • Jonas Schmedtmann

🏳️‍🌈 Author

About

✨ Welcome to the Pig Game! This game is a simple dice game where players take turns rolling a dice and accumulating points. The objective of the game is to be the first player to reach a certain score, typically 100 points. The Pig Game is a classic dice game that is both fun and easy to play. Each player takes turns rolling a six-sided die and add

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published