Omnimaga
Calculator Community => HP Calculators => Topic started by: iconmaster 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:
(http://i.imgur.com/dTma8wY.png)(http://i.imgur.com/PLzQ00l.png)(http://i.imgur.com/edr8Bt0.png)
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! (https://dl.dropboxusercontent.com/s/07a88yz1sehdd19/TETRIS.txt?dl=1&token_hash=AAHJBTY1ebz8hcfANDTWAN6gGWdloigLk_Z_HyjaHayrFQ)
Future Plans:
- Placement guides
- Showing the next piece
- Better graphics
-
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)
-
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.
-
Looks nice! I'll have to give it a go when I have some time as well. :D
-
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?
-
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.
-
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.
-
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.
-
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.
-
Regarding the high score being reset, there is a way to do this but you will have to access the variable indirectly.
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.
-
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.
-
Regarding the high score being reset, there is a way to do this but you will have to access the variable indirectly.
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...
-
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.
-
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.
-
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!