HP Forums
Classic game "Lighs Out" - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Software Libraries (/forum-10.html)
+--- Forum: HP Prime Software Library (/forum-15.html)
+--- Thread: Classic game "Lighs Out" (/thread-302.html)



Classic game "Lighs Out" - ArielPalazzesi - 01-01-2014 10:47 PM

Hello!

With the help of forum users, the first day of the year 2014 could start and finish a very preliminary version of the classic game "Lighs Out".

Use the tap to change the status of the lights, and ICON for graphics. Thank you very much!!

PS: In a few days, when completed, will post the full program Smile

[Image: 1.png][Image: 2.png][Image: 4.png][Image: 5.png][Image: 1-MOTION.gif]


RE: Classic game "Lighs Out" - tgallo - 01-02-2014 05:25 AM

I am looking forward to this...I actually never heard of this game before...if I had I would have considered writing a version for the Prime


RE: Classic game "Lighs Out" - Han - 01-02-2014 06:13 AM

The emulator has a feature that enables easy exporting of screenshots -- this way your posts aren't filled with the non-essential portions of the emulator. Just select Edit > Copy Screen and go from there.


RE: Classic game "Lighs Out" - ArielPalazzesi - 01-02-2014 08:17 AM

(01-02-2014 05:25 AM)tgallo Wrote:  I am looking forward to this...I actually never heard of this game before...if I had I would have considered writing a version for the Prime

Those are the "benefits" of being an old manWink: I have a hardware version of this game, "Merlin" by Parker Brothers (about 1980). Not exactly the same, but has a similar mode of play.

A hug!

PD: More about "Lighs Out": http://en.wikipedia.org/wiki/Lights_Out_(game)

(01-02-2014 06:13 AM)Han Wrote:  The emulator has a feature that enables easy exporting of screenshots -- this way your posts aren't filled with the non-essential portions of the emulator. Just select Edit > Copy Screen and go from there.

Thanks Han!

Did not know that feature. I'm going to use from now on Wink
(I'm not a Windows user, I'm just using to emulate the HP Prime, and I know many of their characteristics. For example, I'm not sure where they end the screenshots I do, but I am sure that I will find .... ha ha ha!)


RE: Classic game "Lighs Out" - ArielPalazzesi - 01-02-2014 10:15 AM

Hello againWink

Well, the game is almost ready.

1) You can choose from three board sizes: 4x4, 5x5 and 6x6 lights.
2) You can choose the game mode: random or all the lights.
3) control the number of plays is carried efectudas.

Coming soon:

1) Store the highest score obtained (and player movements, for each type of board) (*)
2) Improve the graphics.
3) Sound ('s a joke, of course)
4) Screen presentation, support, and so on.

(*) Not sure that can be implemented, or at least I do not know how to store values ​​between matches.

Here's the code:


Code:
EXPORT lightsout3()
BEGIN
local XX,YY,AA,M;
local XX1, YY1,NIVEL,FINAL,SUMA, MOVI;
local xmouse, ymouse, matriz;
PRINT();
NIVEL := 5; 
CHOOSE(M, "Board Size", "4x4", "5x5", "6x6");
IF M<>0 THEN
  NIVEL := M+3;
END;

CHOOSE(M, "Game mode", "Random", "All On");

matriz := [[1,1,1,1,1,1],[1,1,1,1,1,1],[1,1,1,1,1,1],[1,1,1,1,1,1],[1,1,1,1,1,1],[1,1,1,1,1,1]];
IF M==1 THEN
  FOR XX FROM 1 TO NIVEL DO
    FOR YY FROM 1 TO NIVEL DO
      IF RANDOM(1) > 0.5 THEN
        matriz[XX,YY] := 1; 
      ELSE
        matriz[XX,YY] := 0; 
      END;
    END;
  END;
END;

DIMGROB_P(G1,320,240);
RECT();

DIMGROB_P(G2,1,18, {#D200F200F300F4:64,#AE00AF00AF00D0:64,#6800680068008C:64,#68006800680068:6​4,#680068:64});

XX := (160-16*NIVEL);
YY := (160+16*NIVEL);

FOR AA FROM XX TO YY DO
  BLIT_P(G2,AA,22);
END;

DIMGROB_P(G2,64,18, {#F400F400F400F4:64,#F400F400F400F4:64,#F400F400F400F4:64,#F400F400F400F4:6​4,#F400F400F400F4:64,#F400F400F400F4:64,#F400F400F400F4:64,#F400F400F400F4:64,#F​400F400F400F4:64,#F400F400F400F4:64,#F400F400F400F4:64,#F400F400F400F4:64,#F400F​400F400F4:64,#F400F400F400F4:64,#F400F400F400F4:64,#F400F400F400F4:64,#F300F300F​300F3:64,#F300F300F300F3:64,#F300F300F300F3:64,#F300F300F300F3:64,#F300F300F300F​3:64,#F300F300F300F3:64,#F300F300F300F3:64,#F300F300F300F3:64,#F300F300F300F3:64​,#F300F300F300F3:64,#F300F300F300F3:64,#F300F300F300F3:64,#F300F300F300F3:64,#F3​00F300F300F3:64,#F300F300F300F3:64,#F300F300F300F3:64,#F300F200F200F3:64,#F200F2​00F300F2:64,#F300F200F200F3:64,#F200F200F300F2:64,#F300F200F200F3:64,#F200F200F3​00F2:64,#F300F200F200F3:64,#F200F200F300F2:64,#F300F200F200F3:64,#F200F200F300F2​:64,#F300F200F200F3:64,#F200F200F300F2:64,#F300F200F200F3:64,#F200F200F300F2:64,​#F300F200F200F3:64,#F200F200F300F2:64,#D200D200D100D2:64,#D200D100D200D2:64,#D20​0D200D100D2:64,#D200D100D200D2:64,#D200D200D100D2:64,#D200D100D200D2:64,#D200D20​0D100D2:64,#D200D100D200D2:64,#D200D200D100D2:64,#D200D100D200D2:64,#D200D200D10​0D2:64,#D200D100D200D2:64,#D200D200D100D2:64,#D200D100D200D2:64,#D200D200D100D2:​64,#D200D100D200D2:64,#D000D000D100D0:64,#2194113200D000D0:64,#D000D100D02194:64​,#D1197321941973:64,#D000D100D000D0:64,#2194219400D000D1:64,#D000D100D000D0:64,#​D1113200B000D1:64,#D000D100D000D0:64,#D100D000D000D1:64,#8F100D100D000D0:64,#D00​0D119734258:64,#D000D000D100D0:64,#D000D100D000D0:64,#D000D1113200D0:64,#D100D00​0D000D1:64,#AF00AF00AF00AF:64,#7FFF425800AF00AF:64,#CF00CF00CF7FFF:64,#CF633C7FF​F633C:64,#CF00CF00CF00CF:64,#7FFF7FFF00CF00B0:64,#AF00AF00AF00AF:64,#B042587FFF3​A37:64,#AF00B000AF00AF:64,#B000AF00AF00B0:64,#7FFF7BDE00AF00AF:64,#AF7FFF7FFF7FF​F:64,#AF00AF00AF00B0:64,#3A3700AF00AF00AF:64,#AF00B042587FFF:64,#B000AF00AF00B0:​64,#AF00AF00AF00AF:64,#7FFF425700AF00AF:64,#AF00AF00AF7FFF:64,#AF195221931952:64​,#195231F5425700AF:64,#7FFF7FFF00AF1131:64,#AF1993425708CE:64,#195252DA7FFF7FFF:​64,#42574257195200AF:64,#AF00AF00AF00AF:64,#7FFF7FFF31F500AF:64,#5AFB7FFF7FFF219​3:64,#AF2193219200AF:64,#7FFF113111312193:64,#AF195252DA7FFF:64,#AF00AF00AF00AF:​64,#AE00AE00AE00AE:64,#7FFF425700AE00AE:64,#AE00AE00AE7FFF:64,#8E633B7FFF633B:64​,#7FFF7FFF7FFF7FFF:64,#7FFF7FFF00AE4257:64,#19317FFF7FFF7FFF:64,#633B7FFF7FFF7FF​F:64,#7FFF7FFF7FFF633B:64,#AE00AE00AE2193:64,#7FFF7FFF7BDE00AE:64,#7FFF7FFF739E0​0AE:64,#AE7FFF7FFF00AE:64,#7FFF425742577FFF:64,#AE633C7FFF7FFF:64,#AE00AE00AE00A​E:64,#8C008C008C008C:64,#7FFF4257008C008C:64,#8D008D008D7FFF:64,#2171633B7FFF633​B:64,#7FFF008C7FFF7FFF:64,#7FFF7FFF008C4257:64,#42577FFF7FFF08CE:64,#8C42577FFF7​FFF:64,#42577BDE7FFF7BDF:64,#8D008D008D006D:64,#7FFF7FFF7FFF008D:64,#7FFF7FFF633​B008C:64,#8D7FFF7FFF008C:64,#7FFF008C42577FFF:64,#8C008C42577FFF:64,#8C008C008C0​08C:64,#69006800680069:64,#7FFF423400690068:64,#47006900687FFF:64,#214E631A7FFF6​31A:64,#7FFF00477FFF7FFF:64,#7FFF7FFF00684234:64,#42347FFF7FFF0069:64,#6842347FF​F7FFF:64,#7FFF7FFF739D0068:64,#680068006856D9:64,#7BDF7FFF631A0068:64,#7FFF7FFF7​FFF0047:64,#687FFF7FFF0068:64,#7FFF006842347FFF:64,#68006842347FFF:64,#680069006​80068:64,#69006800680069:64,#7FFF423400690068:64,#7FFF7FFF7FFF7FFF:64,#68631A7FF​F631A:64,#7FFF7FFF7FFF7FFF:64,#7FFF7FFF00684234:64,#42347FFF7FFF0068:64,#35D26B5​C7FFF7FFF:64,#56D942347FFF7FFF:64,#68006900697BDF:64,#7FFF7FFF00690068:64,#190D7​FFF7FFF7FFF:64,#739D7FFF7FFF0069:64,#7FFF006942347FFF:64,#6835D26B5C7FFF:64,#690​06800680069:64,#69006800680069:64,#7FFF423400690068:64,#7FFF7FFF7FFF7FFF:64,#696​31A7FFF631A:64,#7FFF52B7631A08AA:64,#7FFF7FFF00694234:64,#42347FFF7FFF0069:64,#6​31A7FFF7FFF2990:64,#7FFF7FFF7FFF190D:64,#69006800680068:64,#7FFF10CB00680068:64,​#68214E7FFF7FFF:64,#7FFF7FFF6B5C0068:64,#2990006942347FFF:64,#68631A7FFF7FFF:64,​#69006800680069:64,#69006800680069:64,#68006800690068:64,#69006800680069:64,#680​06800690068:64,#7FFF7FFF7FFF631A:64,#69006900680069:64,#69006800680069:64,#69006​800690068:64,#68006900680068:64,#69006800680069:64,#68006900680068:64,#680069006​90068:64,#68006800690068:64,#68006900690069:64,#68006900680069:64,#6900680068006​9:64,#69006800680069:64,#68006800690068:64,#69006800680069:64,#68006800690068:64​,#68006900680069:64,#69006900680069:64,#69006800680068:64,#69006800690068:64,#68​006900680068:64,#69006800680069:64,#68006900680068:64,#68006900690069:64,#680068​00690068:64,#68006800680069:64,#68006800680068:64,#69006800680069:64,#6900680068​0069:64,#68006800690068:64,#69006800680069:64,#68006800690068:64,#68006800680069​:64,#68006800680069:64,#68006800680068:64,#68006800680068:64,#68006900680068:64,​#69006800680069:64,#68006900680068:64,#68006800690069:64,#69006900680069:64,#690​06800680068:64,#68006900690068:64,#69006800680069:64,#69006800680069:64,#6800680​0690068:64,#69006800680069:64,#68006800690068:64,#68006800680069:64,#69006800680​069:64,#68006800680069:64,#69006900680069:64,#68006900680068:64,#69006800680069:​64,#68006900680068:64,#69006900680068:64,#69006800680068:64,#68006900680068:64,#​68006900680069:64,#69006800680069:64,#69006800680069:64,#68006800690068:64,#6900​6800680069:64,#68006800690068:64,#68006800680069:64,#69006800680068:64,#68006800​680069:64,#68006900680069:64,#68006900680068:64,#69006800680069:64,#680069006800​68:64,#68006800680068:64,#68006800680068:64,#68006800690068:64,#68006900690068:6​4,#69006800680069:64,#69006800680069:64,#68006800690068:64,#69006800680069:64,#6​8006800690068:64,#68006800680069:64,#69006900680068:64,#68006800680069:64,#69006​800680069:64,#68006900680068:64,#69006800680069:64,#68006900680068:64,#680069006​80068:64,#68006900680068:64,#68006800680069:64,#68006800690068:64,#6900680068006​9:64});
BLIT_P(G2,128,22);

DIMGROB_P(G2,32,32, {#B02020001400B02:64,#3F2F3F2F3F2F3F2F:64,#3F2F3F2F3F2F3F2F:64,#3F2F3F2F3F2​F3F2F:64,#3F2F3F2F3F2F3F2F:64,#3F2F3F2F3F2F3F2F:64,#3F2F3F2F3F2F3F2F:64,#7A10EC3​3B0E3F2F:64,#332C0240014002A0:64,#43303F2F3F2F4330:64,#3F2F43303F2F3F2F:64,#4330​3F2F3F2F4330:64,#3F2F43303F2F3F2F:64,#43303F2F3F2F4330:64,#3F2F43303F2F3F2F:64,#​178506613AEE3F2F:64,#47B1034001600701:64,#47B147B147B147B1:64,#47B147B147B147B1:​64,#47B147B147B147B1:64,#47B147B147B147B1:64,#47B147B147B147B1:64,#47B147B147B14​7B1:64,#238816A53F2F4791:64,#4BD20FA301E00B22:64,#4BF24BF24BF24BF2:64,#4BF24BF24​BF24BF2:64,#4BF24BF24BF24BF2:64,#4BF24BF24BF24BF2:64,#4BF24BF24BF24BF2:64,#4BF24​BF24BF24BF2:64,#2BAA32CC43704BD2:64,#4FF30FA302000B22:64,#4FF34FF34FF34FF3:64,#4​FF34FF34FF34FF3:64,#4FF34FF34FF34FF3:64,#4FF34FF34FF34FF3:64,#4FF34FF34FF34FF3:6​4,#4FF34FF34FF34FF3:64,#2BAA36ED47914BF2:64,#4FF30FC302000B22:64,#4FF34FF34FF34F​F3:64,#4FF34FF34FF34FF3:64,#4FF34FF34FF34FF3:64,#4FF34FF34FF34FF3:64,#4FF34FF34F​F34FF3:64,#4FF34FF34FF34FF3:64,#2BAA36ED47914FF3:64,#4BF20FA302000B22:64,#4FF34F​F34FF34FF3:64,#4FF34FF34FF34FF3:64,#4FF34FF34FF34FF3:64,#4FF34FF34FF34FF3:64,#4F​F34FF34FF34FF3:64,#4FF34FF34FF34FF3:64,#2BAA32EC47914BF2:64,#4FD313A402000B22:64​,#4FF34FF34FF34FF3:64,#4FF34FF34FF34FF3:64,#4FF34FF34FF34FF3:64,#4FF34FF34FF34FF​3:64,#4FF34FF34FF34FF3:64,#4FF34FF34FF34FF3:64,#2BAA36ED47914FF3:64,#4BF207A1022​00B22:64,#4FF34FF34FF34FF3:64,#4FF34FF34FF34FF3:64,#4FF34FF34FF34FF3:64,#4FF34FF​34FF34FF3:64,#4FF34FF34FF34FF3:64,#4FF34FF34FF34FF3:64,#2BAA36ED47914FF3:64,#47F​107A102200B22:64,#4FF34FF34FF34FF3:64,#4FF34FF34FF34FF3:64,#4FF34FF34FF34FF3:64,​#4FF34FF34FF34FF3:64,#4FF34FF34FF34FF3:64,#4FF34FF34FF34FF3:64,#2BAA36ED47914BF2​:64,#47F103A002000B22:64,#4FF34FF34FF34FF3:64,#4FF34FF34FF34FF3:64,#4FF34FF34FF3​4FF3:64,#4FF34FF34FF34FF3:64,#4FF34FF34FF34FF3:64,#4FF34FF34FF34FF3:64,#2BAA3AEE​47914FF3:64,#47F103A002000B22:64,#4FF34FF34FF34FF3:64,#4FF34FF34FF34FF3:64,#4FF3​4FF34FF34FF3:64,#4FF34FF34FF34FF3:64,#4FF34FF34FF34FF3:64,#4FF34FF34FF34FF3:64,#​2BAA3AEE47914BF2:64,#47F103A002000B22:64,#4FF34FF34FF34FF3:64,#4FF34FF34FF34FF3:​64,#4FF34FF34FF34FF3:64,#4FF34FF34FF34FF3:64,#4FF34FF34FF34FF3:64,#4FF34FF34FF34​FF3:64,#2BAA3AEE47914FF3:64,#43F0038001E00B22:64,#4FF34FF34FF34FF3:64,#4FF34FF34​FF34FF3:64,#4FF34FF34FF34FF3:64,#4FF34FF34FF34FF3:64,#4FF34FF34FF34FF3:64,#4FF34​FF34FF34FF3:64,#2BAA3AEE47914BF2:64,#3BEE038001C00B22:64,#4FF34FF34FF34FF3:64,#4​FF34FF34FF34FF3:64,#4FF34FF34FF34FF3:64,#4FF34FF34FF34FF3:64,#4FF34FF34FF34FF3:6​4,#4FF34FF34FF34FF3:64,#2F8B3AEE47914FF3:64,#3BEE036001C00B22:64,#4FF34FF34FF34F​F3:64,#4FF34FF34FF34FF3:64,#4FF34FF34FF34FF3:64,#4FF34FF34FF34FF3:64,#4FF34FF34F​F34FF3:64,#4FF34FF34FF34FF3:64,#2F8B3AEE47914BF2:64,#2FEB034001C00B22:64,#4FF34F​F34FF34FF3:64,#4FF34FF34FF34FF3:64,#4FF34FF34FF34FF3:64,#4FF34FF34FF34FF3:64,#4F​F34FF34FF34FF3:64,#4FF34FF34FF34FF3:64,#2F8B3AEE47914BF2:64,#2BEA032001C00B22:64​,#4FF34FF34FF34FF3:64,#4FF34FF34FF34FF3:64,#4FF34FF34FF34FF3:64,#4FF34FF34FF34FF​3:64,#4FF34FF34FF34FF3:64,#4FF34FF34FF34FF3:64,#2F8B3AEE47914FF3:64,#23E8032001A​00B22:64,#4FF34FF34FF34FF3:64,#4FF34FF34FF34FF3:64,#4FF34FF34FF34FF3:64,#4FF34FF​34FF34FF3:64,#4FF34FF34FF34FF3:64,#4FF34FF34FF34FF3:64,#2F8B3AEE47914BF2:64,#1BE​6032001800B22:64,#4FF34FF34FF34FF3:64,#4FF34FF34FF34FF3:64,#4FF34FF34FF34FF3:64,​#4FF34FF34FF34FF3:64,#4FF34FF34FF34FF3:64,#4FF34FF34FF34FF3:64,#2F8B36ED47914FD3​:64,#1BE602E001800B02:64,#4FF34FF34FF34FF3:64,#4FF34FF34FF34FF3:64,#4FF34FF34FF3​4FF3:64,#4FF34FF34FF34FF3:64,#4FF34FF34FF34FF3:64,#4FF34FF34FF34FF3:64,#2F8B36ED​47914BF2:64,#17E502E001800B02:64,#4FF34FF34FF34FF3:64,#4FF34FF34FF34FF3:64,#4FF3​4FF34FF34FF3:64,#4FF34FF34FF34FF3:64,#4FF34FF34FF34FF3:64,#4FF34FF34FF34FF3:64,#​2F8B36ED47914FF3:64,#17E502C001800B02:64,#4FF34FF34FF34FF3:64,#4FF34FF34FF34FF3:​64,#4FF34FF34FF34FF3:64,#4FF34FF34FF34FF3:64,#4FF34FF34FF34FF3:64,#4FF34FF34FF34​FF3:64,#2F8B32EC47914BF2:64,#BE202A001800B02:64,#4FF34FF34FF34FF3:64,#4FF34FF34F​F34FF3:64,#4FF34FF34FF34FF3:64,#4FF34FF34FF34FF3:64,#4FF34FF34FF34FF3:64,#4FF34F​F34FF34FF3:64,#2F8B32EC47914FF3:64,#3C0026001600B02:64,#4FF34FF34FF34FF3:64,#4BF​24FF34FF34FF3:64,#43F043F043F043F0:64,#4BF247F143F043F0:64,#4FF34FF34FF34FF3:64,​#4FF34FF34FF34FF3:64,#27A932CC47914FF3:64,#360024001600721:64,#4FF34FF34FF34FF3:​64,#27E937ED43F04FF3:64,#13E413E413E413E4:64,#27E91BE61BE613E4:64,#4FF34FF34FF34​3F0:64,#4FF34FF34FF34FF3:64,#FC312E447914BF2:64,#280028001800320:64,#3C007E10BE2​13E4:64,#3400340038003C0:64,#2E002E002E00320:64,#3400320032002E0:64,#7E103C003C0​0380:64,#4BF247F12FEB1BE6:64,#34002203FAF4BF2:64,#2A00280020002A0:64,#28002A002A​002A0:64,#280026002600280:64,#280028002800280:64,#280028002800280:64,#2A00280028​00260:64,#3A00340030002C0:64,#2800200030013C4:64,#2A0024002A001C0:64,#2A002A002A​00280:64,#2C002C002C002C0:64,#2C002C002C002C0:64,#2C002C002C002C0:64,#2A002A002C​002C0:64,#280026002600280:64,#24001C002000280:64,#1A002000B020220:64,#1E001E001E​001E0:64,#1E001E001E001E0:64,#1E001E001E001E0:64,#1E001E001E001E0:64,#1E001E001E​001E0:64,#2400200020001E0:64,#200026001600200:64,#220016001C001E0:64,#2000220024​00280:64,#1A001C001C001C0:64,#1800180018001A0:64,#1A001A001A00180:64,#220020001E​001C0:64,#340030002800240:64,#F83014002200300:64,#1C001A0016001A0:64,#1C001C001C​001E0:64,#1C001C001C001C0:64,#1C001C001C001C0:64,#1C001C001C001C0:64,#1C001C001C​001C0:64,#1E001E001E001C0:64,#2200160018001E0:64});

DIMGROB_P(G3,32,32, {#8C00680025008C:64,#F300F400F300F3:64,#F300F300F400F3:64,#F300F400F300F3:6​4,#F300F300F400F3:64,#F300F400F300F3:64,#F300F300F400F3:64,#AF008D00F200F3:64,#D​100680025006A:64,#F400F500F400F4:64,#F400F400F500F4:64,#F400F500F400F4:64,#F400F​400F500F4:64,#F400F500F400F4:64,#F400F400F500F4:64,#D1008B00D200F3:64,#117008C00​25008C:64,#118011801180118:64,#118011801180118:64,#118011801180118:64,#118011801​180118:64,#118011801180118:64,#118011801180118:64,#F200AF00F50117:64,#13900AF004​700AD:64,#139013901390139:64,#139013901390139:64,#139013901390139:64,#1390139013​90139:64,#139013901390139:64,#139013901390139:64,#F300D201160138:64,#13800AF0047​00AD:64,#139013901390138:64,#139013901390139:64,#139013901390139:64,#13901390139​0139:64,#139013901390139:64,#139013901390139:64,#F400F201160138:64,#13900B000470​0AD:64,#139013901390139:64,#139013901390139:64,#139013901390139:64,#139013901390​139:64,#139013901390139:64,#139013901390139:64,#F300F301160118:64,#13900D1004700​AD:64,#139013901390139:64,#139013901390139:64,#139013901390139:64,#1390139013901​39:64,#139013901390139:64,#139013901390139:64,#F400F201160138:64,#13900D0006800A​D:64,#139013901390139:64,#139013901390139:64,#139013901390139:64,#13901390139013​9:64,#139013901390139:64,#139013901390139:64,#F400F201160138:64,#13800D0006800AD​:64,#138013801380138:64,#139013901390139:64,#139013901390139:64,#139013901390139​:64,#139013901390139:64,#139013901390139:64,#F400F201160118:64,#13900D1006800AD:​64,#139013901390139:64,#139013901390139:64,#139013901390139:64,#139013901390139:​64,#139013901390139:64,#139013901390139:64,#F400F301160118:64,#11700AF006800AD:6​4,#138013801380138:64,#139013801380138:64,#139013901390139:64,#139013901390139:6​4,#139013901390139:64,#139013901390139:64,#F500F301160138:64,#11700AF006800AD:64​,#138013801380138:64,#138013801380138:64,#139013901390138:64,#139013901390139:64​,#139013901390139:64,#139013901390139:64,#F400F301160138:64,#11800AE006800AD:64,​#139013901390139:64,#139013901390139:64,#139013901390139:64,#139013901390139:64,​#139013901390139:64,#139013901390139:64,#F500F301160138:64,#11700AE006800AD:64,#​138013801380138:64,#138013801380138:64,#138013801380138:64,#139013901390139:64,#​139013901390139:64,#139013901390139:64,#F400F301160138:64,#13800AE006800AD:64,#1​39013901390139:64,#139013901390139:64,#139013901390139:64,#139013901390139:64,#1​39013901390139:64,#139013901390139:64,#F400F201160118:64,#13700AE006800AD:64,#13​8013801380138:64,#138013801380138:64,#138013801380138:64,#139013801380138:64,#13​9013901390139:64,#139013901390139:64,#F400F301160118:64,#11700AE004700AD:64,#139​013901390139:64,#139013901390139:64,#139013901390139:64,#139013901390139:64,#139​013901390139:64,#139013901390139:64,#F400D201160138:64,#11600AE004700AD:64,#1390​13901390139:64,#139013901390139:64,#139013901390139:64,#139013901390139:64,#1390​13901390139:64,#139013901390139:64,#F400D201160118:64,#11500AD004700AD:64,#13901​3901390139:64,#139013901390139:64,#139013901390139:64,#139013901390139:64,#13901​3901390139:64,#139013901390139:64,#F400D201160118:64,#F4008C004700AD:64,#1390139​01390139:64,#139013901390139:64,#139013901390139:64,#139013901390139:64,#1390139​01390139:64,#139013901390139:64,#F400D201160118:64,#F3008C004700AD:64,#138013801​380138:64,#138013801380138:64,#138013801380138:64,#138013801380138:64,#138013801​380138:64,#138013801380138:64,#F300D201150117:64,#F3008C004700AD:64,#13901390139​0139:64,#139013901390139:64,#139013901390139:64,#139013901390139:64,#13901390139​0139:64,#139013901390139:64,#F400D101160138:64,#F3008C004600AD:64,#1390139013901​39:64,#139013901390139:64,#139013901390139:64,#139013901390139:64,#1390139013901​39:64,#139013901390139:64,#F300D101160138:64,#D2008B004600AD:64,#139013901390139​:64,#139013901390139:64,#139013901390139:64,#139013901390139:64,#139013901390139​:64,#139013901390139:64,#F400D001160138:64,#D1008A004600AD:64,#138013801380138:6​4,#138013801380138:64,#115011501150117:64,#117011701150115:64,#138013801380138:6​4,#138013801380138:64,#F300B001150137:64,#AE0069004600AD:64,#139013901390139:64,​#F5011601180139:64,#D000D100D100D1:64,#D100D100D100D0:64,#138013701160114:64,#13​8013801380138:64,#D0008B01150117:64,#8A00690046008C:64,#B000D100F200F3:64,#AD00A​D00AE00AF:64,#8C008C008C008C:64,#8C008C008C008D:64,#AF00AE00AE00AD:64,#138011600​D100B0:64,#AD006800F20138:64,#6A006A0047008B:64,#8A008B008B008B:64,#8A0069006900​8A:64,#8B008A008A008A:64,#8A008A008A008A:64,#8A00690069008A:64,#8C008C008C008A:6​4,#690068006A00AE:64,#8B008A00690046:64,#8B008A008A008A:64,#8B008B008B008B:64,#8​B008B008B008B:64,#8B008B008B008B:64,#8B008B008B008B:64,#69008A008A008B:64,#69004​700690069:64,#46004700AD0068:64,#47004700470047:64,#47004700470047:64,#470047004​70047:64,#47004700470047:64,#47004700470047:64,#68006800470047:64,#4700690046004​7:64,#69004600470047:64,#4700690069006A:64,#47004700470047:64,#46004600460046:64​,#46004600460046:64,#47004700470047:64,#6A006A00690047:64,#AF00250047008B:64,#47​004700460046:64,#47004700470047:64,#47004700470047:64,#46004700470047:64,#460046​00460046:64,#47004700460046:64,#47004700470047:64,#68004600460047:64});


FOR XX FROM 1 TO NIVEL DO
  FOR YY FROM 1 TO NIVEL DO 
    IF matriz[XX,YY]==1 THEN
      BLIT_P(G2,(XX-1)*32+(160-16*NIVEL),(YY-1)*32+40);
    ELSE
      BLIT_P(G3,(XX-1)*32+(160-16*NIVEL),(YY-1)*32+40);
    END;
  END;
END;

TEXTOUT_P("MOVES: ",0,0);


FINAL := 0;
MOVI := 0;
WHILE FINAL == 0 DO
  L0 := WAIT(-1);

  IF SIZE(L0)>1 THEN
    IF L0(1) == #3d THEN.
      xmouse := L0(2);
      ymouse := L0(3);
    
      IF xmouse>(160-16*NIVEL) AND xmouse<(160+16*NIVEL) AND ymouse>40 AND ymouse<(40+NIVEL*32) THEN
        XX1 := IP((xmouse - (160-16*NIVEL)) /32);
        YY1 := IP((ymouse - 40) /32);

        MOVI := MOVI + 1;  
        RECT_P(G0,0,0,120,20);
        TEXTOUT_P("MOVES: ",0,0);
        TEXTOUT_P(MOVI,80,0);

        IF matriz[YY1+1,XX1+1]==1 THEN
          BLIT_P(G3,XX1*32+(160-16*NIVEL),YY1*32+40);
          matriz[YY1+1,XX1+1] := 0; 
        ELSE
          BLIT_P(G2,XX1*32+(160-16*NIVEL),YY1*32+40);
          matriz[YY1+1,XX1+1] := 1; 
        END;
        IF XX1>0 THEN
          XX1 := XX1 - 1;
          IF matriz[YY1+1,XX1+1]==1 THEN
            BLIT_P(G3,XX1*32+(160-16*NIVEL),YY1*32+40);
            matriz[YY1+1,XX1+1] := 0; 
          ELSE
            BLIT_P(G2,XX1*32+(160-16*NIVEL),YY1*32+40);
            matriz[YY1+1,XX1+1] := 1; 
          END;
          XX1 := XX1 + 1;
        ELSE
          XX1 := NIVEL-1;
          IF matriz[YY1+1,XX1+1]==1 THEN
            BLIT_P(G3,XX1*32+(160-16*NIVEL),YY1*32+40);
            matriz[YY1+1,XX1+1] := 0; 
          ELSE
            BLIT_P(G2,XX1*32+(160-16*NIVEL),YY1*32+40);
            matriz[YY1+1,XX1+1] := 1; 
          END;
          XX1 := 0;
        END;
        IF XX1<(NIVEL-1) THEN
          XX1 := XX1 + 1;
          IF matriz[YY1+1,XX1+1]==1 THEN
            BLIT_P(G3,XX1*32+(160-16*NIVEL),YY1*32+40);
            matriz[YY1+1,XX1+1] := 0; 
          ELSE
            BLIT_P(G2,XX1*32+(160-16*NIVEL),YY1*32+40);
            matriz[YY1+1,XX1+1] := 1; 
          END;
          XX1 := XX1 - 1;
        ELSE
          XX1 := 0;
          IF matriz[YY1+1,XX1+1]==1 THEN
            BLIT_P(G3,XX1*32+(160-16*NIVEL),YY1*32+40);
            matriz[YY1+1,XX1+1] := 0; 
          ELSE
            BLIT_P(G2,XX1*32+(160-16*NIVEL),YY1*32+40);
            matriz[YY1+1,XX1+1] := 1; 
          END;
          XX1 := NIVEL-1;
        END;
        IF YY1<(NIVEL-1) THEN
          YY1 := YY1 + 1;
          IF matriz[YY1+1,XX1+1]==1 THEN
            BLIT_P(G3,XX1*32+(160-16*NIVEL),YY1*32+40);
            matriz[YY1+1,XX1+1] := 0; 
          ELSE
            BLIT_P(G2,XX1*32+(160-16*NIVEL),YY1*32+40);
            matriz[YY1+1,XX1+1] := 1; 
          END;
          YY1 := YY1 - 1;
        ELSE
          YY1 := 0;
          IF matriz[YY1+1,XX1+1]==1 THEN
            BLIT_P(G3,XX1*32+(160-16*NIVEL),YY1*32+40);
            matriz[YY1+1,XX1+1] := 0; 
          ELSE
            BLIT_P(G2,XX1*32+(160-16*NIVEL),YY1*32+40);
            matriz[YY1+1,XX1+1] := 1; 
          END;
          YY1 := NIVEL-1;
        END;
        IF YY1>0 THEN
          YY1 := YY1 - 1;
          IF matriz[YY1+1,XX1+1]==1 THEN
            BLIT_P(G3,XX1*32+(160-16*NIVEL),YY1*32+40);
            matriz[YY1+1,XX1+1] := 0; 
          ELSE
            BLIT_P(G2,XX1*32+(160-16*NIVEL),YY1*32+40);
            matriz[YY1+1,XX1+1] := 1; 
          END;
          YY1 := YY1 + 1;
        ELSE
          YY1 := NIVEL-1;
          IF matriz[YY1+1,XX1+1]==1 THEN
            BLIT_P(G3,XX1*32+(160-16*NIVEL),YY1*32+40);
            matriz[YY1+1,XX1+1] := 0; 
          ELSE
            BLIT_P(G2,XX1*32+(160-16*NIVEL),YY1*32+40);
            matriz[YY1+1,XX1+1] := 1; 
          END;
          YY1 := 0;
        END;

      END;
    END;
  END;
  SUMA := 0;
  FOR XX FROM 1 TO NIVEL DO
    FOR YY FROM 1 TO NIVEL DO
      SUMA := SUMA + matriz[XX,YY];
    END;
  END;
  
  IF SUMA == 0 THEN 
    MSGBOX("Solved in "+MOVI+" moves!");
    FINAL := 1;
  END; 

END;


END;


And some screencaps:

[Image: 1.jpg]

[Image: 2.png]

[Image: 4.png]

[Image: 5.png]

Note: : the screenshots are in Spanish, but since most of the forum users have English as their first language, the source code is translated texts that languageWink Wink


RE: Classic game "Lighs Out" - tgallo - 01-02-2014 12:16 PM

(01-02-2014 08:17 AM)ArielPalazzesi Wrote:  
(01-02-2014 05:25 AM)tgallo Wrote:  I am looking forward to this...I actually never heard of this game before...if I had I would have considered writing a version for the Prime

Those are the "benefits" of being an old manWink: I have a hardware version of this game, "Merlin" by Parker Brothers (about 1980). Not exactly the same, but has a similar mode of play.


I remember Merlin....I'm not so young myself.


RE: Classic game "Lighs Out" - Han - 01-02-2014 04:59 PM

You can make your program much smaller by using the drawing commands such as FILLPOLY to color the boxes instead of the two different graphics for each type of box.

Code:

DRAW();

EXPORT TILE()
BEGIN
  LOCAL s=16;
  LOCAL onoff,key,x=2*s,y=2*s,run=1;
  DIMGROB_P(G2,320,240);
  DIMGROB_P(G1,s,s);

  // create a temporary example; if you want a tile block, then
  // you only really need one and then color the rest using
  // FILLPOLY
  BLIT_P(G1,G0,320-s,0,320,s);

  WHILE run DO
  DRAW(x,y,onoff);
  key:=WAIT(-1);
   
  CASE
    if TYPE(key)==6 then run:=0; end;
    if key==27 then onoff:=(onoff+1) MOD 2; end;

    REPEAT
      CASE
        if key==2 then y:=y-s; end;
        if key==7 then x:=x-s; end;
        if key==8 then x:=x+s; end;
        if key==12 then y:=y+s; end;
      END;

      if x<0 then x:=320-s; end;
      if x>320-s then x:=0; end;
      if y<0 then y:=240-s; end;
      if y>240-s then y:=0; end;
      DRAW(x,y,onoff);
      WAIT(.2);
 
    UNTIL NOT ISKEYDOWN(key); // repeat loop 
  END; // outer case

  END; // while loop 
END;

DRAW(x,y,onoff)
BEGIN
  LOCAL s=16;
  LOCAL red:=#FF0000h, blue:=#FFh;
      RECT_P(G2);
      BLIT_P(G2,x,y,G1);
      FILLPOLY_P(G2,
        { {x,y},{x+s,y},{x+s,y+s},{x,y+s} },
        (NOT onoff)*red+onoff*blue,
      128);
      BLIT_P(G0,G2);
END;



RE: Classic game "Lighs Out" - ArielPalazzesi - 01-02-2014 06:10 PM

Thank you very much! If the program is too large for what it does.
I did it mostly to learn how to use commands in the HP Basic.
One advantage is that the method used could easily change the graphics, for example using LED tiles or other lamp (*). Wink

Thanks for the tips, very useful for me.


(*) Done!

[Image: 6.png]


RE: Classic game "Lighs Out" - Kevin Ouellet - 01-03-2014 03:55 PM

(01-02-2014 06:13 AM)Han Wrote:  The emulator has a feature that enables easy exporting of screenshots -- this way your posts aren't filled with the non-essential portions of the emulator. Just select Edit > Copy Screen and go from there.

I personally use Camstudio to record in AVI then VirtualDub to convert to animated GIF, but this can result in horribly large file size, even if you reduce the frame rate. There is also CalcCapture, which can be setup to capture from the HP emulator, but the quality is very bad unless you choose grayscale.

Nice looking game by the way! Could you post a hppgrm version (Doc and settings/<user>/appdata/roaming/hp prime/) on the forums so it's easier to get it to work in the emulator? Because the HP Prime has a bug with whitespace characters preventing most forum code from working when pasted in the emu.


RE: Classic game "Lighs Out" - ArielPalazzesi - 01-03-2014 04:32 PM

Hi Kevin!
Nice to meet you.

Here is the hppgrm file.

A hug from Argentina.

PS: I am a frequent visitor to Omnimaga. Good work!


RE: Classic game "Lighs Out" - ArielPalazzesi - 01-03-2014 04:59 PM

[OT] Sokoban in comming! Wink

Hello!
I'm still learning a little bit about the commands and possibilities of this excellent machine.

I started working on developing a version of the game Sokoban. Using tiles of 16x16 bits and compressing maps of each level in about 120 bytes, you may have the game with 100 levels in about 40-50KB. It seems reasonable.

[Image: Captura+de+pantalla+de+2014-01-03+12%253A18%253A53.png]

For now I have the graphics and movement routines. I need to optimize the compression / decompression of maps and details of the game (score, help, etc).

I made some screenshots and anime, but it looks bad to have numbered screens that animation makes some strange jumps. Obviously the program does not.

[Image: 01-MOTION.gif]

I try finish this project for February (version 1.0) Smile

regards


RE: Classic game "Lighs Out" - Han - 01-03-2014 06:03 PM

Looks very cool!


RE: Classic game "Lighs Out" - tgallo - 01-03-2014 06:23 PM

(01-03-2014 04:59 PM)ArielPalazzesi Wrote:  [OT] Sokoban in comming! Wink

Hello!
I'm still learning a little bit about the commands and possibilities of this excellent machine.

I started working on developing a version of the game Sokoban. Using tiles of 16x16 bits and compressing maps of each level in about 120 bytes, you may have the game with 100 levels in about 40-50KB. It seems reasonable.


I try finish this project for February (version 1.0) Smile

regards


looking forward tho this one....I remember playing this on my 48GX


RE: Classic game "Lighs Out" - eried - 01-03-2014 07:31 PM

Sokoban looks great. But I would prefer a little "worker" icon rather than that symbol you used as the player Tongue


RE: Classic game "Lighs Out" - ArielPalazzesi - 01-03-2014 07:40 PM

Yeah, I'll have to make 4 worker cartoons, one for each direction. And if my wisdom is enough, do some sort of animation when moving. Wink


RE: Classic game "Lighs Out" - eried - 01-03-2014 08:03 PM

(01-03-2014 07:40 PM)ArielPalazzesi Wrote:  Yeah, I'll have to make 4 worker cartoons, one for each direction. And if my wisdom is enough, do some sort of animation when moving. Wink

And a button to super impulse the block Big Grin (with dust and dynamic particles of course when it collision the wall)


RE: Classic game "Lighs Out" - Mic - 01-04-2014 02:54 PM

Very nice !! Sprites permit in developing great games.