HP Forums
MINESWEEPER for the HP PRIME - Printable Version

+- HP Forums (https://archived.hpcalc.org/museumforum)
+-- Forum: HP Museum Forums (https://archived.hpcalc.org/museumforum/forum-1.html)
+--- Forum: Old HP Forum Archives (https://archived.hpcalc.org/museumforum/forum-2.html)
+--- Thread: MINESWEEPER for the HP PRIME (/thread-258230.html)



MINESWEEPER for the HP PRIME - Tony Gallo - 12-10-2013

My 2nd game for the HP PRIME.....MINESWEEPER

http://my.tbaytel.net/tgallo/hp%20prime/


Re: MINESWEEPER for the HP PRIME - Walter B - 12-10-2013

Now we learn what the PRIME is made for.

d;-)


Re: MINESWEEPER for the HP PRIME - Cristian Arezzini - 12-10-2013

There is a MINESWEEPER on the 48 too. And on the 50g. :P


Re: MINESWEEPER for the HP PRIME - Mic - 12-10-2013

Tony, your games are great.

I made a video :

http://youtu.be/-sH14vzc4yU


Re: MINESWEEPER for the HP PRIME - Walter B - 12-10-2013

As I always said: those graphic calcs are for students only, not for students nor professionals (sorry for the ambiguity of the English language).

d:-)


Re: MINESWEEPER for the HP PRIME - Paul Dale - 12-10-2013

I seem to remember a version for the 42S as well....

Found it: Mine Hunt.


- Pauli

Edited: 10 Dec 2013, 5:09 a.m.


Re: MINESWEEPER for the HP PRIME - cyrille de Brébisson - 12-10-2013

Hello,

Nice work...

I had a quick look at the code and here are some comments:
(Note: since HPPL is a new language, what you write might end up being used by others as example code, as a result, it would pay for it to be as 'clean' as possible!)


- Look at the ICON documentation (in online help). It is used to creae sprites and bitmaps for use in programs. It will allow you to create better graphics with faster on screen drawing and less code.
you can download the ICON creator helper program at: http://h30499.www3.hp.com/hpeb/attachments/hpeb/bsc-408/14143/1/lodepng.zip

- Look at the makelist instruction. It is very powerfull! Anytime you need to create a list (either in a for loop or even staticaly), see if it can be used.
For example, minefield:={10,10,10,.....,10,10,10,10,10};
can be replaced by minefield:=makelist(10,1,100);

- more on list:
case
if bombcount == 0 then color := RGB(100,20,250); end;
if bombcount == 1 then color := RGB(1,0,254); end;
if bombcount == 2 then color := RGB(1,127,1); end;
if bombcount == 3 then color := RGB(254,0,0); end;
if bombcount == 4 then color := RGB(1,0,128); end;
if bombcount == 5 then color := RGB(129,1,2); end;
if bombcount == 6 then color := RGB(0,128,129); end;
if bombcount == 7 then color := RGB(0,0,0); end;
if bombcount == 8 then color := RGB(128,128,128); end;
end;
can be replaced by a list lookup:
local MyListOfCOlor= { RGB(100,20,250), ...}; // you could even have the list a global non exported variable. even faster.
color=MyListOfCOlor(bombcount+1);


- Avoid mixing CAS with non cas programs. look at the MOD and IP/FP functions as replacements for irem and iquo
I := irem(index-1,10);
J := iquo(index-1,10);


- look at the WAIT(-1) command. this is what you should use to wait for key presses/mouse events as it is low power consumption and returns all the info you want/need.

Cheers, Cyrille


Edited: 10 Dec 2013, 8:33 a.m.


Re: MINESWEEPER for the HP PRIME - Eddie W. Shore - 12-10-2013

This is great, thanks Tony! I remember playing Minesweeper during college. Mastermind is great too.

Eddie


Re: MINESWEEPER for the HP PRIME - Michael de Estrada - 12-10-2013

Well, by your logic the HP-67 was also just a toy, since its Standard Pac of program cards included a game called Moon Rocket lander. Actually, I'm quite surprised that hp did not include some sort of game App as standard issue.


Re: MINESWEEPER for the HP PRIME - toml_12953 - 12-10-2013

Are you sure about this line?

minefield:=makelist(10,1,100);

I thought makelist needs a variable to work. I get a syntax error when I check the program with the above line.


Re: MINESWEEPER for the HP PRIME - Patrice - 12-10-2013

Try

minefield:=makelist(10,A,1,100);



Re: MINESWEEPER for the HP PRIME - Tim Wessman - 12-10-2013

Uh-oh! Someone just hit a mine with that argument...

TW


Re: MINESWEEPER for the HP PRIME - Kévin Ouellet (Canada) - 12-10-2013

Quote:
As I always said: those graphic calcs are for students only, not for students nor professionals (sorry for the ambiguity of the English language).

d:-)


Not sure why some people are so anti-calc-games when people should be free to do what they want with the calc they paid for? If HP/TI/Casio didn't want games to be made on those calculators, they would never have included drawing/iskeydown commands, let alone gambling card symbols in the programming languages. Don't wonder why certain people boycott both the HP Museum and TI-Nspire User Group forums and why certain TI forums who are sick of TI and their TI-Crapspire are starting their own HP discussion instead of coming here.

Besides, to make calculator games, especially 3D ones, you need to know math anyway.

Anyway, if anybody wants to discuss or showcase calculator games and game-related projects on a calculator forum that is free of people who are against calculator games (they would get banned for trolling after a while), you should go to http://www.omnimaga.org/index.php?board=214.0 (hacking/programming) or http://www.omnimaga.org/index.php?board=212.0 (project/software showcase).


Edited: 10 Dec 2013, 2:49 p.m.


Re: MINESWEEPER for the HP PRIME - Chris Pem10 - 12-10-2013

Reminds me of this guy:





Jack Lebrowitski.

He was in charge of monitoring voltage levels in the oxygen tanks on the Appolo 13 mission. In this photo you can clearly see him distracted from his terminal as a fellow engineer demonstrated just out of picture:


"If you enter the number "5318008" on your terminal, and then do a hand-stand, it spells out the word ..."


The rest, as they say, is history.


Now lets all get back to work.


Re: MINESWEEPER for the HP PRIME - Tony Gallo - 12-10-2013

thanks for the suggestions Cyrille!


Re: MINESWEEPER for the HP PRIME - Tony Gallo - 12-11-2013

updated it....cleaned up some code as per Cyrille's suggestion and fixed some small bugs