https://github.com/antoninazz/fifteen
This project is a console-based implementation of the classic Fifteen Puzzle game. The game consists of a grid of numbered tiles with one empty space. The objective is to arrange the tiles in numerical order by moving them into the empty space.
https://github.com/antoninazz/fifteen
console-application csharp dotnet
Last synced: 3 months ago
JSON representation
This project is a console-based implementation of the classic Fifteen Puzzle game. The game consists of a grid of numbered tiles with one empty space. The objective is to arrange the tiles in numerical order by moving them into the empty space.
- Host: GitHub
- URL: https://github.com/antoninazz/fifteen
- Owner: AntoninaZz
- Created: 2025-03-04T09:18:51.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2025-03-04T09:27:54.000Z (over 1 year ago)
- Last Synced: 2025-03-04T10:31:43.772Z (over 1 year ago)
- Topics: console-application, csharp, dotnet
- Language: C#
- Homepage:
- Size: 8.79 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Fifteen Puzzle Game (C# Console Application)
## Description
This project is a console-based implementation of the classic Fifteen Puzzle game. The game consists of a grid of numbered tiles with one empty space. The objective is to arrange the tiles in numerical order by moving them into the empty space.
## Features
- Supports grid sizes from **3×3 to 9×9**
- Allows valid tile movements (up, down, left, right) if adjacent to the empty space
- Detects when the puzzle is solved
- Displays the board state in a formatted layout
## Technologies Used
- **C#** for core logic
- **Console Application** for user interaction
- **2D Array** for board representation
## Key Methods
- `init()` - Initializes the board with numbered tiles
- `draw()` - Prints the current board state
- `move(int tile)` - Moves the specified tile if possible
- `won()` - Checks if the puzzle is solved
- `greet()` - Displays a welcome message