Post Reply 
Solitaire - Baker's Game
01-09-2014, 08:58 PM (This post was last modified: 02-12-2018 10:22 PM by Mark Power.)
Post: #1
Solitaire - Baker's Game
My first serious program for the HP Prime is now available to download from:

http://www.hpcc.org/programs/hpprime/sol..._v1.29.txt or http://www.hpcc.org/programs/hpprime/sol....29.hpprgm

Load it onto the calculator either by pasting the source (.txt) into the connectivity kit or putting the hpprgm version into the correct directory and then running the connectivity kit.

If you are not familiar with the game, press the Help button for instructions.

There is a known bug with the program: after playing the game the calculator may turn itself off when you exit - possibly a firmware issue.

[Image: SOL_BG_0.png][Image: SOL_BG_1.png][Image: SOL_BG_2.png]
Find all posts by this user
Quote this message in a reply
02-03-2014, 09:41 PM
Post: #2
RE: Solitaire - Baker's Game
Hi Mark, this is indeed an impressive piece of code, probably the longest one I've seen so far. Also I like the use of fonts do draw cards. Now I'm a bit surprised that you didn't get any comment so far, may be because (like me) we didn't understand how to play the game? I saw the help key but this didn't actually help me. Any chance to get a little bit more information?
Another question is about the editor you used to write this code. I myself use ":=" for assignments because I don't know how to enter the black arrow with a normal keyboard. How did you do that?
Thanks
Find all posts by this user
Quote this message in a reply
02-04-2014, 02:17 PM
Post: #3
RE: Solitaire - Baker's Game
(02-03-2014 09:41 PM)Tugdual Wrote:  Now I'm a bit surprised that you didn't get any comment so far, may be because (like me) we didn't understand how to play the game? I saw the help key but this didn't actually help me. Any chance to get a little bit more information?

I guess I should have commented as I loaded the game and play from time to time as a diversion. So, nice work Mark! If I could ask for additional features, the main one would be the ability to pause and restart a game.

As for how to play, it took me a bit of fiddling and internet searching to figure out how. Let’s define the board as follows. The top row consists of eight spots, labeled A-A-A-A-R-R-R-R when the game starts. The main playing board, as I will call it, starts with the cards arranged in eight columns, four with seven cards and four with 6 cards, totaling the customary 52 cards. The four spots on the top left, labeled A, will hold suits built up starting with the aces. So you must uncover the aces on the main board, place them in those spots, then build up each stack. Only an ace (of any suit) can be moved to an empty A-cell. Then only a 2 of hearts may be moved to an A cell holding the ace of hearts, etc.

The four spots on the upper right, labeled R can hold a single card. Any card may be moved to one of these spots provided it is open. A card in one of these spots may them be moved in one of three ways:
1. to the proper suit stack to the left, assuming the card next lowest in value of the suit is on top of one of those stacks.
2. back to the main playing board, below the card of the next higher value of that suit if and only if that card is at the bottom of one of the strings of cards.
3. to the top position of one of the card string columns, if all other cards have been cleared from that string.

As for the eight card strings on the main playing board, only the bottom card of each may be moved, to one of four possible locations:
1. to the proper suit stack on the upper left, assuming the card next lowest in value of its suit is on top of one of those stacks.
2. to one of the four holding spots on the upper right, assuming one is open.
3. to another of the card strings on the main playing board below the card of the next higher value of that suit if and only if that card is at the bottom of one of those strings
4. to the top position of one of the card string columns, if all other cards have been cleared from that string.

To move a card, tap it, which will invert its colors, then tap the position you want it to go. Only legal moves are allowed. A card which may be legally moved to one of the suit stacks may be double-tapped to move it there automatically. If you get stuck, you may press the 4 key (which has the alpha “U” for “undo”) to undo the previous move. You can only back-up so far, however, so if you made a strategy error early on, you may be stuck with it.

The above may not be the best description of how to play, but I hope it is clear enough to get you started. In figuring out how to play, I found some information at some source, maybe Wikipedia, that supposedly 70% of the possible deals in this game are solvable. I find that a little depressing, as my success rate is much, much lower, perhaps 10%.

Dave - My mind is going - I can feel it.
Find all posts by this user
Quote this message in a reply
02-04-2014, 09:39 PM
Post: #4
RE: Solitaire - Baker's Game
I am guessing those of us that don't know how to play are most likely not "managers" as I am guessing nearly all of them have a perfect understanding of the rules... :-)

TW

Although I work for the HP calculator group, the views and opinions I post here are my own.
Find all posts by this user
Quote this message in a reply
02-04-2014, 09:55 PM (This post was last modified: 02-04-2014 09:55 PM by Tugdual.)
Post: #5
RE: Solitaire - Baker's Game
Hi Jeff, thank you for the long description this really helped me. I knew different rules and was used to alternate colors on suits while here you just need to have the cards same color same kind in sequence. Also the top row was a bit mysterious...
Again thanks for taking the time to write the long explanation.

Tim, according to your standard I'm a totally crappy manager ;-)
Find all posts by this user
Quote this message in a reply
02-04-2014, 10:14 PM
Post: #6
RE: Solitaire - Baker's Game
Nope, if you don't know I highly think you are probably quite good! :-D

TW

Although I work for the HP calculator group, the views and opinions I post here are my own.
Find all posts by this user
Quote this message in a reply
02-05-2014, 09:02 PM
Post: #7
RE: Solitaire - Baker's Game
Thank you everyone for your comments.

Hi Tugdual, I apologies for the somewhat brief help text but Jeff O. has done a great job to explaining the rules in more detail. Having played a similar version of the game on another platform I was too familiar with the game to explain it well on the first attempt. I'll try and expand the help to make it easier to understand.

Regarding the editor I used: the whole program was entered directly on the HP Prime itself. The arrow is the STO symbol (press the blue Shift key then the EEX key). I don't own a PC and had to borrow one to upload it to the net! I have managed to get a Raspberry Pi to run libhpcalcs since so I do now have a way of getting code off the Prime albeit in a somewhat convoluted way. Roll on Mac connectivity that's what I say.

Hi Jeff O., pause and resume sounds a great idea. When I get some time I'll add that for you. It should be pretty easy.

I also thought about adding a sample game that can be easily played to get the hang of it. Until I get around to that my recommendation is to use the Menu key and Deal again until you have some Aces near the bottom of the main deck and few of the low numbers near the top.

If you like playing in the code, make a copy of the program then

1) go into the SOL_BG function and comment out the line Shuffle()->deck;
2) un-comment the line REVERSE(NewDeck())->deck;
3) Start the game and press the A (for Auto) key.
4) Sit back and watch the game play itself.

I wrote this as an education for me, to show what the calculator can do and for other people to look at the code. Unfortunately typing the code direct into the calculator is quite tedious so I ended up barely commenting the code. I do have quite a few paper notes that I may turn into comments in the code to explain the outline, but it will end up making the code pretty big. I should also get rid of all the magic numbers lying about the code now I see from other people's code that constants can be put in without filling up the variable menu. It's currently not a great example of self-documenting code.

If Tim can suggest why the calculator sometimes turns off when the game ends, that would be great ;-)
Find all posts by this user
Quote this message in a reply
02-06-2014, 06:38 AM
Post: #8
RE: Solitaire - Baker's Game
Really awesome work! but this game is really hard for beginners Smile and I think the Windows version (freecell?) was a bit more permissive about the stacking

My website: erwin.ried.cl
Visit this user's website Find all posts by this user
Quote this message in a reply
02-07-2014, 07:37 AM
Post: #9
RE: Solitaire - Baker's Game
Quote:I have managed to get a Raspberry Pi to run libhpcalcs
This is part of what libhpcalcs is about: a portable, interoperable, lightweight code base without exotic dependencies, aimed at being a building block for TUIs and GUIs Smile
TI-Nspire calculators under Linux should be able to run libhpcalcs just fine, despite them having (even) much lower CPU power and amount of RAM than a RPi. Likewise for Prime calculators once somebody finds time to port a Linux launcher + Linux itself to the Prime (Linux already has good S3C2416 support), and replaces armfir.elf into the firmware upgrade with the Linux launcher.

Quote:Unfortunately typing the code direct into the calculator is quite tedious so I ended up barely commenting the code.
.hpprgm files are simple UTF-16LE strings without a BOM, which means that many computer-side text editors can produce .hpprgm files Smile
Some of those editors automatically add a BOM, and libhpcalcs automatically strips it for convenience.
Find all posts by this user
Quote this message in a reply
03-11-2014, 09:58 PM
Post: #10
RE: Solitaire - Baker's Game
v1.26 is available for download at the same URL and now automatically saves the state of the game. If you come out of the game either by pressing the "On" button or pressing "Menu" then "Quit", when you go back into the game it will continue where you left off.

If you want don't want to continue a game press "Menu" button and then "Deal".

When I get some more time I'll refine the Help screen with more details.
Find all posts by this user
Quote this message in a reply
03-12-2014, 01:40 PM
Post: #11
RE: Solitaire - Baker's Game
(03-11-2014 09:58 PM)Mark Power Wrote:  v1.26 is available for download at the same URL and now automatically saves the state of the game.....

Thanks!

Dave - My mind is going - I can feel it.
Find all posts by this user
Quote this message in a reply
06-10-2014, 07:35 PM
Post: #12
RE: Solitaire - Baker's Game
v1.27 is available for download at the same URL and attached to this thread. This version is compatible with ROM 6030.


Attached File(s)
.zip  SOL_BG.zip (Size: 7.56 KB / Downloads: 12)
Find all posts by this user
Quote this message in a reply
03-15-2015, 07:22 PM
Post: #13
RE: Solitaire - Baker's Game
v1.28 is available for download at the same URL and is attached to this thread. This version is compatible with ROM 6975, and adds the ability to choose difficulty.

From the Menu, when you perform a new Deal or use Again to re-play the current deal you can pick Easy, Medium or Hard by touching the button on the screen.

Hard is the same as before: when moving cards in the main deck you have to move them in sequence and only onto cards of the same suit.

Medium allows cards in the main deck to be placed in sequence on cards of the same colour.

Easy allows cards in the main deck to be placed in sequence on cards of any suit.

In all difficulties you must still build up cards in sequence and in the same suit in the destination piles in the top left corner.

[Image: SOL_BG_4.png][Image: SOL_BG_5.png]


Attached File(s)
.zip  SOL_BG.zip (Size: 7.82 KB / Downloads: 24)
Find all posts by this user
Quote this message in a reply
02-12-2018, 10:24 PM
Post: #14
RE: Solitaire - Baker's Game
v1.29 is now available. It fixes the issue with firmware 13333 causing DIMGROB to fail. This version should be compatible with older versions of firmware (from 6975 onwards), in case you have not yet upgraded to 13333. Please download it using the links at the top of this thread.
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)