Omnimaga

Calculator Community => Other Calc-Related Projects and Ideas => TI Z80 => Topic started by: patz2009 on October 23, 2007, 01:57:00 pm

Title: Patz Calculator Sudoku
Post by: patz2009 on October 23, 2007, 01:57:00 pm
As some of you may know, I have spent a while making a sudoku game, known as Patz Calculator Sudoku, or PCSUDOKU. It is a sudoku program for the TI-83 Plus series of calculators, and features:Currently, though, I feel as though I have beaten this program so much that there isn't really anything more that I can do with it :Ptongue.gif So, I need some ideas! So, wanna give me some recommendations? ;)wink.gif I've been on a programmer's block and can't think of anything more to do with it, and if there's nothing more to do with it after my to-do list below is completed, I'm going to declare it a dead project.

Anyway, here are some screenshots:
user posted imageuser posted image

You can download Patz Calculator Sudoku from http://www.ticalc.org/archives/files/fileinfo/398/39819.html.


My to-do list:
c1-->
CODE
ec1- A couple size optimizations.
- Change hints to increase with difficulty, instead of decrease. (done)
- Add original number marking. (done)
- Moving instruction text to appear before filling in numbers.
- Add credits for HarrierFalcon's inspiration for the scrambling routine. (done) c2
ec2
Title: Patz Calculator Sudoku
Post by: DJ Omnimaga on October 23, 2007, 04:52:00 pm
Well I never played sudoku since I was never into puzzle games but your program looked nice. How long does it take to render a random sudoku?
Title: Patz Calculator Sudoku
Post by: patz2009 on October 23, 2007, 05:02:00 pm
On my 84+, making the random sudoku usually takes no more than 4 seconds. Removing the blocks are what takes up the most time (notice how the Simple difficulty takes a much shorter time to load than Suicidal)
Title: Patz Calculator Sudoku
Post by: DJ Omnimaga on October 23, 2007, 05:15:00 pm
sounds good, not too long, I may give it a try at one point :)smile.gif
Title: Patz Calculator Sudoku
Post by: Ranman on October 23, 2007, 05:16:00 pm
I really like Sudoku!

This game is laid out very nicely! Awesome job! :thumbup:google.gif
Title: Patz Calculator Sudoku
Post by: Liazon on October 24, 2007, 10:45:00 am
cool!

how're you generating the sudokus?
Title: Patz Calculator Sudoku
Post by: patz2009 on October 24, 2007, 11:54:00 am
I'm not entirely "generating" the sudokus per-se, but more like scrambling it.
c1-->
CODE
ec1:[[1,7,8,3,4,2,6,5,9][4,9,3,5,1,6,7,8,2][5,6,2,9,7,8,4,1,3][9,5,4,7,3,1,2,6,8][8,1,7,6,2,9,5,3,4][3,2,6,8,5,4,1,9,7][7,8,5,2,6,3,9,4,1][6,3,1,4,9,7,8,2,5][2,4,9,1,8,5,3,7,6→[J]
:For(A,0,1
:[J]T→[J]
:For(B,0,2
:For(C,0,7
:rowSwap([J],randInt(1,3)+3B,3B+randInt(1,3→[J]
:End
:End
:Endc2
ec2
I give it an already valid sudoku, and it scrambles it up. This idea was actually first of HarrierFalcon, but I modified it a bit.

Glad to hear that people are enjoying it. My mission with it was to be simple, fast, and small. Hopefully I have done at least that ;)wink.gif


Edit: Actually, thanks for bringing the scrambling routine to my attention. I'm going to optimize it to this:
c1
-->
CODE
ec1:[[1,7,8,3,4,2,6,5,9][4,9,3,5,1,6,7,8,2][5,6,2,9,7,8,4,1,3][9,5,4,7,3,1,2,6,8][8,1,7,6,2,9,5,3,4][3,2,6,8,5,4,1,9,7][7,8,5,2,6,3,9,4,1][6,3,1,4,9,7,8,2,5][2,4,9,1,8,5,3,7,6
:For(A,0,1
:AnsT
:For(B,0,2
:For(C,0,7
:rowSwap(Ans,randInt(1,3)+3B,3B+randInt(1,3
:End
:End
:End
:Ans→[J]c2
ec2
Should take up less space and go quite a bit faster :Dbiggrin.gif
Title: Patz Calculator Sudoku
Post by: DJ Omnimaga on October 24, 2007, 03:13:00 pm
do you have an idea of how many combinatiuon possible there is?
Title: Patz Calculator Sudoku
Post by: JonimusPrime on October 24, 2007, 03:39:00 pm
It looks goo but I still prefer Tari Sudoku2 with its cool eye candy and other fun stuff.
Title: Patz Calculator Sudoku
Post by: Liazon on October 25, 2007, 12:13:00 pm
ya, swapping was the only thing I could think of.  but there's kinda only so much you can do w/ swapping :(sad.gif

as you also just randomly taking out #s? or are you using preset masks to remove #s?
Title: Patz Calculator Sudoku
Post by: patz2009 on October 25, 2007, 12:26:00 pm
Using preset masks doesn't work so well when using different levels of difficulty, so I ended up just randomly removing them. Though it works slower, it reduces program size and allows for more difficulty levels.

Funny you should mention it, today I got bored at school and fixed up my blanking routine.
c1-->
CODE
ec1For(A,1,26+8D
Repeat (B,C
randInt(1,9→B
randInt(1,9→C
End
0→(B,C
Endc2
ec2

Anyway, in general news, I have made most of the optimizations I'm planning to do. I've added the feature which shows which numbers originally were generated with the puzzle. It marks them with a small line over the number on the screen. Those marks are even saved when saving and reloading your game.

If I get any more ideas, I'll implement them, else I think I'm pretty much finished with this project. Now down to 2104 bytes. I plan to make my final release as a halloween present to you all, so check back here on the 31st ;)wink.gif
Title: Patz Calculator Sudoku
Post by: Ranman on October 25, 2007, 01:04:00 pm
QuoteBegin-patz2009+24 Oct, 2007, 17:54-->
QUOTE (patz2009 @ 24 Oct, 2007, 17:54)
I'm not entirely "generating" the sudokus per-se, but more like scrambling it.  

 Now that is a pretty clever idea!   ;)wink.gif


How do you adjust the difficulty level? :???:confus.gif
Title: Patz Calculator Sudoku
Post by: patz2009 on October 25, 2007, 02:21:00 pm
If you look at the above code, you can see its blanking routine. D is the variable I have set aside for the puzzle's difficulty. It removes more blocks as the difficulty increases.

26 for Simple, 34 for Easy, 42 for Medium, 50 for Hard, and 58 for Suicidal.

Edit: Oh, and if you meant how to adjust the difficulty level in the game, go to difficulty on the main menu and press 2nd or Enter. ;)wink.gif
Title: Patz Calculator Sudoku
Post by: Liazon on October 25, 2007, 04:28:00 pm
interestingly, mathematicians say that 17 is the smallest # of known squares for a solvable single solution sudoku.

duno how they proved that, and duno if that means every 17 # sudoku is solvable.

Title: Patz Calculator Sudoku
Post by: burr on October 25, 2007, 05:28:00 pm
You don't need to store C to a variable; Ans can be used instead.
c1-->
CODE
ec1:For(A,1,26+8D
:Repeat (B,Ans
:randInt(1,9→B
:randInt(1,9
:End
:0→(B,Ans
:Endc2
ec2
However, if you use the randInt(1,9 statement elsewhere in your program, you can store it to one of the graphing variables (such as u or v) and then use that instead.
c1
-->
CODE
ec1:"randInt(1,9→u
:For(A,1,26+8D
:Repeat (B,Ans
:u→B:u
:End
:0→(B,Ans
:Endc2
ec2
Title: Patz Calculator Sudoku
Post by: patz2009 on October 26, 2007, 06:40:00 pm
QuoteBegin-Liazon+25 Oct, 2007, 22:28-->
QUOTE (Liazon @ 25 Oct, 2007, 22:28)
interestingly, mathematicians say that 17 is the smallest # of known squares for a solvable single solution sudoku.

duno how they proved that, and duno if that means every 17 # sudoku is solvable.  

 Solve this sudoku:

c1
-->
CODE
ec11 2 3 | 0 0 0 | 0 0 0
4 5 6 | 0 0 0 | 0 0 0
7 8 9 | 0 0 0 | 0 0 0
------+-------+------
3 1 2 | 0 0 0 | 0 0 0
5 6 4 | 0 0 0 | 0 0 0
9 0 0 | 0 0 0 | 0 0 0
------+-------+------
0 0 0 | 0 0 0 | 0 0 0
0 0 0 | 0 0 0 | 0 0 0
0 0 0 | 0 0 0 | 0 0 0c2
ec2
;)wink.gif


burr, that's about the only place I use randInt(1,9 , but that is a nice hint for future reference :)smile.gif And, I will definately put in your optimization into the program :)smile.gif
Title: Patz Calculator Sudoku
Post by: Liazon on October 27, 2007, 10:40:00 am
lol i think there might be multiple solutions, but that's ok ^^

ya, clearly you're rotating blocks too.  what optimization do you mean?
Title: Patz Calculator Sudoku
Post by: patz2009 on October 28, 2007, 11:40:00 am
OK, should I include wrapping during gameplay (already exists on the main menu) or should I not bother and keep the program smaller? I would estimate that adding it would take about 30 bytes (not just for the code itself, but some for fixing referencing to matrices, etc)


Edit: I have 2 versions made, one with the wrapping, costing 2127 bytes, or one without the wrapping costing 2103 bytes. Which one do I release as the official version? ;)wink.gif
Title: Patz Calculator Sudoku
Post by: DJ Omnimaga on October 28, 2007, 04:33:00 pm
first one, it isn't really that big anyway ;)wink.gif
Title: Patz Calculator Sudoku
Post by: Liazon on October 29, 2007, 11:37:00 am
wrapping what?

and I agree w/ Kevin, it's not too big
Title: Patz Calculator Sudoku
Post by: patz2009 on October 30, 2007, 01:42:00 pm
QuoteBegin-Liazon+29 Oct, 2007, 16:37-->
QUOTE (Liazon @ 29 Oct, 2007, 16:37)
wrapping what?

and I agree w/ Kevin, it's not too big  

 Wrapping on the sudoku during game play. When you press right when it's on the other side of the screen, it will go to the left, etc.

Oh, and the old version got destroyed (RAM cleared.) so I might have to refix it up. I still promise to release it though ;)wink.gif
Title: Patz Calculator Sudoku
Post by: DJ Omnimaga on October 30, 2007, 02:33:00 pm
o.oblink.gif sroy to hear :(sad.gif ram clear sucks during projects :/confused.gif
Title: Patz Calculator Sudoku
Post by: Liazon on October 31, 2007, 02:39:00 pm
at least the new version w/ wrapping is okay right?
Title: Patz Calculator Sudoku
Post by: patz2009 on November 07, 2007, 01:53:00 pm
http://patrickc.phatcode.net/calc/pcsudoku_v230.zip

Enjoy :)smile.gif
Title: Patz Calculator Sudoku
Post by: DJ Omnimaga on November 07, 2007, 03:40:00 pm
cool I will try it asap!