abberration Posted June 27, 2021 Share Posted June 27, 2021 (edited) I have been wanting to program a game and now I have done it. It's a fairly small script with no fluff like About boxes or instructions. Now I need to make a chess game (kidding). Hope everyone likes it. Cheers! 🥃 Update: Thanks to Dan_555's suggestion, I have changed the randomize option to move tiles around instead of using _arrayshuffle. Also, I added in a Settings option so you tell it how many moves to shuffle it. Download v.1.1 for these features.  The Slide Puzzle v.1.0.zipThe Slide Puzzle v.1.1.zip Edited June 27, 2021 by abberration New version posted Lion66 and Dan_555 2 Easy MP3 | Software Installer | Password Manager Link to comment Share on other sites More sharing options...
Lion66 Posted June 27, 2021 Share Posted June 27, 2021 I like. You can also add control from the keyboard. abberration 1 Link to comment Share on other sites More sharing options...
Dan_555 Posted June 27, 2021 Share Posted June 27, 2021 (edited) Hi, the game is nice but the array-shuffle can create unsolvable puzzles. You have to swap the pieces one by one, in the code, just like you would do it manually. (by moving the empty square up/down/left/right randomly, swapping the numbers) You can test a puzzle solver here: https://gamingph.com/blackdesertmobile/puzzle/puzzle.html  Drag the pieces from the top square to the bottom square and in this order: 1 2 3 4 5 8 7 6  And the puzzle (afaik) can not be solved.  Edited June 27, 2021 by Dan_555 abberration 1 Some of my script sourcecode Link to comment Share on other sites More sharing options...
abberration Posted June 27, 2021 Author Share Posted June 27, 2021 Hi, Dan_555. Thank you for your input. I didn't think about it creating unsolvable puzzles. It might be neat to watch it shuffle the pieces around. I will work on that for the next version. Easy MP3 | Software Installer | Password Manager Link to comment Share on other sites More sharing options...
jchd Posted June 27, 2021 Share Posted June 27, 2021 (edited) As a general rule of thumb, a 2D shuffle puzzle of dimension N (that is of size NxN) is solvable iff, when reading values from, say, top left to bottom right, row by row) the number of permutations of cells (cell with value X appears before cell with value Y AND X > Y) is even. This works whatever the empty cell is. @Dan_555 example gives a odd number of permutations, hence it isn't solvable. For those who care, here's a wiki page explaining the fact: https://fr.wikipedia.org/wiki/Signature_d'une_permutation Sorry, as is often the case in wikipedia maths pages, there is no direct english translation. Try Google translate if that works, but many French terms used in combinatorics have only vague equivalent in english (and often ambiguous) due to a radically different approach to the domain. Edited June 27, 2021 by jchd Dan_555 and abberration 2 This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
abberration Posted June 27, 2021 Author Share Posted June 27, 2021 jchd, Good to know. I tried to come up with a formula to figure out which tiles are adjacent, but I couldn't. I saw patterns and I knew I could hard code the moves, but that seemed lazy. I have already implemented the moving tiles around in v.1.1. It is posted on the first post. Now I'm off to make a BlackJack game! Cheers. Easy MP3 | Software Installer | Password Manager Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now