Hello everyone! It has been a while since I have posted one of my projects on here, and I thought that needed to change. Just today I started a new concept of a classic game most people have played at one point or another, though it doesn't seem to have an official name that I could find, thus the name 'Number Puzzle'.

Anyway, the game involves sliding numbers around a board with a goal to get them into numerical order (1,2,3,etc.). Here is my first version with just the minimal of everything:


Things I plan on adding include (but are not limited to):
4x4 and 5x5 mode
custom controls (currently just the d-pad)
instructions page (it gets confusing)

Other than that, I am very much open to suggestions at the moment, even complete reworks are on the table. I messed around with different layouts and designs, but this one seemed to work the best. The game is technically in a playable state, just not up to my standards yet, and so I will hold off on uploading it for a little while. Finally, the game currently sits at 1,300 bytes, but I have done 0 optimization, and will most likely do some later.
So...
Funny story, I was just messing around with that prototype I had whipped up and noticed that sometimes it would generate an impossible puzzle. I resolved that I needed to fix it and so I did. In the process I actually learned a lot about the game and its history (like that the max amount of moves required ever to win is 31).

Sadly, with this patch to check if it generates a playable game, the game gained a few hundred bytes, and I was hoping someone could help me reduce that when it comes to checking for solvability. So I'm opening up to the public a request to make the code smaller (bytes). If you want to know how to check for the solvability, this website proved helpful with a simple yet effective explanation.

Thank you for helping me, especially so early on in the development of this game.
Instead of randomly inserting numbers in the puzzle and then check whether it is solvable or not, maybe you could try making a solved puzzle and then scrambling all the puzzle parts n times. I don't whether this will be as fast or even if it will be smaller, but you will at least have a perfectly solvable puzzle.
BasicTH wrote:
Instead of randomly inserting numbers in the puzzle and then check whether it is solvable or not, maybe you could try making a solved puzzle and then scrambling all the puzzle parts n times. I don't whether this will be as fast or even if it will be smaller, but you will at least have a perfectly solvable puzzle.


I thought about this, but I believe shuffling to be harder/larger than what I currently have. I'm not sure though, as I was extremely tired last night when I made those posts.

My current method, as shown in the website I linked, just has a bunch of ifs checking every other term in the sequence and adding 1 if it is greater than a later term repeated for every term. This method works, is fast, but is large when it comes to bytes.

I will be conducting future tests to see what else I can do.
Thank you all for your help with suggestions! I modified the code to shuffle instead of randomize and check like you all said and got it to a working state. It is definitely a little slower with the generation I currently have, but I can work on that. Along with the change, the overall code (with a few additions along with the modification) is only 1241 bytes now.

Again, thank you all for your input!

[EDIT]For some reason, my earlier method seemed to not randomize the puzzle that much. I did further research and found out that method has that flaw associated with it. I seem to have fixed that though with little extra work, I just safely randomized at the beginning (not enough to be truly random) and then shuffled the tiles from there. I also added the home menu functionality, and now the fully-functioning program is at 1,700 bytes.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are GMT - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement