The Museum of HP Calculators

HP Forum Archive 21

[ Return to Index | Top of Index ]

Sudoku 50G
Message #1 Posted by Gilles Carpentier on 12 May 2012, 7:35 a.m.

The topic "Sudoku solver" of Marcel Samek for the 33S & 15C ( bravo !), gave me the idea to see what is possible with a 50G

I found this program which seems perfect :

Sudoku solver HP50G

But it does not work with my calc. SLV result in nothing on the stack in place of the solution.

Is this a problem of ROM version or other ?

      
Re: Sudoku 50G
Message #2 Posted by Raymond Del Tondo on 12 May 2012, 9:18 a.m.,
in response to message #1 by Gilles Carpentier

And of course there exists a Sudoku solver for the HP-48: SDK48 :-)

Very fast, solves nearly every solvable 9x9 sudoku within a few seconds, only 3.5KiB in size, will run on SX, too.

            
Re: Sudoku 50G
Message #3 Posted by Oliver Unter Ecker on 15 May 2012, 3:29 a.m.,
in response to message #2 by Raymond Del Tondo

Quote:
only 3.5KiB in size

For your entertainment, here's a 77-byte Sudoku solver in GolfScript:

{9/[n]*puts}:p;~]{:@0?:^~!{@p}*10,@9/^9/=-@^9%>9%-@3/^9%3/>3%3/^27/={+}*-{@^<\+@1^+>+}/1}do

http://www.golfscript.com/golfscript/examples.html
(note the comment claiming "lots of room for improvement")

Edited: 15 May 2012, 3:32 a.m.

      
Re: Sudoku 50G
Message #4 Posted by David Hayden on 12 May 2012, 9:29 a.m.,
in response to message #1 by Gilles Carpentier

Hi Gilles.

I'm the author of the program. I just downloaded it again to make sure I can still run it. I'm using ROM 2.15.

Does it run if you use one of the provided puzzles? For excample, if you press EASY and then SLV?

How exactly are you running it?

Dave

            
Re: Sudoku 50G
Message #5 Posted by Gilles Carpentier on 12 May 2012, 10:59 a.m.,
in response to message #4 by David Hayden

Hi David

I tried with emu48, 2.09 ROM version

- I clic for example EASY
- The matrice is on the stack
- I clic SLV

-> I get no result at all (the initial matrice is dropped but no result appears)

I will try on my real calc 2.15

EDIT :it works fine with my real HP50G ROM 2.15 :D Less than 0.1 sec

Re-EDIT : LOL I just realise I'm stupid, it s an ARM prog so can't work with EMU48 !

Edited: 12 May 2012, 11:17 a.m.

                  
Re: Sudoku 50G
Message #6 Posted by David Hayden on 12 May 2012, 3:52 p.m.,
in response to message #5 by Gilles Carpentier

Yes, the program is written in C and C++ and runs directly on the ARM CPU. I'm biased of course, but I think it demonstrates several things:

  • The raw speed of the ARM processor and the potential for very fast programs on the 50g.
  • The HPGCC compiler.
  • C++ with HPGCC.
  • The HPObjects library that lets C programs read and write calculator objects.
  • The sudoku solving algorithms are written to be fast, but also clear. The program demonstrates bit manipulations, a fast algorithm for counting the bits in a word, recursion and several other programming concepts. Source code is included.
Dave

                        
Re: Sudoku 50G
Message #7 Posted by Gilles Carpentier on 13 May 2012, 6:32 a.m.,
in response to message #6 by David Hayden

Very interesting !

The speed is really impressive


[ Return to Index | Top of Index ]

Go back to the main exhibit hall