Author Topic: Lights Out help?  (Read 12453 times)

0 Members and 1 Guest are viewing this topic.

Offline Eiyeron

  • Urist McEiyolobster
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1430
  • Rating: +130/-10
  • (-_(//));
    • View Profile
    • Rétro-Actif : Rétro/Prog/Blog
Re: Lights Out help?
« Reply #30 on: December 02, 2013, 11:41:07 am »
(MissingNo has 3 correct sprites: the two fossils and the specter, it's only the other glitches that looks, and are, garbage),

Does the top-left corner looks right?

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: Lights Out help?
« Reply #31 on: December 02, 2013, 12:13:46 pm »
But...L1, according to the documentation, is "free RAM", which doesn't take up any RAM. The earlier method is fine.
It is only free RAM as long as you don't use it ;)
Yes it is free RAM and you can use it whenever you want, but my point is that you might need it somewhere else so if you can save it, save it but if you don't need to, don't save it.

For the cookie image, are you sure it is divided in sprites like that and not just divided in plain bytes ?
If it's plain bytes, something like this should work (if I made no errors this time :P):

.unoptimized
For(X,0,3)
 For(Y,0,29)
  {Y*4+X->r1+Pic1}->{r1+L6}
  {r1+Pic2}->{r1+L3}
 End
End

(Sorry, can't test right now)
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

click here to know where you got your last +1s

Offline JWinslow23

  • Coder Of Tomorrow
  • LV7 Elite (Next: 700)
  • *******
  • Posts: 556
  • Rating: +43/-6
  • I make quality calculator games...when I have time
    • View Profile
Re: Lights Out help?
« Reply #32 on: December 02, 2013, 07:04:32 pm »
But...L1, according to the documentation, is "free RAM", which doesn't take up any RAM. The earlier method is fine.
It is only free RAM as long as you don't use it ;)
Yes it is free RAM and you can use it whenever you want, but my point is that you might need it somewhere else so if you can save it, save it but if you don't need to, don't save it.

For the cookie image, are you sure it is divided in sprites like that and not just divided in plain bytes ?
If it's plain bytes, something like this should work (if I made no errors this time :P):

.unoptimized
For(X,0,3)
 For(Y,0,29)
  {Y*4+X->r1+Pic1}->{r1+L6}
  {r1+Pic2}->{r1+L3}
 End
End

(Sorry, can't test right now)

Testing soon.
Did you know that "Ammonia Gas" rearranged is "As Omnimaga"?
Click here for the only set of games you'll ever need
= ?

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: Lights Out help?
« Reply #33 on: December 03, 2013, 01:49:59 am »
See why I said "if I made no errors this time" ? :P
Just tested my code, and there are some things to change, but you get the idea.
Here's the full working (unoptimized) code to display that cookie:
Code: [Select]
[0007C000003FFC0000F81F0001F70F8007CF8BC00FCF89C01E6709E03C2000707810183070003C3860003C38E0001818E03C0018E07E001CF07E001CD83C039CCC00079CC200031C6000081870000338708001B839C000F039E000F01CC801E00E0803C00738078001F00E0000E01800003FF00000078000]->Pic1
[0007C000003FFC0000FFFF0001FF1F8007FF9FC00FEF8FC01FE79FE03FF319F07C783C70781C7E7870027E38E0383C18E07C0018F07E001CFC7E031CFC7E079CFC1C07BCE300433C7080193870208FF879D083F839E903F03DEB03F01ECE03E00FF807C007FC1F8001FEFE0000FFF800003FF00000078000]->Pic2
ClrDraw(L6)
ClrDraw(L3)
For(X,0,3)
 For(Y,0,29)
  {Y*4+X->r1+Pic1}->{Y*12+X->r2+L6}
  {r1+Pic2}->{r2+L3}
 End
End
While 1
DispGraph^^r
EndIf getKey(15)

edit just thought of an easier way to put it lol (but I like playing with bytes, I made my own sprite routine in Omniblade so that the player sprite loops :P)
Code: [Select]
[201D]->Pic1
[0007C000003FFC0000F81F0001F70F8007CF8BC00FCF89C01E6709E03C2000707810183070003C3860003C38E0001818E03C0018E07E001CF07E001CD83C039CCC00079CC200031C6000081870000338708001B839C000F039E000F01CC801E00E0803C00738078001F00E0000E01800003FF00000078000]
[201D]->Pic2
[0007C000003FFC0000FFFF0001FF1F8007FF9FC00FEF8FC01FE79FE03FF319F07C783C70781C7E7870027E38E0383C18E07C0018F07E001CFC7E031CFC7E079CFC1C07BCE300433C7080193870208FF879D083F839E903F03DEB03F01ECE03E00FF807C007FC1F8001FEFE0000FFF800003FF00000078000]
ClrDraw(L6)
ClrDraw(L3)
Bitmap(0,0,Pic1,L6)
Bitmap(0,0,Pic2,L3)
While 1
DispGraph^^r
EndIf getKey(15)
« Last Edit: December 03, 2013, 01:59:35 am by Hayleia »
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

click here to know where you got your last +1s

Offline JWinslow23

  • Coder Of Tomorrow
  • LV7 Elite (Next: 700)
  • *******
  • Posts: 556
  • Rating: +43/-6
  • I make quality calculator games...when I have time
    • View Profile
Re: Lights Out help?
« Reply #34 on: December 03, 2013, 12:35:44 pm »
I wonder if you could optimize it, the cookie looks GREAT!

Now for a cursor (without DCS, mind you!), and floating point math.
Did you know that "Ammonia Gas" rearranged is "As Omnimaga"?
Click here for the only set of games you'll ever need
= ?

Offline Streetwalrus

  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3821
  • Rating: +80/-8
    • View Profile
Re: Lights Out help?
« Reply #35 on: December 03, 2013, 12:51:03 pm »
A mouse cursor is the easiest thing to make. ;)

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: Lights Out help?
« Reply #36 on: December 03, 2013, 02:16:42 pm »
I wonder if you could optimize it
Just ask and you shall get.
The version I gave you is 496 bytes.

Optimizing the two For loops, we can get down to 477 bytes
Code: [Select]
[0007C000003FFC0000F81F0001F70F8007CF8BC00FCF89C01E6709E03C2000707810183070003C3860003C38E0001818E03C0018E07E001CF07E001CD83C039CCC00079CC200031C6000081870000338708001B839C000F039E000F01CC801E00E0803C00738078001F00E0000E01800003FF00000078000]->Pic1
[0007C000003FFC0000FFFF0001FF1F8007FF9FC00FEF8FC01FE79FE03FF319F07C783C70781C7E7870027E38E0383C18E07C0018F07E001CFC7E031CFC7E079CFC1C07BCE300433C7080193870208FF879D083F839E903F03DEB03F01ECE03E00FF807C007FC1F8001FEFE0000FFF800003FF00000078000]->Pic2
ClrDraw^^r^^r
0
For(4)
 ->X
 ~1->Y
 For(30)
  {Y+1->Y*4+X->r1+Pic1}->{Y*12+X->r2+L6}
  {r1+Pic2}->{r2+L3}
 End
 X+1
End
While 1
DispGraph^^r
EndIf getKey(15)

Then, changing the algorithm a bit, we can get down to  467 bytes
Code: [Select]
[0007C000003FFC0000F81F0001F70F8007CF8BC00FCF89C01E6709E03C2000707810183070003C3860003C38E0001818E03C0018E07E001CF07E001CD83C039CCC00079CC200031C6000081870000338708001B839C000F039E000F01CC801E00E0803C00738078001F00E0000E01800003FF00000078000]->Pic1
[0007C000003FFC0000FFFF0001FF1F8007FF9FC00FEF8FC01FE79FE03FF319F07C783C70781C7E7870027E38E0383C18E07C0018F07E001CFC7E031CFC7E079CFC1C07BCE300433C7080193870208FF879D083F839E903F03DEB03F01ECE03E00FF807C007FC1F8001FEFE0000FFF800003FF00000078000]->Pic2
ClrDraw^^r^^r
~1->r1
~9->r2
For(120)
 {Select(r1+1,->r1 and 3??r2+8->r2)+Pic1}->{r2+1->r2+L6}
 {r1+Pic2}->{r2+L3}
End
While 1
DispGraph^^r
EndIf getKey(15)

Now ask Runer112 and you'll get down to 5 bytes.

edit
I am so stupid, this can be done in 457 bytes
Code: [Select]
[0007C000003FFC0000F81F0001F70F8007CF8BC00FCF89C01E6709E03C2000707810183070003C3860003C38E0001818E03C0018E07E001CF07E001CD83C039CCC00079CC200031C6000081870000338708001B839C000F039E000F01CC801E00E0803C00738078001F00E0000E01800003FF00000078000]->Pic1
[0007C000003FFC0000FFFF0001FF1F8007FF9FC00FEF8FC01FE79FE03FF319F07C783C70781C7E7870027E38E0383C18E07C0018F07E001CFC7E031CFC7E079CFC1C07BCE300433C7080193870208FF879D083F839E903F03DEB03F01ECE03E00FF807C007FC1F8001FEFE0000FFF800003FF00000078000]->Pic2
ClrDraw^^r^^r
~4->r1
~12->r2
For(30)
 Copy(r1+4->r1+Pic1,r2+12->r2+L6,4)
 Copy(r1+Pic2,r2+L3,4)
End
While 1
DispGraph^^r
EndIf getKey(15)



For the code with Bitmaps commands, I don't see a lot to optimize except the two Clrdraws to put in a ClrDraw^^r^^r and the "0,0," to transorm into "0,,".
« Last Edit: December 03, 2013, 03:44:22 pm by Hayleia »
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

click here to know where you got your last +1s

Offline JWinslow23

  • Coder Of Tomorrow
  • LV7 Elite (Next: 700)
  • *******
  • Posts: 556
  • Rating: +43/-6
  • I make quality calculator games...when I have time
    • View Profile
Re: Lights Out help?
« Reply #37 on: December 03, 2013, 02:19:20 pm »
A mouse cursor is the easiest thing to make. ;)
Well, yes, but how to do it with 3-level grayscale without erasing anything behind it? I just think that anything on the main buffer will be erased by the cursor. I know, I tried.
Did you know that "Ammonia Gas" rearranged is "As Omnimaga"?
Click here for the only set of games you'll ever need
= ?

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: Lights Out help?
« Reply #38 on: December 03, 2013, 02:26:41 pm »
Easy, just save what's behind the sprite before drawing it, then draw it then erase it. Beware though to put your operations in a smart order so you don't have the DispGraph^^r between the erasing and the drawing part :P

Would look like this (check the Commands for proper syntax, I may mess up with the order of the arguments)

Pt-Get(X,Y,L6,L1)
Pt-Get(X,Y,L3,L1+8)
Pt-On(X,Y,°SpriteBlack,L6)
Pt-On(X,Y,°SpriteGrey,L3)
DispGraph^^r
Pt-Off(X,Y,L1,L6)
Pt-Off(X,Y,L1+8,L3)
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

click here to know where you got your last +1s

Offline Streetwalrus

  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3821
  • Rating: +80/-8
    • View Profile
Re: Lights Out help?
« Reply #39 on: December 03, 2013, 03:11:09 pm »
Also look at Pt-Mask if you want a partly transparent cursor. ;)

Offline aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3915
  • Rating: +184/-32
    • View Profile
    • wank.party
Re: Lights Out help?
« Reply #40 on: December 03, 2013, 07:18:25 pm »
offtopic: oh my streetwalker, dat profile pic o.o
I'm not a nerd but I pretend:

Offline Streetwalrus

  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3821
  • Rating: +80/-8
    • View Profile
Re: Lights Out help?
« Reply #41 on: December 04, 2013, 11:34:33 am »
offtopic: oh my streetwalker, dat profile pic o.o
Yes I wanted to look like a total nut. I'm a noob at taking better selfies. :P

Offline aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3915
  • Rating: +184/-32
    • View Profile
    • wank.party
Re: Lights Out help?
« Reply #42 on: December 04, 2013, 11:35:34 am »

You failed.
And I'm derailing the thread.
I'm not a nerd but I pretend:

Offline JWinslow23

  • Coder Of Tomorrow
  • LV7 Elite (Next: 700)
  • *******
  • Posts: 556
  • Rating: +43/-6
  • I make quality calculator games...when I have time
    • View Profile
Re: Lights Out help?
« Reply #43 on: December 04, 2013, 09:26:01 pm »
Sorry for the bump, but I want to tell you three things:

1. I quit the Cookie Clicker project. The numbers thing was too hard, bordering on impossible. :/
2. I just made a tiny optimization, and I'm attaching the game (SHUTDOWN) and the source (ASHUTDN) here.
3. I'm working on getting this on ticalc.org. I'll post back when I have the link.

EDIT: It's on ticalc.org!

http://www.ticalc.org/archives/files/fileinfo/457/45769.html

EDIT 2: I made a menu!
« Last Edit: December 13, 2013, 07:46:55 pm by JWinslow23 »
Did you know that "Ammonia Gas" rearranged is "As Omnimaga"?
Click here for the only set of games you'll ever need
= ?