TinyCircuits Forum

TinyCircuits Products => Thumby => Topic started by: N-Dream on October 27, 2021, 02:23:27 PM

Title: Sudoku v1.02 by AirConsole
Post by: N-Dream on October 27, 2021, 02:23:27 PM
Hi there

I've created a 9x9 Sudoku for Thumby.

Feel free to give it a try, the script is attached. The game is in landscape mode.
When you try it in the emulator, make sure you rotate it by pasting the following in the javascript console of your browser:
Code: [Select]
(function(s){s.transform = "rotate(-90deg)";s.top="5%";})(document.getElementsByClassName("emulator_main")[0].style)
A little bit of background on how I implemented Sudoku:
It took me about 8h, it's amazing how easy it is to create games for this awesome platform. I'm used to much longer game-dev cycles with our gaming console  ;D
Anyways, generating a valid Sudoku grid actually requires quite some computational power.
In my first version, I tried to create a random Sudoku grid on the fly, but the stack size is unfortunately too small for my backtracking algorithm.
That's why I created 39 base patterns on my strong computer and added them as data to the script.
The base patterns can be flipped, rotated and group shifted in 72 ways, which give you already 2800 different Sudokus.
Together with number swapping (362'880 variations) we can generate 1'018'967'040 different Sudokus from the 39 base patterns.
All these Sudokus are "very hard to solve" and only have 25 or less clues. The data also includes the solution, which allows us to generate easier levels using clues and the solution on the fly.

I had a lot of fun implementing it and will probably create a few bigger games for Thumby.
Only wish I could already test it on real hardware. No idea how accurately the emulator is and I don't have a Thumby yet.
So anyone who already has one: Please let me know if the game works :)

Enjoy,
Andrin
(founder of AirConsole)

(EDIT: Version 1.02 Attached)
Title: Re: Sudoku v1.0 by AirConsole
Post by: CoolieCoolster on October 27, 2021, 08:05:29 PM
Really great content to file size ratio and very efficiently written, though I do think it's a bit much to have an "ad" pop up every time the user wins a game. In my opinion at least, a short message on the title screen or a credits menu would be more presentable.
Title: Re: Sudoku v1.0 by AirConsole
Post by: N-Dream on October 28, 2021, 02:51:53 AM
Update 1.01:

The new version is attached in the original post.
Title: Re: Sudoku v1.0 by AirConsole
Post by: N-Dream on October 28, 2021, 03:28:00 AM
So I decided to give every user that solves the Sudoku on the Thumby, one week of our premium AirConsole subscription for free, cause I think it's awesome to be able to win real prizes on this lovely little pocket game device - they just need to scan the QR code that is displayed in the winning screen ;D ;D ;D
Title: Re: Sudoku v1.0 by AirConsole
Post by: CoolieCoolster on October 28, 2021, 05:03:52 PM
I think the QR code is even more out of place than the ad, but each to one's own.
Title: Re: Sudoku v1.02 by AirConsole
Post by: N-Dream on October 29, 2021, 04:42:48 AM
(Changelog v1.02)