Skip to content

Rahulx0/cipherschool-java-game

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

2 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŽฒ Multiplayer Dice Game

A professional Java Swing application demonstrating Object-Oriented Programming principles and modern GUI development.

Java Swing License

๐ŸŽฏ Overview

This multiplayer dice game is a complete Java Swing application built to showcase software development skills. It features a clean MVC architecture, intuitive UI, and demonstrates core OOP principles including encapsulation, inheritance, polymorphism, and abstraction.

Perfect for:

  • โœ… GitHub portfolio projects
  • โœ… Resume enhancement
  • โœ… Learning Java Swing
  • โœ… Understanding game development logic
  • โœ… Practicing OOP concepts

โœจ Features

  • ๐Ÿ‘ฅ 2-6 Player Support - Play with friends in hot-seat multiplayer
  • ๐ŸŽฒ Interactive Dice - Click to hold/unhold dice between rolls
  • ๐Ÿ† Score Tracking - Real-time scoreboard with active player highlighting
  • ๐ŸŽฏ Multiple Scoring Combos - Five of a Kind, Straights, Full House, and more
  • ๐Ÿ’พ Customizable Settings - Adjust target scores and game rules
  • ๐ŸŽจ Modern Dark UI - Clean, professional interface with smooth interactions
  • ๐Ÿ“Š Turn Management - Automatic turn progression and winner detection
  • โš™๏ธ Menu System - Easy access to game controls and help

๐Ÿ“ธ Screenshots

Add screenshots of your game here after running it!

[Main Game Screen]     [Scoreboard]     [Winner Screen]

๐ŸŽฎ Game Rules

Objective

Be the first player to reach the target score (default: 10,000 points)!

Scoring Combinations

Combination Score Description
Five of a Kind 5000 All five dice show the same number
Four of a Kind 2000 Four dice show the same number
Straight 1500 1-2-3-4-5 or 2-3-4-5-6
Three of a Kind 1000 Three dice show the same number
Full House 750 Three of one number + two of another
Two Pairs 500 Two different pairs
Single 1 100 Each 1 is worth 100 points
Single 5 50 Each 5 is worth 50 points

How to Play

  1. Roll the Dice - Click "Roll Dice" to roll all five dice
  2. Hold Dice - Click on individual dice to hold them for the next roll
  3. Re-roll - You get up to 3 rolls per turn
  4. End Turn - Click "End Turn" to add your score and pass to next player
  5. Win - First player to reach the target score wins!

๐Ÿš€ Installation

Prerequisites

  • Java JDK 11 or higher
  • Maven (recommended) or Gradle
  • Git

Clone the Repository

git clone https://github.com/yourusername/multiplayer-dice-game.git
cd multiplayer-dice-game

Build and Run

Using Maven (Recommended)

# Compile the project
mvn clean compile

# Run the game
mvn exec:java -Dexec.mainClass="com.dicegame.Main"

# Create executable JAR
mvn clean package
java -jar target/multiplayer-dice-game-1.0.0.jar

Using Gradle

# Build the project
./gradlew build

# Run the game
./gradlew run

# Create executable JAR
./gradlew jar
java -jar build/libs/multiplayer-dice-game-1.0.0.jar

Using IDE

  1. Import the project into IntelliJ IDEA, Eclipse, or VS Code
  2. Wait for dependencies to resolve
  3. Run Main.java from src/main/java/com/dicegame/

๐Ÿ“ Project Structure

multiplayer-dice-game/
โ”œโ”€โ”€ src/
โ”‚   โ””โ”€โ”€ main/
โ”‚       โ””โ”€โ”€ java/
โ”‚           โ””โ”€โ”€ com/
โ”‚               โ””โ”€โ”€ dicegame/
โ”‚                   โ”œโ”€โ”€ Main.java                    # Application entry point
โ”‚                   โ”œโ”€โ”€ models/                      # Data models
โ”‚                   โ”‚   โ”œโ”€โ”€ Player.java              # Player entity
โ”‚                   โ”‚   โ”œโ”€โ”€ Dice.java                # Single die
โ”‚                   โ”‚   โ”œโ”€โ”€ DiceSet.java             # Set of 5 dice
โ”‚                   โ”‚   โ””โ”€โ”€ ScoreCalculator.java     # Scoring logic
โ”‚                   โ”œโ”€โ”€ controllers/                 # Business logic
โ”‚                   โ”‚   โ””โ”€โ”€ GameController.java      # Game state manager
โ”‚                   โ”œโ”€โ”€ views/                       # UI components
โ”‚                   โ”‚   โ”œโ”€โ”€ MainFrame.java           # Main window
โ”‚                   โ”‚   โ”œโ”€โ”€ GamePanel.java           # Game display
โ”‚                   โ”‚   โ”œโ”€โ”€ DicePanel.java           # Dice visualization
โ”‚                   โ”‚   โ”œโ”€โ”€ ControlPanel.java        # Game controls
โ”‚                   โ”‚   โ””โ”€โ”€ ScoreBoardPanel.java     # Score display
โ”‚                   โ””โ”€โ”€ utils/                       # Utilities
โ”‚                       โ”œโ”€โ”€ Constants.java           # App constants
โ”‚                       โ””โ”€โ”€ ColorScheme.java         # UI colors
โ”œโ”€โ”€ pom.xml                                          # Maven config
โ”œโ”€โ”€ build.gradle                                     # Gradle config
โ”œโ”€โ”€ .gitignore                                       # Git ignore rules
โ””โ”€โ”€ README.md                                        # This file

๐ŸŽ“ OOP Concepts Demonstrated

Encapsulation

  • Private fields with public getters/setters in Player and Dice classes
  • Data hiding and controlled access to internal state

Inheritance

  • All view panels extend JPanel with customized behavior
  • Demonstrates code reuse and hierarchical relationships

Polymorphism

  • Different scoring strategies can be implemented
  • Mouse event handling with overridden methods

Abstraction

  • ScoreCalculator provides high-level scoring interface
  • Complex scoring logic hidden behind simple methods

Composition

  • GameController contains Players, DiceSet
  • MainFrame composed of multiple panel components

MVC Pattern

  • Models: Player, Dice, DiceSet, ScoreCalculator
  • Views: MainFrame, GamePanel, DicePanel, ControlPanel, ScoreBoardPanel
  • Controllers: GameController

๐Ÿ› ๏ธ Technologies

  • Java 11+ - Core programming language
  • Swing - GUI framework
  • Maven/Gradle - Build automation
  • Git - Version control
  • MVC Architecture - Design pattern

๐Ÿ“š Learning Resources

This project demonstrates:

  • โœ… Java Collections (ArrayList, HashMap)
  • โœ… Exception Handling
  • โœ… Event-Driven Programming
  • โœ… GUI Layout Managers
  • โœ… Custom Component Painting
  • โœ… State Management
  • โœ… Algorithm Implementation

About

No description, website, or topics provided.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages