Skip to content

Ivanlaguna511/MatrixLogic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MatrixLogic (Practice of the subject Programming Fundamentals, first quarter of the first year)

Java Terminal Data Structures


About the Project

MatrixLogic is a terminal-based logic puzzle game (widely known as Takuzu or Binary Puzzle). This project was developed as a practical assignment for the Programming Fundamentals course (First quarter, 1st Year of Computer Engineering).

The game challenges the player to fill a dynamic grid using only 'X' and 'O' tokens, adhering to a strict set of logical constraints. It features multiple randomized boards parsed from a local text database and a robust Undo system.

Gameplay Rules

MatrixLogic Gameplay To successfully solve a board, the following conditions must be met:

  1. Immutable Seed: Initial uppercase tokens (X and O) cannot be modified.
  2. Equilibrium: Each row and each column must contain the exact same number of Xs and Os.
  3. No Triples: No more than two identical elements can be placed consecutively in any row or column.
  4. Uniqueness: No two rows can be identical. No two columns can be identical.

Tech Stack & Technical Features

  • Language: Java 8+
  • Interface: Command-Line Interface (CLI)

Key Implementation Details

  • Stack-Based History (Undo System): Leverages java.util.Stack (LIFO) to store deep copies of board states, allowing the user to seamlessly revert their moves dynamically step-by-step to the very beginning.
  • File Parsing & I/O Optimization: Uses BufferedReader wrapped in a try-with-resources block to safely and efficiently read level layouts dynamically from a .txt database.
  • Matrix Validation Algorithms: Implements 2D array traversal algorithms to validate the grid against complex geometric rules (row/column equivalence and contiguous character counting).
  • Defensive Input Parsing: Robust console input validation with dynamic coordinate boundaries parsing (e.g., handling boundaries for inputs like 1A or 12D).

How to Run Locally

Note: The game requires the tableros.txt file to be located in the root directory alongside the executable to load the levels properly.

1. Clone the repository:

git clone [https://github.com/Ivanlaguna511/MatrixLogic.git](https://github.com/Ivanlaguna511/MatrixLogic.git)
cd MatrixLogic

2. Compile the Java file:

javac MatrixLogic.java

3. Run the application:

java MatrixLogic

Original Authors

-Iván Moro Cienfuegos and Diego Martín García

About

A terminal-based logic puzzle game (Takuzu/Binary Puzzle) built in Java. Developed as a 1st-year Computer Engineering project

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages