- Introduction
- Features
- Requirements
- Installation
- How to Run
- How to Play
- Project Structure
- Contributing
- License
This is a Java implementation of the classic card game "War" with a graphical user interface. The game is designed for two players and follows standard War game rules, including handling "war" scenarios when players draw cards of equal value.
- Graphical User Interface (GUI) for easy interaction
- Two-player gameplay
- Automated card dealing and gameplay
- "War" scenario handling
- Game state saving and loading
- Sound effects for various game events
- About section with developer information
- Java Development Kit (JDK) 8 or higher
- Java Runtime Environment (JRE) 8 or higher
- Clone the repository:
git clone https://github.com/yourusername/WarCardGame.git
- Navigate to the project directory:
cd WarCardGame
- Compile the Java files:
javac -d bin src/**/*.java
- Run the game:
java -cp bin WarCardGame
Alternatively, if you're using an IDE like Eclipse or IntelliJ IDEA, you can import the project and run the WarCardGame
class.
- Launch the game.
- Click the "Start Round" button to begin a new round.
- Each player clicks their "Play Card" button to play a card.
- The player with the higher card value wins the round and collects both cards.
- In case of a tie, a "War" is initiated automatically.
- The game continues until one player has all the cards.
The project is organized into two main packages:
-
model
: Contains the game logic classesCard.java
: Represents a playing cardDeck.java
: Manages a collection of cardsPlayer.java
: Represents a player in the gameGame.java
: Manages the game state and logicGameSaver.java
: Handles saving and loading game progress
-
view
: Contains GUI-related classesGameGUI.java
: Main GUI class for the gameCardView.java
: Visual representation of a cardPlayerView.java
: Visual representation of a player's areaMenuBar.java
: Implements the game menuBackgroundPanel.java
: Handles the game backgroundSoundPlayer.java
: Manages sound effects
Contributions to improve the game are welcome. Please follow these steps:
- Fork the repository
- Create a new branch (
git checkout -b feature/AmazingFeature
) - Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE.md file for details.