Author Topic: TETRIS for the HP Prime!  (Read 12437 times)

0 Members and 2 Guests are viewing this topic.

Offline iconmaster

  • LV3 Member (Next: 100)
  • ***
  • Posts: 82
  • Rating: +5/-0
    • View Profile
TETRIS for the HP Prime!
« on: April 04, 2014, 03:59:57 pm »
HP TETRIS!

I've recently updated my HP firmware, and suddenly I can program games in it! My first project is Tetris.

Screenshots:



Features:

  • Classic Tetris gameplay
  • Acurite piece rotation
  • Both soft-drop and hard-drop keys
  • Adjustable difficulty level
  • Original Tetris scoring rules
  • High-score tables - challenge your friends!

Download:

Get this program here!

Future Plans:

  • Placement guides
  • Showing the next piece
  • Better graphics

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: TETRIS for the HP Prime!
« Reply #1 on: April 04, 2014, 05:15:25 pm »
Wow, this Tetris clone looks very cool actually! I saw the original clone by Patrice which was the first ever, but this one has better graphics. I'll give it a try at one point. It has been several months since an HP Prime game was released (especially here). Good job :)


EDIT: I dunno if that's a bug, but for me the entire game has inverted colors O.O (I don't know for the pieces, though. Just everything else is inverted, such as white background and black text)
« Last Edit: April 04, 2014, 10:43:21 pm by DJ Omnimaga »

Offline iconmaster

  • LV3 Member (Next: 100)
  • ***
  • Posts: 82
  • Rating: +5/-0
    • View Profile
Re: TETRIS for the HP Prime!
« Reply #2 on: April 05, 2014, 07:55:36 am »

EDIT: I dunno if that's a bug, but for me the entire game has inverted colors O.O (I don't know for the pieces, though. Just everything else is inverted, such as white background and black text)
Hahaha, no, you're just playing it with a light color scheme on. Myself, I'm a fan of Dark, so I took the screenshots in that mode.

Offline TIfanx1999

  • ಠ_ಠ ( ͡° ͜ʖ ͡°)
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 6173
  • Rating: +191/-9
    • View Profile
Re: TETRIS for the HP Prime!
« Reply #3 on: April 05, 2014, 08:31:40 am »
Looks nice! I'll have to give it a go when I have some time as well. :D

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: TETRIS for the HP Prime!
« Reply #4 on: April 05, 2014, 12:14:53 pm »

EDIT: I dunno if that's a bug, but for me the entire game has inverted colors O.O (I don't know for the pieces, though. Just everything else is inverted, such as white background and black text)
Hahaha, no, you're just playing it with a light color scheme on. Myself, I'm a fan of Dark, so I took the screenshots in that mode.
oh ok, i didn't know it was dependent on theme settings. Do you think you could make it independent and have color options in the game?

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: TETRIS for the HP Prime!
« Reply #5 on: April 10, 2014, 03:37:34 am »
Small bug report aside from the theme dependency issue: There's no level start limit, so to rack up your highscore, all you have to do is set starting level to 9E99 or something then do 1 line. Past level 9 the speed won't get that much faster so that isn't super hard to do 1 line.

That and highscores get wiped out if I accidentally open the code, but that's more an HP Prime bug (or annoying feature) than a game issue.
« Last Edit: April 10, 2014, 03:42:18 am by DJ Omnimaga »

Offline iconmaster

  • LV3 Member (Next: 100)
  • ***
  • Posts: 82
  • Rating: +5/-0
    • View Profile
Re: TETRIS for the HP Prime!
« Reply #6 on: April 10, 2014, 03:53:28 pm »
That and highscores get wiped out if I accidentally open the code, but that's more an HP Prime bug (or annoying feature) than a game issue.

Myself, I tied my Tetris to a user-key so I never have to risk going into the program menu for it. Another solution on my end is to have a separate program that just holds variables (luckily, we can reference variables from other programs), so changing the code doesn't do that.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: TETRIS for the HP Prime!
« Reply #7 on: April 11, 2014, 11:36:41 pm »
Yeah the issue on my end is that on TI and Casio calcs, to run programs you press ENTER, so when I am on the HP Prime I keep that habit. I prefer the separate program idea actually. At least if you press ENTER it will just open the small program that just launches the main game. It clutters the program list but I guess it's better than nothing.

Offline bb010g

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 428
  • Rating: +22/-1
  • I do stuff
    • View Profile
    • elsewhere on the net
Re: TETRIS for the HP Prime!
« Reply #8 on: April 17, 2014, 09:45:15 am »
Nice. Is it guideline compliant? Also, from my quick look at the picture, it looks like the blocks are overlapping the edge and each other a bit.
Arch Linux user
Haskell newbie | Warming up to Lua | Being dragged into C++
Calculators: HP 50g, HP 35s, Casio Prizm, TI-Nspire CX CAS, HP 28s, HP Prime, Mathematica 9 (if that counts)
π: 3.14...; l: 108; i: 105; e: 101; l+i+e: 314
THE CAKE IS A LIE IS A PIE

Offline Han

  • LV3 Member (Next: 100)
  • ***
  • Posts: 62
  • Rating: +7/-0
    • View Profile
Re: TETRIS for the HP Prime!
« Reply #9 on: May 02, 2014, 08:35:32 am »
Regarding the high score being reset, there is a way to do this but you will have to access the variable indirectly.

Code: [Select]
init_highscore()
begin
  local temp="_tetrisHS:={{"Player1" 12345},{"Player2",234}};"; // make sure that you initialize properly; change list to whatever you use
  CAS(temp); // evaluates string inside temp as if done from CAS command line; creates _tetrisHS variable
end;

// get the n-th high score
get_highscore(n)
begin
  local temp="_tetrisHS(" + n ")";
  iferr
    local score=CAS(temp);
  then
    init_highscore(); // make sure this runs properly or you end up with an infinite loop
    get_highscore(n);
  end;
  return(score); // return a list consisting of something like {"PlayerName" 1234}
end;

You can create a similar procedure for storing high scores. Indirection will not require you to have the variable initialized within your source code. Thus when you edit the source, the variable _tetrisHS will remain intact.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: TETRIS for the HP Prime!
« Reply #10 on: May 03, 2014, 11:48:59 pm »
Interesting, I'll have to give this a try at some point and examine how it works to ensure I know how to use it.

Offline iconmaster

  • LV3 Member (Next: 100)
  • ***
  • Posts: 82
  • Rating: +5/-0
    • View Profile
Re: TETRIS for the HP Prime!
« Reply #11 on: June 25, 2014, 04:58:54 pm »
Regarding the high score being reset, there is a way to do this but you will have to access the variable indirectly.

Code: [Select]
init_highscore()
begin
  local temp="_tetrisHS:={{"Player1" 12345},{"Player2",234}};"; // make sure that you initialize properly; change list to whatever you use
  CAS(temp); // evaluates string inside temp as if done from CAS command line; creates _tetrisHS variable
end;

// get the n-th high score
get_highscore(n)
begin
  local temp="_tetrisHS(" + n ")";
  iferr
    local score=CAS(temp);
  then
    init_highscore(); // make sure this runs properly or you end up with an infinite loop
    get_highscore(n);
  end;
  return(score); // return a list consisting of something like {"PlayerName" 1234}
end;

You can create a similar procedure for storing high scores. Indirection will not require you to have the variable initialized within your source code. Thus when you edit the source, the variable _tetrisHS will remain intact.

It's a good idea, but isn't the CAS memory volatile? I've lost data in CAS without warning before, myself. I'm still slightly apprehensive about adding CAS code into things; I've crashed messily pretty much all the time I've tried to use CAS functions in my code...

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: TETRIS for the HP Prime!
« Reply #12 on: June 25, 2014, 05:41:45 pm »
Do you mean volatile as in via OS bugs or did HP intentionally make it like that?

If it's the case, then I guess the program launcher + large sub-program trick will be more reliable.


What would be cool is if ASM was made possible on the HP Prime and a routine was made to allow self-modifying code in compiled programs (and their source), like on the 83+ series where highscores and saves are stored directly inside the game executable.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: TETRIS for the HP Prime!
« Reply #13 on: November 17, 2014, 05:21:47 pm »
Question: Would you mind if at one point I modified this game to include more advanced graphics? I like this version in particular so I thought that spicing it up with sprites and such stuff as replacement to plain color squares would be nice.

Offline iconmaster

  • LV3 Member (Next: 100)
  • ***
  • Posts: 82
  • Rating: +5/-0
    • View Profile
Re: TETRIS for the HP Prime!
« Reply #14 on: November 17, 2014, 10:48:39 pm »
Question: Would you mind if at one point I modified this game to include more advanced graphics? I like this version in particular so I thought that spicing it up with sprites and such stuff as replacement to plain color squares would be nice.

Go right ahead. I'd be glad to know I've helped you make something even better!