Java Slide Puzzle

Java Slide Puzzle screenshot

A Java-written text-based slide puzzle game. It only works on the console and uses a sorted array of numbers, instead of an image.
It simple operates on a 2D array and the input and output happens on the console, which lends itself great to exercise in the first semester of a computer science study.
A Scanner instance reads how big you want the game field (square), at the beginning . Then such a field is created and mixed with a few permissible permutations.
Then the player can swap the zero with the number in the appropriate direction by entering the letters WASD until all the numbers are in the correct order.

A solved game with the size of 3x3 looks as follows:

1 2 3
4 5 6
7 8 0

Download

Java Slide Puzzle
The packed file "Puzzle.java".
Puzzle.zip
Komprimiertes Archiv im ZIP Format 1.4 KB

Profil von Michael Grönert auf LinkedIn anzeigen

 

Michael Grönert

 

Michael Grönerts DevBlog anzeigen

 

Michael Grönert auf GitHub anzeigen

 

Profil von Michael Grönert auf DeviantArt anzeigen