Log In Patrick's Picochallenge (tweetweetcart) tobiasvl 2    Cart #picochallenge-0 | 2019-02-01 | Code ▽ | License: CC4-BY-NC-SA 2 A demake of my game Patrick's Cyberpunk Challenge for the TweetTweetJam.

The object of the game is to move Patrick the Leprechaun around the board and remove all 28 squares. Squares with special symbols will remove extra squares: Move Patrick to a square using the arrow keys. Note that you can (and sometimes must) move diagonally by pressing two arrow keys simultaneously.

Puzzles might be impossible to solve, and the game doesn't recognize if you win or lose. If the screen is empty except for Patrick, you win! If you have no legal moves, you lose and must restart the game manually.

Source code:

 ```poke(24364,3)x="웃"v="▥"h="▤"b={}for i=1,36 do b[i]=i%9<2 and""or"█"end for i in all{"⬆️","➡️",h,"⬅️","⬇️",v,x}do repeat f=1+flr(rnd(36))until b[f]!=""b[f]=i if(i==x)p=f end::_::t=btnp cls()for i=0,35 do k=b[i+1] ?k,i%9*8,6*flr(i/9)+20,k==x and 11 or 7 end b[p]=""q=p if(t(0))q-=1 if(t(1))q+=1 if(t(2))q-=9 if(t(3))q+=9 if(b[q]and#b[q]>0)p=q t=b[p] if(t=="⬆️"or t==v)b[p-10]=""b[p-9]=""b[p-8]="" if(t=="⬇️"or t==v)b[p+10]=""b[p+9]=""b[p+8]="" if(t=="⬅️"or t==h)b[p-10]=""b[p-1]=""b[p+8]="" if(t=="➡️"or t==h)b[p+10]=""b[p+1]=""b[p-8]="" b[p]=x flip()goto _```

"Unminified" source code:

 ```--patrick's picochallenge --by tobiasvl --use 64x64 resolution poke(0x5f2c,3) --generate a blank board of --empty █ tiles board={} --the board is 7x4, but we --represent it as a one- --dimensional table. we also --represent it as 36 tiles, ie --a 9x4 grid, with two columns --of "" on each end, so ⬅️➡️▤▥ --tiles don't wrap around when --they destroy adjacent tiles. for i=1,36 do if i%9<2 then --first and last column board[i]="" else board[i]="█" end end --populate the board with tiles --and the player's starting tile tiles={"⬆️","➡️","▤","⬅️","⬇️","▥","웃"} for i in all(tiles) do --find a random tile which is --not in the "invisible" outer --columns repeat position=1+flr(rnd(36)) until board[position]!="" board[position]=i --remember the player if (i=="웃") player=position end --game loop ::_:: cls() --print the board --here's the only obfuscation i --left in: here i loop from --0 to 35, instead of 1 to 36, --because then i only need to --do i+1 once instead of i-1 --twice. for i=0,35 do local tile=board[i+1] --the player is green if tile=="웃" then color(11) else color(7) end --properly centering the board --takes up too many characters --so just an approximation print(tile,i%9*8,6*flr(i/9)+20) end --erase the player character --and destroy the tile board[player]="" --remember the player's position new_player=player --move the player's position if --an arrow key is pressed if (btnp(⬅️)) new_player-=1 if (btnp(➡️)) new_player+=1 if (btnp(⬆️)) new_player-=9 if (btnp(⬇️)) new_player+=9 --if we're still inside the --board proper, ie the tile isn't --nil (outside the board) or "" --(the border columns), make --that the new position. if board[new_player] and board[new_player]!="" then player=new_player tile=board[player] end --if the player lands on one of --the special tiles, destroy --adjacent tiles if tile=="⬆️" or tile=="▥" then --destroy three tiles above board[player-10]="" board[player-9]="" board[player-8]="" end if tile=="⬇️" or tile=="▥" then --destroy three tiles below board[player+10]="" board[player+9]="" board[player+8]="" end if tile=="⬅️" or tile=="▤" then --destroy three tiles left board[player-10]="" board[player-1]="" board[player+8]="" end if tile=="➡️" or tile=="▤" then --destroy three tiles right board[player+10]="" board[player+1]="" board[player-8]="" end --put the player in the new --(or old!) position board[player]="웃" --loop flip() goto _```
P#61429 2019-02-01 08:53 ( Edited 2019-02-01 08:57)  I beat it!
I like the visual simplicity of this variant compared to the original/your's

P#61501 2019-02-04 09:05  Nice "playable" tweetcart @tobiasvl! :D
Thanks for taking the time to document/de-obfuscate the code too! ;o)

(Let me know when you Tweet it, and I'll add it to the Twitter Moment of "playable" TweetCarts)

P#61502 2019-02-04 10:52 ( Edited 2019-02-04 10:54)  @Liquidream: Here you go ;) What is this "Twitter Moment"? Note that this isn't a regular tweetcart, it's a tweettweetcart, ie. it fits into TWO tweets. But if that actually does qualify, I also have this one.

P#61504 2019-02-04 12:09 ( Edited 2019-02-04 12:09)  @tobiasvl Ah, my apologies - missed that part!

No, I've been limiting my Twitter Moment to just those that fit within SINGLE tweets. Wouldn't be fair to the others to start including these TweetTweet games, I'm afraid.

P#61505 2019-02-04 12:15 1 Completely understandable :) There were for a double-tweet jam.

P#61507 2019-02-04 12:21