Author Topic: Sudoku  (Read 10650 times)

0 Members and 2 Guests are viewing this topic.

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Sudoku
« Reply #15 on: October 04, 2010, 09:26:24 pm »
Heh glad i could be of help :D That was a mighty fun post to write :)

Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: Sudoku
« Reply #16 on: October 06, 2010, 05:41:13 pm »
Challenge:
I've decided to attempt the unadvised:  Rotating strings.  The challenge is who can come up the the smallest and fastest routine in basic that turns this:
Quote
":
111111111
222222222
333333333
444444444
555555555
666666666
777777777
888888888
999999999
:"  (line breaks added for clarity)
into this:
Quote
":
987654321
987654321
987654321
987654321
987654321
987654321
987654321
987654321
987654321
:"  (line breaks added again for clarity)

I will have a solution as well, but I want to see what you guys come up with. ;D  Good luck! :D

Offline nemo

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1203
  • Rating: +95/-11
    • View Profile
Re: Sudoku
« Reply #17 on: October 06, 2010, 06:16:27 pm »
assuming the string is in Str1...

Code: [Select]
"   .one space
For(Z,-8,0
For(Y,9,1,-1
Ans+sub(Str1,9Y+Z,1
End:End
sub(Ans,2,81

i'd assume this is the way to go about it, but i'm looking up string commands on tibasic dev to see if there's a simpler way as i post this. i think this is the smallest... fastest is a different challenge.

Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Re: Sudoku
« Reply #18 on: October 06, 2010, 06:19:58 pm »
Sounds like a UTI challenge problem :P

I'll see what I can come up with, though I bet Builder, nemo, or you will probably get it.

Edit:
See :P
« Last Edit: October 06, 2010, 06:20:14 pm by meishe91 »
Spoiler For Spoiler:



For the 51st time, that is not my card! (Magic Joke)

Offline nemo

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1203
  • Rating: +95/-11
    • View Profile
Re: Sudoku
« Reply #19 on: October 06, 2010, 06:21:54 pm »
would it be ok if the string rotated the other way?
 rather than:
Quote
111111111
222222222
333333333
444444444
555555555
666666666
777777777
888888888
999999999
becoming
Quote
987654321
987654321
987654321
987654321
987654321
987654321
987654321
987654321
987654321
can it be


Quote
123456789
123456789
123456789
123456789
123456789
123456789
123456789
123456789
123456789


Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Sudoku
« Reply #20 on: October 06, 2010, 06:33:33 pm »
Yikes x.x string rotating?  Hurmm i will have to puzzle over this, but currently i cant see any way better than Nemo's.  Switching to strings for memory reasons i assume?

Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: Sudoku
« Reply #21 on: October 06, 2010, 07:14:14 pm »
Nemo, they can be flipped either way; I don't care. ;D
Thanks for that. :) I still have to come up with a routine of my own... 
Let's see how fast someone can make it! ^-^

Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Re: Sudoku
« Reply #22 on: October 06, 2010, 07:18:16 pm »
Does the routine have to actually flip it or is it for a display routine? Because if it just has to be rotated when displayed then I could look at my routines from my spriter.
Spoiler For Spoiler:



For the 51st time, that is not my card! (Magic Joke)

Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: Sudoku
« Reply #23 on: October 06, 2010, 07:20:06 pm »
It must be actually flipped. ;)

Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Re: Sudoku
« Reply #24 on: October 06, 2010, 07:20:48 pm »
Dang, that means I actually have to experiment :P
Spoiler For Spoiler:



For the 51st time, that is not my card! (Magic Joke)

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Sudoku
« Reply #25 on: October 06, 2010, 07:28:28 pm »
So are you using Strings for memory reasons?

Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: Sudoku
« Reply #26 on: October 06, 2010, 07:29:55 pm »
Nah, it's for speed...
At least that's the plan.  I'll write both versions and then decide the one I like better. :)  Strings are much more flexible, though, and I like them better. ;D
« Last Edit: October 06, 2010, 07:30:04 pm by ztrumpet »

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Sudoku
« Reply #27 on: October 06, 2010, 07:32:54 pm »
Speed really? o.O But Matrices have a built in command for all the things you need silly :P

Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Re: Sudoku
« Reply #28 on: October 06, 2010, 07:36:48 pm »
Would it be possible to store with strings and then put the chosen puzzle into a matrix and then use the built-in commands?
Spoiler For Spoiler:



For the 51st time, that is not my card! (Magic Joke)

Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: Sudoku
« Reply #29 on: October 06, 2010, 07:39:04 pm »
Would it be possible to store with strings and then put the chosen puzzle into a matrix and then use the built-in commands?
Yes, and that's what I'll do if I use matrices.  However, I wanted to try strings too. ;D