JavaRush /Java Blog /Random EN /Made the game "Eighties"
Level 26

Made the game "Eighties"

Published in the Random EN group

Salute, friends!

A couple of days ago I thought that just reading lectures and solving standard problems will not satisfy you. In any case, the acquired knowledge should not only be practiced on “cats”, but also sent somewhere. Of course, I wanted to make a game ^_^. After thinking a little, I found the most accessible topic of two-dimensional arrays ("Tag", 2048, Tetris, even fly a snake!).

Eights, Console

I settled on “Tag” (fortunately, I grew up playing this game. I know what and how it works). In general, the decision was made, the code began to be written. First of all, I tried everything in the console. Collecting a 2x2 field for a test, of course, is not comme il faut. Too often dead-end combinations appear. But 3x3 is already more enjoyable (by the way, the name of the game was adopted precisely because of the size of the field). In the process, I encountered streams (Finally! We came face to face with the enemy. It turns out that they can be tamed and taught to work for your benefit. I’m happy)).

Working with the SWING library

A little later, I looked at the capabilities of the SWING library and successfully dressed the game in some kind of interface. Field selection is now available in the game. The test showed that the game handles all errors without problems. And when working with a 3x3 field, it gives a 100% answer to the question “Is the problem being solved?” Unfortunately, there was no example code at hand. I had to write all the logic myself. There may be bicycles (if there are any, poke my nose at them, please). I also have huge questions about the cleanliness and readability of the code. I really want to be, if not thanked for the clean code, then certainly not cursed for the garbage))) And of course - the presence of comments - where are they missing? If you have any recommendations/suggestions for the code, please let me know. If you want to join the project, let me know. I would love to team up with anyone to work on this and other projects. link to GitHub