Join us on Discord!
You can help CodeWalrus stay online by donating here.

Pyramid 89

Started by Ranman, November 11, 2017, 03:46:28 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Ranman

Last week I dusted off one of my old projects that I created for one of my graduate courses that I never submitted.

The game is called Pyramid Solitaire. It is a simple fast paced solitaire game. See attached screenies.

Edit... This is another game that I thought I had lost back when my hard drive crashed and lost my backup. So... I have to make a few tweaks and rewrite the readme file (since it was not on my backup drive). Then i'll get it released too.

The object of the game is to remove all cards from the pyramid by matching 2 cards that add up to a value of 13 (kings are 13 all by themselves). You get to cycle through the deal pile a limited number of times to assist with finding cards.

Edit #2: Attached pyramid89.zip.
  • Calculators owned: TI-89 HW1, TI-92+, Casio 9860G Slim, Casio fx6300, Tandy PC7
Ranman
Bringing Randy Glover's Jumpman to the TI-89 calculator. Download available at Ticalc.

Dream of Omnimaga

This looks very good Ranman. Glad to see you found another of your old projects again. I myself thought I had lost some back in the days, only to find them out on a DVD-R half a decade later.
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

Lionel Debroux

Looks good indeed, another good find on your formerly lost backup drive :)
Member of the TI-Chess Team.
Co-maintainer of GCC4TI (GCC4TI online documentation), TIEmu and TILP.
Co-admin of TI-Planet.

Ranman

Quote from: xlibman on November 13, 2017, 07:05:37 PM
This looks very good Ranman. Glad to see you found another of your old projects again. I myself thought I had lost some back in the days, only to find them out on a DVD-R half a decade later.

Quote from: Lionel Debroux
Looks good indeed, another good find on your formerly lost backup drive :)

Thanks guys!!
  • Calculators owned: TI-89 HW1, TI-92+, Casio 9860G Slim, Casio fx6300, Tandy PC7
Ranman
Bringing Randy Glover's Jumpman to the TI-89 calculator. Download available at Ticalc.

Ranman

#4
Pyramid Solitaire was uploaded to Ticalc today.  :w00t:

Edit: attachment moved to first post.
  • Calculators owned: TI-89 HW1, TI-92+, Casio 9860G Slim, Casio fx6300, Tandy PC7
Ranman
Bringing Randy Glover's Jumpman to the TI-89 calculator. Download available at Ticalc.

Dream of Omnimaga

Good to see it released! You should put the link in the first post if not done already. :)
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

Lionel Debroux

#6
Several suggestions about the code:
  • the ZIP file is incomplete ;)
    The three missing assembly files can be found in the Jumpman ZIP (and should be using the versions for which I suggested optimizations in the other thread, I haven't downloaded the latest Jumpman version to check).
  • conversely, the Pyramid Solitaire ZIP might be cleaned up, as some functions don't seem to be used;
  • in TimeUtils.c, Sleep(): the "/ 2.65" causes a conversion to float, a floating-point division, and a conversion back to integer. "* 100 / 265" is more efficient size-wise (that's what matters) and speed-wise;
  • in pyramid.c:
    • I noticed that depending on how the linker reorders section, the call to SetUserFont(intvfont - 32 * 8, ...) (clever way to save space, I like it in general :) ) can end up producing a reference to outside the program's space, and the linker produces an error in such a case. As long as you don't hit the issue, it doesn't matter much.
    • careful ordering of the functions in pyramid.c (I can provide you the file if you're interested) makes it possible to declare the functions "static", which avoids the need to use prototype declarations at the beginning, and most of all, opens the set of functions to inlining - usually beneficial to code size for functions called only once, or trivial functions such as ResetAutoQuit();
    • in MoveCursor(), you're using floats for the usual Pythagorean distance computation; isn't there a way you could use squared distances, avoiding sqrt and floats altogether ? ;)
    • is there a way to reach value == 26 in CheckSelection() ? Normally, kings are selected as single cards. The point is, if value == 26 can't occur, then you can use value == 13 instead of (value % 13) == 0... avoiding a division and opening the function to inlining.
Member of the TI-Chess Team.
Co-maintainer of GCC4TI (GCC4TI online documentation), TIEmu and TILP.
Co-admin of TI-Planet.

Powered by EzPortal