Author Topic: Patz Calculator Sudoku  (Read 4756 times)

0 Members and 1 Guest are viewing this topic.

patz2009

  • Guest
Patz Calculator Sudoku
« 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:
  • Speed optimized
  • Size optimized (under 2.2k on calc!)
  • Use of only 7 reals!
  • Fully random sudokus
  • Puzzle numbers
  • Game saving/loading
  • Graphical menus
  • Hint system
  • 5 levels of difficulty: simple, easy, medium, hard, and suicidal.
  • GPL v2 licensed
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

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Patz Calculator Sudoku
« Reply #1 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?
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)

patz2009

  • Guest
Patz Calculator Sudoku
« Reply #2 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)

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Patz Calculator Sudoku
« Reply #3 on: October 23, 2007, 05:15:00 pm »
sounds good, not too long, I may give it a try at one point :)smile.gif
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)

Offline Ranman

  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1354
  • Rating: +83/-0
    • View Profile
Patz Calculator Sudoku
« Reply #4 on: October 23, 2007, 05:16:00 pm »
I really like Sudoku!

This game is laid out very nicely! Awesome job! :thumbup:google.gif
Ranman
Bringing Randy Glover's Jumpman to the TI-89 calculator. Download available at Ticalc.

Liazon

  • Guest
Patz Calculator Sudoku
« Reply #5 on: October 24, 2007, 10:45:00 am »
cool!

how're you generating the sudokus?

patz2009

  • Guest
Patz Calculator Sudoku
« Reply #6 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

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Patz Calculator Sudoku
« Reply #7 on: October 24, 2007, 03:13:00 pm »
do you have an idea of how many combinatiuon possible there is?
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)

Offline JonimusPrime

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 389
  • Rating: +25/-5
    • View Profile
    • Jonimoose.net
Patz Calculator Sudoku
« Reply #8 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.

"Always code as if the person who will maintain your code is a maniac serial killer that knows where you live" -Unknown

"If you've done something right no one will know that you've done anything at all" -Futurama

"Have a nice day, or not, the choice is yours." Tom Steiner

Liazon

  • Guest
Patz Calculator Sudoku
« Reply #9 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?

patz2009

  • Guest
Patz Calculator Sudoku
« Reply #10 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

Offline Ranman

  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1354
  • Rating: +83/-0
    • View Profile
Patz Calculator Sudoku
« Reply #11 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
Ranman
Bringing Randy Glover's Jumpman to the TI-89 calculator. Download available at Ticalc.

patz2009

  • Guest
Patz Calculator Sudoku
« Reply #12 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

Liazon

  • Guest
Patz Calculator Sudoku
« Reply #13 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.


burr

  • Guest
Patz Calculator Sudoku
« Reply #14 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