Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Pig game #593

Open
wants to merge 2 commits into
base: Main
Choose a base branch
from
Open

Added Pig game #593

wants to merge 2 commits into from

Conversation

shivenyadavs
Copy link
Contributor

Related Issue

None

closes:#545

Description

This code is a web-based implementation of the "Pig Game", a two-player dice game where players compete to reach a target score of 100 points first. It consists of three main components:

  1. HTML Structure:
    Provides the layout for the game interface.
    Includes:
    Player sections for Player 1 and Player 2 with their scores (total and current).
    Game controls (buttons to roll dice, hold, and start a new game).
    A dice display area for the current dice roll.
    A footer explaining the game rules.
    Utilizes Bootstrap for responsive design and Font Awesome for icons.
  2. CSS Styling:
    Modern and visually appealing design with gradients, shadows, and animations.
    Features:
    Color-coded backgrounds to indicate the active player and winner.
    Hover effects and smooth transitions for interactive elements.
    Responsive layout adjustments for smaller screens.
  3. JavaScript Game Logic:
    Implements game functionality:
    Rolling Dice: Generates a random dice value and updates the display.
    Holding Score: Adds the current score to the player's total and switches turns.
    Switching Players: Alternates between players when a 1 is rolled or after holding.
    Winner Detection: Declares a winner when a player reaches the target score (100).
    Event Handlers:
    Attach functions to the roll, hold, and new game buttons.
    Use helper functions to update the UI and manage game state.
    Game Initialization: Resets the game for a new round.

Type of PR

  • Bug fix
  • Feature enhancement
  • Documentation update
  • Security enhancement
  • Other (specify): _______________

check in issue by entering [X] in boxes

Screenshots / Videos (if applicable)

[Attach any relevant screenshots or videos demonstrating the changes]

Checklist

  • I have performed a self-review of my code.
  • I have read and followed the Contribution Guidelines.
  • I have tested the changes thoroughly before submitting this pull request.
  • I have provided relevant issue numbers, screenshots, and videos after making the changes.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have followed the code style guidelines of this project.
  • I have checked for any existing open issues that my pull request may address.
  • I have ensured that my changes do not break any existing functionality.
  • Each contributor is allowed to create a maximum of 4 issues per day. This helps us manage and address issues efficiently.
  • I have read the resources for guidance listed below.
  • I have followed security best practices in my code changes.

Copy link

vercel bot commented Jan 18, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
100-days-100-web-project ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 18, 2025 2:36pm

Copy link
Contributor

Thank you for submitting your pull request! 🙌 We'll review it as soon as possible. In the meantime, please ensure that your changes align with our CONTRIBUTING.md. If there are any specific instructions or feedback regarding your PR, we'll provide them here. Thanks again for your contribution! 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant