Skip to content

Implementation of the classic game Lights Out in Java-Swing for the GUI, Interactive customizable board with difficulty modes and a top 10 leaderboard.

Notifications You must be signed in to change notification settings

jjdiazo1/LightsOutJavaSwing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lights Out Game Java Swing

Demo.Game.mp4

Overview

Lights Out is a classic puzzle game where the objective is to turn off all the lights on the board. The game is implemented in Java as part of a project for the Object-Oriented Programming course. It includes two difficulty modes (Easy and Hard) and supports various board sizes. The game tracks the top 10 best players based on their performance.

UML Diagram

The game is structured using the Model-View-Controller (MVC) design pattern. The UML diagram shows the relationship between different classes:

UML LightsOut
  • Modelo: Contains the classes responsible for managing the game logic and data. The key classes include:

    • Top10: Manages the top 10 player scores.
    • Tablero: Manages the game board and game state.
    • RegistroTop10: Stores information about the best players.
  • Vista: Contains the graphical user interface (GUI) and user interactions. The key classes include:

    • LightsOutGUI: The main class that initializes the game window, handles user input, and displays the game state.
    • TableroPanel: Manages the visual representation of the game board.
  • Interface: Handles interaction between the board (Tablero) and the graphical representation (TableroPanel). It also captures user inputs through the MouseListener interface, allowing the player to interact with the game.

The diagram shows how each class interacts to manage the game state, display the game, and record high scores.

Game Modes

  1. Easy Mode:
    • The player has fewer lights to turn off, and the board is simpler to navigate.
    • Suitable for quick games or new players learning the mechanics.
Screenshot 2024-10-10 at 6 55 10 PM
  1. Medium Mode
    • Intermediate difficulty
Screenshot 2024-10-10 at 7 19 15 PM
  1. Hard Mode:
    • The board size increases, and the patterns of light changes are more complex.
    • Provides a greater challenge for experienced players.
Screenshot 2024-10-10 at 6 55 56 PM

Players can choose the game mode using the difficulty selector in the GUI.

How to Run the Game

To run the Lights Out game, follow these steps:

  1. Clone the repository or download the project files.
  2. Open the project in an IDE such as Eclipse or IntelliJ.
  3. Run the LightsOutGUI.java class. This class is responsible for initializing the game window and starting the game.

The game interface allows you to select the board size and difficulty level, start a new game, reset the board, and view the top 10 scores.

Features

  • Top 10 Scores: The game maintains a list of the top 10 scores, which can be reset by the user.
Screenshot 2024-10-10 at 6 55 50 PM
  • Adjustable Board Sizes: Choose between multiple board sizes, from 4x4 to 10x10.
Screenshot 2024-10-10 at 7 04 56 PM
  • Interactive GUI: The player interacts with the board by clicking on tiles, which toggles the lights.
Screenshot 2024-10-10 at 6 54 54 PM

About

Implementation of the classic game Lights Out in Java-Swing for the GUI, Interactive customizable board with difficulty modes and a top 10 leaderboard.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages