HP Forums

Full Version: Sokoban game for HP Prime
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Very, very, very nice!!!!!!
In a few days i return with a long reply Wink
Glad to see you again Big Grin
Hi Ariel,
Hope exams are doing well.

Tell me if you have problems compressing levels, I can help.

I find the program more agreeable to play with keyboard rather than with touch screen.
Hello Patrice!
I'm still on it. I must pass some more.


As to Sokoban, I can not get in this time. I have several projects "abandoned", at least for a couple of months. Please feel free to change anything you want, and also put your name in the "credits" Wink

Thank you very much!
Hi Ariel,
Here are my changes:
Levels are compressed with RLE: saves 40K for 40 levels
removed duplicated code for moves: save about 20K
added keyboard moves
Fine!
Thanks for taking the work to improve the game.

In the afternoon I'll try.

If I remember correctly, the code that you just passed me to move the "pusher" failed in some situations. I do not comment at the time, but I remember not included in my code for that.

I'll play and you commented.

Thank you again!
(03-10-2014 10:44 AM)ArielPalazzesi Wrote: [ -> ]If I remember correctly, the code that you just passed me to move the "pusher" failed in some situations. I do not comment at the time, but I remember not included in my code for that.
If I remember, the problem was in my event handling, this should be OK now.

Edit: by the way the 3 functions at the end are to RLE encode the levels. the last one is EXPORTed.
I have 1 more change to allow Esc to abort the game.

Code:
          IF TYPE(Ky) == 0 THEN
            IF Ky == 2 THEN DY:=-1; DX:=0; END;
            IF Ky == 7 THEN DY:=0; DX:=-1; END;
            IF Ky == 8 THEN DY:=0; DX:=1; END;
            IF Ky ==12 THEN DY:=1; DX:=0; END;
            IF Ky ==4 THEN abortgame(); END;
          END;
Hi Ariel,
After the last review of your code, I have an advice for you.
When programming big pieces of code it is usually easier to put only one functionality in a subroutine, and only the top level routines put together every thing.
Example in loadsubnivel(), it is called only once by the top level routine. Making it only loading the level and nothing else make it easier to remember and to change. drawscreen() have some side effects that complicate changes.
Code:
    IF GAMEOVER == 0 THEN
      loadsubnivel();
      drawscreen();
      RECT_P(G0,20,223,300,238,#000000,#FFFFFF);
      TEXTOUT_P("LEVEL: "+NIVEL+"-"+SUBNIVEL+"  MOVES:           PUSHES:        ",25,224);
      FINAL := 0; MOVI  := 0;PUSH  := 0;
a code like that with a loadsubnivel() only loading the level is considered easier to understand and to change.
Hello!
Thank you very much for the council!
All these "tips" are useful for programming me and help me to program better. I'm (obviously) an amateur, and thanks to people eager to help (like you) is that I learn a little more each day.

Excellent job!

Greetings.
Update for Rev 6030
This version is only taking advantage of new features of rev 6030
the pragma ensure that the program will compile.
your number format setting will not mess the display.
the .prime file is the source code in text
Sorry to bump such an old thread, but I found an error in the third level.

First of all; I love Sokoban and this version for the HP Prime. I have enjoyed a lot of time pushes the boxes around and solving the puzzles!

After trying to solve level 3 (beginner) I was almost driven to madness, so I put it into a Sokoban solver and it couldn't be solved with A* or Dijkstra algorithm. The problematic game is this:

Code:
+ + + + + + + + + + + + + + + +
+ - - - - - - - - - - - - - - +
+ - - @ - @ - @ - @ - @ - @ - +
+ - + - + + + + + + + + - + + +
+ - + - - @ - @ - + X X X X X +
+ - + * @ - @ - @ - X - - - X +
+ - + @ - @ - @ - + X - X - X +
+ - - - @ - @ - @ - X - - - X +
+ - + - - - - - - + X X X X X +
+ + + + + + + + + + + + + + + +
+: wall
*: player
-: empty
@: box
X: goal

If someone knows the solution, please help me out ;-) And for the author; maybe you can resolve the issue so that the level can be solved. Ofcourse only if you still support the game.
As it has been 2.5 years since Patrice has logged-in, suggest you send him an email or PM to ask if he's still involved, otherwise it might be a very long wait before you get a reply.
(03-04-2024 11:01 PM)rprosperi Wrote: [ -> ]As it has been 2.5 years since Patrice has logged-in, suggest you send him an email or PM to ask if he's still involved, otherwise it might be a very long wait before you get a reply.

You're definitely right about that. I should have thought a bit longer about it =)
Pages: 1 2
Reference URL's