Skip to content

FilonenkoDima/PigGame

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 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

About

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.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors