https://github.com/filonenkodima/piggame
PigGame is a simple dice game implemented in JavaScript, where two players compete to reach a target score. The game demonstrates core JavaScript concepts such as event handling, DOM manipulation, and state management in a fun, interactive environment.
https://github.com/filonenkodima/piggame
css frontend html javascript
Last synced: 29 days ago
JSON representation
PigGame is a simple dice game implemented in JavaScript, where two players compete to reach a target score. The game demonstrates core JavaScript concepts such as event handling, DOM manipulation, and state management in a fun, interactive environment.
- Host: GitHub
- URL: https://github.com/filonenkodima/piggame
- Owner: FilonenkoDima
- Created: 2024-01-23T22:02:24.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-08-28T16:24:30.000Z (over 1 year ago)
- Last Synced: 2025-06-03T22:55:18.256Z (11 months ago)
- Topics: css, frontend, html, javascript
- Language: CSS
- Homepage: https://filonenkodima.github.io/PigGame/
- Size: 2.81 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# PigGame
## About the Project
PigGame is a two-player dice game built using vanilla JavaScript, HTML, and CSS. The objective of the game is to reach a target score before your opponent by rolling dice and accumulating points. This project serves as a practice in JavaScript programming, focusing on interactive web development and game logic implementation.
Check out the [live demo](https://filonenkodima.github.io/PigGame/) of PigGame.
## Purpose of the Project
- Practiced JavaScript fundamentals including variables, functions, and loops.
- Applied DOM manipulation techniques to create an interactive gaming experience.
- Developed game logic including state management, event handling, and user interactions.
- Enhanced understanding of HTML and CSS for structuring and styling web applications.
## Getting Started
### Prerequisites
Make sure you have the following installed on your system:
- Git
- A web browser
### Installation
1. Clone the repository:
`git clone https://github.com/FilonenkoDima/PigGame.git`
2. Navigate to the project directory:
`cd PigGame`
3. Running the Application:
Open the index.html file in your preferred web browser to start the game.
## Project Structure
The project is organized as follows:
- `/css`: Contains the stylesheets for the game interface.
- `/img`: Contains images used in the game, such as dice faces.
- `/js`: Contains JavaScript files responsible for game logic and user interactions.
- `index.html`: The main HTML file that serves as the game's entry point.
## Game Rules and Features
- Game Objective: The first player to reach the target score wins the game.
- Rolling the Dice: Players take turns to roll a pair of dice. The rolled number is added to their current score.
- Holding: Players can choose to "hold" their score, adding it to their total score and passing the turn to the other player.
- Losing Points: If a player rolls a 1, they lose their current score for that turn and their turn ends.
- Winning the Game: The game ends when a player reaches or exceeds the target score (default is 100 points).
## Demo
