Alright, I'll try. I'm not too good myself, but I can offer a quick take on 2048 Then you can try merging in parts you like. 2048 is relatively simple, so I favour readability over optimization. Please pardon me if my schematics or writing conventions are off, I don't know how to write tokens properly on this forum. And maybe it isn't allowed to use quote tags instead of code tags for code? (These code tags don't allow for any syntax highlighting rules )
Spoiler For Spoiler:
Quote
.Z2048B ........................ ..Init ........................ Fix 5 DiagnosticOff ClrHome:ClrDraw 1 -> Z .This 'resets' L1 .(32 bytes because each element is 2 bytes, .and we have 16 elements .on a 4 by 4 array!) Fill(L1,32) ........................ ..Main loop ........................ Repeat getKey(14) .Input If getKey<5 1 -> Z If getKey(1) UP() ElseIf getKey(2) LEFT() ElseIf getKey(3) RIGHT() ElseIf getKey(4) DOWN() End End
If Z 0 -> Z UPDATE() End
RENDER() End Return ........................ ..Functions! ........................ .. Lbl UP Return Lbl CUP Return
Lbl LEFT Return Lbl CLEFT Return
Lbl RIGHT Return Lbl CRIGHT Return .. . !!! Just look at DOWN/CDOWN; Same concept. But you'll have to deal with rows/columns being transposed. . *Omited for brevity
Lbl DOWN For(I, 0, 11) If {I * 2 + L1)r -> A CDOWN() End End Return
Lbl CDOWN .For from one row past evaluated element until last row For(J, I / 4 + 1, 3) .Column I ^ 4 -> C .If value of next row element == value of evaluated cell If {J * 4 + C * 2 + L1}r -> V = A .Double of value is stored and evaluated cell is zero'd A * 2 -> {J * 4 + C * 2 + L1}r 0 -> {I * 2 + L1)r Return ElseIf V = 0 .If value of next row element != value of evaluated cell, but not equal to 0 ElseIf .Cell is zero'd, and its value, still in A, is moved to one row before the evaluated cell 0 -> {I * 2 + L1}r A -> {J * 4 + C * 2 - 8 + L1}r Return End End .If we're already here, that means none of the evaluated rows met our conditions. 0 -> {I * 2 + L1)r A -> {12 + C * 2 + L1}r Return
.Creates an array of every .free address with a sum .Writes '2' to a random free address Lbl UPDATE For(I, 0, 15) -1 -> A !If{I * 2 + L1}r I * 2 + L1 -> {A * 2 + L2}r A++ End End If A = -1 Return End 2 -> {{rand^A * 2 + L2}r}r Return
Edit: I can see why I shouldn't have used quotes now (It's huge!). I hope the moderators are fine with this once in a while. Edi2: Spoiler tags save the screen!
Well, do you think I (or you) could change your algorithm a bit? I store the board as one-byte numbers that are THE powers of two that the blocks are (i.e. 2 is stored as 1, 4 as 2, 8 as 3, etc.).
.J2048 Fix 5 .I WILL ADD RANDOM BLOCKS ONCE I GET THE ACTUAL ENGINE WORKING Data(0,0,0,0,0,2,1,1,6,5,4,3,7,8,9,10)->GDB1 .THE DATA IS RECOVERED FROM LAST GAMEPLAY EVERY TIME FOR SOME REASON .I DON'T WANT THAT, I WANT IT RESET DRAW() While 1 If getKey->K?<5 .START OF BAD CODE For(3) (K=1?11)+(K=2?13)+(K=3?14)+(K=4?4)->X For(12) !If {X+(K=1?4)-(K=2?1)+(K=3?1)-(K=4?4)+GDB1->Z}^{X+GDB1} {Z}?1 +{X+GDB1}->{Z} and 0->{X+GDB1} End X+(K=4?1)+(K=3?4)-(K=2?4)-(K=1?1)^17-> End End .END OF BAD CODE. PLEASE FIX! End DRAW() EndIf getKey(15) Fix 4 Return Lbl DRAW ClrDraw 0->r1 For(4) and 0->r2 For(4) If {r1/16*4+(r2/19)+GDB1}->r3 Text(r3<10+(r3<7)+(r3<4)*2+r2+2,r1+4,e^(r3)>Dec) End RectI(r2,r1,19,16) RectI(r2+1,r1+1,17,14) r2+19->r2 End r1+16->r1 End DispGraphAnyone, help?
No BUG CHECK is triggered by this, but it's game-breaking. I didn't get the update yet, but since it doesn't look like it's in the changelog, I'm reporting it anyways.
Instructions: Start a FreeCell game and make a ladder extending past the bottom of the screen. The calc freezes at a green (or green with yellow lines) screen.
Update today. I made optimizations (though there should be more I can do to make it smaller/faster), and I added a new egg similar to that "Made By Namco" Pacman Easter Egg.
Problem report: we can't press the 2nd key twice quickly (yeah, looking for that easter egg I hope it's not just the "diamond medal")
No, the Diamond medal isn't the Easter egg.
Oh, and controls have changed. In order to get past the title screen, press 2nd. Then, press up to start. To restart, press 2nd. Forgot to mention that.
Oh, and a hint: If you did it right, quit when it's all over.
DJ, thanks! It took a lot of time and bytes to make it happen, so I hope you're happy.
On a side note, I have a challenge for you all.
Flappy Bird has lain an Easter Egg, and it's up to you to guess what it is before it hatches on April 1st.
I am giving you a NoShell compiled version of the game with the Easter Egg in it (plus a few other minor graphical changes). It uses a different highscore format, but I'm sure that it will be compatible with previous versions.
If you want hints, please ask me, and I will give you a hint.
Whoever is the first to figure out the effects of the Easter Egg, AND how to correctly reproduce it by April 1st will recieve advance notification of any new projects or updates from me (you have it a week before anybody else), plus the bragging rights of your technical know-how (Runer, my money is actually on you ).
Well it looks nice and finished now. Also thank you for crediting me. Props to Kindermoumoute though from who I learned this ddebounce code that I use everywhere.