Code: Select all
REM poop hop.txt v1.1 (ipad/iphone)
'A triangle peg jump type puzzle game
'Coded by Dav, SEP/2017
'changed emojio 9.21.2017
'HOW TO PLAY: Tap on a frog and jump over another.
'You can only jump to an empty spot, and over 1 frog.
'The goal is to get rid of as many frogs as possible.
'Leave only ONE frog to beat the game and be a genius.
'Credits: Used rbytes all devices method/code.
'initialize program
RANDOMIZE
OPTION BASE 1
SET TOOLBAR OFF
GET ORIENTATION ort
SET ORIENTATION vertical
GET SCREEN SIZE sw,sh
'detect device for screen settings
IF LOWSTR$(DEVICE_TYPE$())="ipad" THEN
rw=1!rh=1
ELSE
rw=sw/768!rh=sh/1024
END IF
GRAPHICS
GRAPHICS CLEAR .5,.5,0
'======
restart:
'======
' x$=CHR$(58673) 'frog emoji
x$=CHR$(57434) 'poop emoji
'make an array for button data, 15 frogs
DIM bv$(15)!FOR t=1 TO 15!bv$(t)=x$!NEXT t
'mark one random button empty
bv$(RND(15)+1)=""
GOSUB drawinfo 'show title, instructions
'make a restart button
SET BUTTONS CUSTOM
SET BUTTONS FONT SIZE 36*rw
DRAW COLOR 0,0,1
FILL COLOR 1,1,0
BUTTON "restart" TEXT "restart" AT 325*rw,900*rh
'make a quit button
DRAW COLOR 0,0,0
FILL COLOR 1,.5,.5
BUTTON "quit" TEXT "Quit" AT 25*rw,25*rh
'===
main: 'main loop...
'===
selected=0
GOSUB drawboard
GOSUB checkifmovesleft
second:
DO
FOR t=1 TO 16
IF BUTTON_PRESSED(STR$(t)) THEN
'if first choice...
IF selected=0 THEN
'only select an x$ (frog) pad
IF bv$(t)=x$ THEN
selected=1 ! selbtn=t ! but(t)
'show jump options
GOSUB showjumps
NOTES SET "115:sg7"!NOTES PLAY
GOTO second 'now get second choice
END IF
ELSE 'making second choice
'only jump to blank pads
IF bv$(t)="" THEN
GOSUB checkandmove
NOTES SET "125:sab"!NOTES PLAY
'notes set "120:tg1a"!NOTES PLAY
GOTO main
ELSE
'clear previous highlighted btn
selected=0!GOSUB drawboard!selected=1
'set new one now...
selbtn=t!but(t)
GOSUB showjumps
NOTES SET "115:sg7"!NOTES PLAY
GOTO second
END IF
END IF
END IF
NEXT t
IF BUTTON_PRESSED("restart") THEN GOTO restart
IF BUTTON_PRESSED("quit") THEN
SET ORIENTATION ort ! END
END IF
UNTIL 0
END
'===========
checkandmove:
'===========
'====== logic for btn 1
IF selbtn=1 THEN
IF t=4 THEN
IF bv$(2)=x$ THEN
bv$(1)=""!bv$(2)=""!bv$(4)=x$
END IF
END IF
IF t=6 THEN
IF bv$(3)=x$ THEN
bv$(1)=""!bv$(3)=""!bv$(6)=x$
END IF
END IF
END IF
'====== logic for btn 2
IF selbtn=2 THEN
IF t=7 THEN
IF bv$(4)=x$ THEN
bv$(2)=""!bv$(4)=""!bv$(7)=x$
END IF
END IF
IF t=9 THEN
IF bv$(5)=x$ THEN
bv$(2)=""!bv$(5)=""!bv$(9)=x$
END IF
END IF
END IF
'====== logic for btn 3
IF selbtn=3 THEN
IF t=8 THEN
IF bv$(5)=x$ THEN
bv$(3)=""!bv$(5)=""!bv$(8)=x$
END IF
END IF
IF t=10 THEN
IF bv$(6)=x$ THEN
bv$(3)=""!bv$(6)=""!bv$(10)=x$
END IF
END IF
END IF
'====== logic for btn 4
IF selbtn=4 THEN
IF t=1 THEN
IF bv$(2)=x$ THEN
bv$(4)=""!bv$(2)=""!bv$(1)=x$
END IF
END IF
IF t=6 THEN
IF bv$(5)=x$ THEN
bv$(4)=""!bv$(5)=""!bv$(6)=x$
END IF
END IF
IF t=13 THEN
IF bv$(8)=x$ THEN
bv$(4)=""!bv$(8)=""!bv$(13)=x$
END IF
END IF
IF t=11 THEN
IF bv$(7)=x$ THEN
bv$(4)=""!bv$(7)=""!bv$(11)=x$
END IF
END IF
END IF
'====== logic for btn 5
IF selbtn=5 THEN
IF t=12 THEN
IF bv$(8)=x$ THEN
bv$(5)=""!bv$(8)=""!bv$(12)=x$
END IF
END IF
IF t=14 THEN
IF bv$(9)=x$ THEN
bv$(5)=""!bv$(9)=""!bv$(14)=x$
END IF
END IF
END IF
'====== logic for btn 6
IF selbtn=6 THEN
IF t=1 THEN
IF bv$(3)=x$ THEN
bv$(6)=""!bv$(3)=""!bv$(1)=x$
END IF
END IF
IF t=4 THEN
IF bv$(5)=x$ THEN
bv$(6)=""!bv$(5)=""!bv$(4)=x$
END IF
END IF
IF t=13 THEN
IF bv$(9)=x$ THEN
bv$(6)=""!bv$(9)=""!bv$(13)=x$
END IF
END IF
IF t=15 THEN
IF bv$(10)=x$ THEN
bv$(6)=""!bv$(10)=""!bv$(15)=x$
END IF
END IF
END IF
'====== logic for btn 7
IF selbtn=7 THEN
IF t=2 THEN
IF bv$(4)=x$ THEN
bv$(7)=""!bv$(4)=""!bv$(2)=x$
END IF
END IF
IF t=9 THEN
IF bv$(8)=x$ THEN
bv$(7)=""!bv$(8)=""!bv$(9)=x$
END IF
END IF
END IF
'====== logic for btn 8
IF selbtn=8 THEN
IF t=3 THEN
IF bv$(5)=x$ THEN
bv$(8)=""!bv$(5)=""!bv$(3)=x$
END IF
END IF
IF t=10 THEN
IF bv$(9)=x$ THEN
bv$(8)=""!bv$(9)=""!bv$(10)=x$
END IF
END IF
END IF
'====== logic for btn 9
IF selbtn=9 THEN
IF t=2 THEN
IF bv$(5)=x$ THEN
bv$(9)=""!bv$(5)=""!bv$(2)=x$
END IF
END IF
IF t=7 THEN
IF bv$(8)=x$ THEN
bv$(9)=""!bv$(8)=""!bv$(7)=x$
END IF
END IF
END IF
'====== logic for btn 10
IF selbtn=10 THEN
IF t=8 THEN
IF bv$(9)=x$ THEN
bv$(10)=""!bv$(9)=""!bv$(8)=x$
END IF
END IF
IF t=3 THEN
IF bv$(6)=x$ THEN
bv$(10)=""!bv$(6)=""!bv$(3)=x$
END IF
END IF
END IF
'====== logic for btn 11
IF selbtn=11 THEN
IF t=4 THEN
IF bv$(7)=x$ THEN
bv$(11)=""!bv$(7)=""!bv$(4)=x$
END IF
END IF
IF t=13 THEN
IF bv$(12)=x$ THEN
bv$(11)=""!bv$(12)=""!bv$(13)=x$
END IF
END IF
END IF
'====== logic for btn 12
IF selbtn=12 THEN
IF t=5 THEN
IF bv$(8)=x$ THEN
bv$(12)=""!bv$(8)=""!bv$(5)=x$
END IF
END IF
IF t=14 THEN
IF bv$(13)=x$ THEN
bv$(12)=""!bv$(13)=""!bv$(14)=x$
END IF
END IF
END IF
'====== logic for btn 13
IF selbtn=13 THEN
IF t=4 THEN
IF bv$(8)=x$ THEN
bv$(13)=""!bv$(8)=""!bv$(4)=x$
END IF
END IF
IF t=6 THEN
IF bv$(9)=x$ THEN
bv$(13)=""!bv$(9)=""!bv$(6)=x$
END IF
END IF
IF t=11 THEN
IF bv$(12)=x$ THEN
bv$(13)=""!bv$(12)=""!bv$(11)=x$
END IF
END IF
IF t=15 THEN
IF bv$(14)=x$ THEN
bv$(13)=""!bv$(14)=""!bv$(15)=x$
END IF
END IF
END IF
'====== logic for btn 14
IF selbtn=14 THEN
IF t=5 THEN
IF bv$(9)=x$ THEN
bv$(14)=""!bv$(9)=""!bv$(5)=x$
END IF
END IF
IF t=12 THEN
IF bv$(13)=x$ THEN
bv$(14)=""!bv$(13)=""!bv$(12)=x$
END IF
END IF
END IF
'====== logic for btn 15
IF selbtn=15 THEN
IF t=6 THEN
IF bv$(10)=x$ THEN
bv$(15)=""!bv$(10)=""!bv$(6)=x$
END IF
END IF
IF t=13 THEN
IF bv$(14)=x$ THEN
bv$(15)=""!bv$(14)=""!bv$(13)=x$
END IF
END IF
END IF
RETURN
'========
showjumps:
'========
IF selbtn=1 THEN
IF bv$(2)=x$ AND bv$(4)="" THEN but(4)
IF bv$(3)=x$ AND bv$(6)="" THEN but(6)
END IF
IF selbtn=2 THEN
IF bv$(4)=x$ AND bv$(7)="" THEN but(7)
IF bv$(5)=x$ AND bv$(9)="" THEN but(9)
END IF
IF selbtn=3 THEN
IF bv$(5)=x$ AND bv$(8)="" THEN but(8)
IF bv$(6)=x$ AND bv$(10)="" THEN but(10)
END IF
IF selbtn=4 THEN
IF bv$(2)=x$ AND bv$(1)="" THEN but(1)
IF bv$(5)=x$ AND bv$(6)="" THEN but(6)
IF bv$(7)=x$ AND bv$(11)="" THEN but(11)
IF bv$(8)=x$ AND bv$(13)="" THEN but(13)
END IF
IF selbtn=5 THEN
IF bv$(8)=x$ AND bv$(12)="" THEN but(12)
IF bv$(9)=x$ AND bv$(14)="" THEN but(14)
END IF
IF selbtn=6 THEN
IF bv$(3)=x$ AND bv$(1)="" THEN but(1)
IF bv$(9)=x$ AND bv$(13)="" THEN but(13)
IF bv$(5)=x$ AND bv$(4)="" THEN but(4)
IF bv$(10)=x$ AND bv$(15)="" THEN but(15)
END IF
IF selbtn=7 THEN
IF bv$(4)=x$ AND bv$(2)="" THEN but(2)
IF bv$(8)=x$ AND bv$(9)="" THEN but(9)
END IF
IF selbtn=8 THEN
IF bv$(5)=x$ AND bv$(3)="" THEN but(3)
IF bv$(9)=x$ AND bv$(10)="" THEN but(10)
END IF
IF selbtn=9 THEN
IF bv$(5)=x$ AND bv$(2)="" THEN but(2)
IF bv$(8)=x$ AND bv$(7)="" THEN but(7)
END IF
IF selbtn=10 THEN
IF bv$(9)=x$ AND bv$(8)="" THEN but(8)
IF bv$(6)=x$ AND bv$(3)="" THEN but(3)
END IF
IF selbtn=11 THEN
IF bv$(7)=x$ AND bv$(4)="" THEN but(4)
IF bv$(12)=x$ AND bv$(13)="" THEN but(13)
END IF
IF selbtn=12 THEN
IF bv$(8)=x$ AND bv$(5)="" THEN but(5)
IF bv$(13)=x$ AND bv$(14)="" THEN but(14)
END IF
IF selbtn=13 THEN
IF bv$(8)=x$ AND bv$(4)="" THEN but(4)
IF bv$(9)=x$ AND bv$(6)="" THEN but(6)
IF bv$(14)=x$ AND bv$(15)="" THEN but(15)
IF bv$(12)=x$ AND bv$(11)="" THEN but(11)
END IF
IF selbtn=14 THEN
IF bv$(9)=x$ AND bv$(5)="" THEN but(5)
IF bv$(13)=x$ AND bv$(12)="" THEN but(12)
END IF
IF selbtn=15 THEN
IF bv$(10)=x$ AND bv$(6)="" THEN but(6)
IF bv$(14)=x$ AND bv$(13)="" THEN but(13)
END IF
RETURN
'========
drawboard:
'========
DRAW COLOR 1,1,0
FILL COLOR 1,1,1
FOR b=1 TO 15
but(b)
NEXT b
RETURN
'=======
drawinfo:
'=======
'a litte background
FOR y = 1 TO 50
'DRAW TEXT CHR$(58460) AT RND(sw)/rw,RND(sh)/rh
NEXT y
'draw screen info
DRAW COLOR 1,.5,0
DRAW FONT SIZE 36*rw
DRAW TEXT "POOP HOP!" AT 300*rw,30*rh
DRAW FONT SIZE 24*rw
DRAW TEXT "(Touch poop to move, then the pad to jump to)" AT 60*rw,650*rh
DRAW TEXT "Jump all but one poop." AT 240*rw,700*rh
DRAW TEXT "Jump each poop to remove it." AT 200*rw, 725*rh
DRAW TEXT "Leave only one -- you're a genius." AT 155*rw,750*rh
DRAW TEXT "Leave two and you're smelling good." AT 155*rw,775*rh
DRAW TEXT "Leave three and you are just stinky." AT 150*rw,800*rh
DRAW TEXT "Leave four or more and you're just crap!" AT 120*rw,825*rh
'DRAW TEXT "crap!" AT 265*rw,850*rh
DRAW COLOR 1,1,1
RETURN
'===============
checkifmovesleft:
'===============
FONTsize =36
'if no moves left, restart
IF movesleft= 0 THEN
'count how many frogs left
bc=0
FOR b=1 TO 15
IF bv$(b)=x$ THEN bc=bc+1
NEXT b
'show number
SET BUTTONS FONT SIZE FONTsize*rw
DRAW COLOR 1,1,1
FILL COLOR 0,0,1
tx$=STR$(bc)&" left = "
IF bc>3 THEN tx$=tx$&"CRAP!"
IF bc=3 THEN tx$=tx$&"STINKY!"
IF bc=2 THEN tx$=tx$&"SMELL GOOD!"
IF bc=1 THEN tx$=tx$&"GENIUS!"
tl=TEXT_WIDTH(tx$)
'BUTTON "over" TEXT tx$ AT (sw/2-(tl/2))*rw,(sh/2-100)*rh
BUTTON "over" TEXT tx$ AT (sw/3)-(t1*FONTsize),(sh/2)
'notes set "111:h(d3fa)(dga#)(dfa)"
'notes play ! PAUSE 3
BUTTON "over" DELETE
GOTO restart
END IF
RETURN
'===============================
DEF but(n) 'draws puzzle buttons
DRAW COLOR .7,1,0
SET BUTTONS FONT SIZE 56*.rw
SET BUTTONS CUSTOM
IF .selected = 1 THEN
REM FILL COLOR .5,1,.5
FILL COLOR .7,.5,1
ELSE
REM FILL COLOR 0,.8,0
FILL COLOR .7,.5,0
END IF
IF n=1 THEN BUTTON n TEXT .bv$(n) AT 350*.rw,100*.rh SIZE 80*.rw,80*.rh
IF n=2 THEN BUTTON n TEXT .bv$(n) AT 270*.rw,210*.rh SIZE 80*.rw,80*.rh
IF n=3 THEN BUTTON n TEXT .bv$(n) AT 430*.rw,210*.rh SIZE 80*.rw,80*.rh
IF n=4 THEN BUTTON n TEXT .bv$(n) AT 190*.rw,320*.rh SIZE 80*.rw,80*.rh
IF n=5 THEN BUTTON n TEXT .bv$(n) AT 350*.rw,320*.rh SIZE 80*.rw,80*.rh
IF n=6 THEN BUTTON n TEXT .bv$(n) AT 510*.rw,320*.rh SIZE 80*.rw,80*.rh
IF n=7 THEN BUTTON n TEXT .bv$(n) AT 110*.rw,430*.rh SIZE 80*.rw,80*.rh
IF n=8 THEN BUTTON n TEXT .bv$(n) AT 270*.rw,430*.rh SIZE 80*.rw,80*.rh
IF n=9 THEN BUTTON n TEXT .bv$(n) AT 430*.rw,430*.rh SIZE 80*.rw,80*.rh
IF n=10 THEN BUTTON n TEXT .bv$(n) AT 590*.rw,430*.rh SIZE 80*.rw,80*.rh
IF n=11 THEN BUTTON n TEXT .bv$(n) AT 30*.rw,540*.rh SIZE 80*.rw,80*.rh
IF n=12 THEN BUTTON n TEXT .bv$(n) AT 190*.rw,540*.rh SIZE 80*.rw,80*.rh
IF n=13 THEN BUTTON n TEXT .bv$(n) AT 350*.rw,540*.rh SIZE 80*.rw,80*.rh
IF n=14 THEN BUTTON n TEXT .bv$(n) AT 510*.rw,540*.rh SIZE 80*.rw,80*.rh
IF n=15 THEN BUTTON n TEXT .bv$(n) AT 670*.rw,540*.rh SIZE 80*.rw,80*.rh
END DEF
'=================
DEF movesleft
'returns 1 if any moves left on board
m=0 'default to no moves left
'btn 1
IF .bv$(1)=.x$ AND .bv$(2)=.x$ AND .bv$(4)="" THEN m=1
IF .bv$(1)=.x$ AND .bv$(3)=.x$ AND .bv$(6)="" THEN m=1
'btn2
IF .bv$(2)=.x$ AND .bv$(4)=.x$ AND .bv$(7)="" THEN m=1
IF .bv$(2)=.x$ AND .bv$(5)=.x$ AND .bv$(9)="" THEN m=1
'btn 3
IF .bv$(3)=.x$ AND .bv$(5)=.x$ AND .bv$(8)="" THEN m=1
IF .bv$(3)=.x$ AND .bv$(6)=.x$ AND .bv$(10)="" THEN m=1
'btn 4
IF .bv$(4)=.x$ AND .bv$(2)=.x$ AND .bv$(1)="" THEN m=1
IF .bv$(4)=.x$ AND .bv$(5)=.x$ AND .bv$(6)="" THEN m=1
IF .bv$(4)=.x$ AND .bv$(7)=.x$ AND .bv$(11)="" THEN m=1
IF .bv$(4)=.x$ AND .bv$(8)=.x$ AND .bv$(13)="" THEN m=1
'btn 5
IF .bv$(5)=.x$ AND .bv$(8)=.x$ AND .bv$(12)="" THEN m=1
IF .bv$(5)=.x$ AND .bv$(9)=.x$ AND .bv$(14)="" THEN m=1
'btn 6
IF .bv$(6)=.x$ AND .bv$(3)=.x$ AND .bv$(1)="" THEN m=1
IF .bv$(6)=.x$ AND .bv$(9)=.x$ AND .bv$(13)="" THEN m=1
IF .bv$(6)=.x$ AND .bv$(5)=.x$ AND .bv$(4)="" THEN m=1
IF .bv$(6)=.x$ AND .bv$(10)=.x$ AND .bv$(15)="" THEN m=1
'btn 7
IF .bv$(7)=.x$ AND .bv$(4)=.x$ AND .bv$(2)="" THEN m=1
IF .bv$(7)=.x$ AND .bv$(8)=.x$ AND .bv$(9)="" THEN m=1
'btn 8
IF .bv$(8)=.x$ AND .bv$(5)=.x$ AND .bv$(3)="" THEN m=1
IF .bv$(8)=.x$ AND .bv$(9)=.x$ AND .bv$(10)="" THEN m=1
'btn 9
IF .bv$(9)=.x$ AND .bv$(5)=.x$ AND .bv$(2)="" THEN m=1
IF .bv$(9)=.x$ AND .bv$(8)=.x$ AND .bv$(7)="" THEN m=1
'btn 10
IF .bv$(10)=.x$ AND .bv$(9)=.x$ AND .bv$(8)="" THEN m=1
IF .bv$(10)=.x$ AND .bv$(6)=.x$ AND .bv$(3)="" THEN m=1
'btn 11
IF .bv$(11)=.x$ AND .bv$(7)=.x$ AND .bv$(4)="" THEN m=1
IF .bv$(11)=.x$ AND .bv$(12)=.x$ AND .bv$(13)="" THEN m=1
'btn 12
IF .bv$(12)=.x$ AND .bv$(8)=.x$ AND .bv$(5)="" THEN m=1
IF .bv$(12)=.x$ AND .bv$(13)=.x$ AND .bv$(14)="" THEN m=1
'btn 13
IF .bv$(13)=.x$ AND .bv$(8)=.x$ AND .bv$(4)="" THEN m=1
IF .bv$(13)=.x$ AND .bv$(9)=.x$ AND .bv$(6)="" THEN m=1
IF .bv$(13)=.x$ AND .bv$(14)=.x$ AND .bv$(15)="" THEN m=1
IF .bv$(13)=.x$ AND .bv$(12)=.x$ AND .bv$(11)="" THEN m=1
'btn 14
IF .bv$(14)=.x$ AND .bv$(9)=.x$ AND .bv$(5)="" THEN m=1
IF .bv$(14)=.x$ AND .bv$(13)=.x$ AND .bv$(12)="" THEN m=1
'btn 15
IF .bv$(15)=.x$ AND .bv$(10)=.x$ AND .bv$(6)="" THEN m=1
IF .bv$(15)=.x$ AND .bv$(14)=.x$ AND .bv$(13)="" THEN m=1
.movesleft=m
END DEF