Frog Jump v1.1 - peg jump type puzzle game (iPad/iPhone)

DrChip
Posts: 167
Joined: Wed Oct 22, 2014 3:26 pm
My devices: iPhone 4 to 6+,iPad mini to iPad air 2

Re: Frog Jump v1.1 - peg jump type puzzle game (iPad/iPhone)

Post by DrChip »

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

Attachments
E32261FB-61F0-40A3-8AE8-67EC71D0A35B.png
E32261FB-61F0-40A3-8AE8-67EC71D0A35B.png (292.29 KiB) Viewed 3283 times

User avatar
Dav
Posts: 279
Joined: Tue Dec 30, 2014 5:12 pm
My devices: iPad Mini, iPod Touch.
Location: North Carolina, USA
Contact:

Re: Frog Jump v1.1 - peg jump type puzzle game (iPad/iPhone)

Post by Dav »

That looks good, and the messages center too. THanks DrChip for the fix.

-Dav

Henko
Posts: 814
Joined: Tue Apr 09, 2013 12:23 pm
My devices: iPhone,iPad
Windows
Location: Groningen, Netherlands
Flag: Netherlands

Re: Frog Jump v1.1 - peg jump type puzzle game (iPad/iPhone)

Post by Henko »

The original peg jump puzzle (iPad only). Try to leave only one peg in the centre hole.

Code: Select all

graphics ! graphics clear ! option base 1
set buttons font size 40 ! draw font size 30 ! draw color 0,0,0
dim t(7,7),ij(2)
for i=1 to 7 ! for j=1 to 7
  if but(i,j) then button i&j text "😑" at 90*j,90*i size 70,70
  t(i,j)=1 
  next j ! next i ! button "44" text "" ! t(4,4)=0 ! npeg=32
while 1
prep() ! if zero_moves() then draw text npeg & " pegs left" at 300,760
do ! get_but(ij) ! fi=ij(1) ! fj=ij(2) ! until t(fi,fj)>1
button fi&fj text "🤠"
do ! get_but(ij) ! ti=ij(1) ! tj=ij(2) ! until check(fi,fj,ti,tj)=1
if rnd(1)<.5 then button ri&rj text "😱" else button ri&rj text "😡"
t(fi,fj)=0 ! t(ri,rj)=0 ! t(ti,tj)=1 ! npeg-=1 ! pause .5
end while
end

def get_but(ab())
do slowdown
  for i=1 to 7 ! for j=1 to 7
  if button_pressed(i&j) then goto out
  next j ! next i
  until forever
out: ab(1)=i ! ab(2)=j
end def

def prep()
for i=1 to 7 ! for j=1 to 7
  if .t(i,j)=0 or not but(i,j) then go_on
  if .t(i,j)=2 then .t(i,j)=1
up:
  if (abs(j-4)<2 and i>2) or (abs(j-4)>1 and i=5) then
    if .t(i-1,j)>0 and .t(i-2,j)=0 then .t(i,j)=2
    end if
right:
  if (abs(i-4)<2 and j<6) or (abs(i-4)>1 and j=3) then
    if .t(i,j+1)>0 and .t(i,j+2)=0 then .t(i,j)=2
    end if
down:
  if (abs(j-4)<2 and i<6) or (abs(j-4)>1 and i=3) then
    if .t(i+1,j)>0 and .t(i+2,j)=0 then .t(i,j)=2
    end if
left:
  if (abs(i-4)<2 and j>2) or (abs(i-4)>1 and j=5) then
    if .t(i,j-1)>0 and .t(i,j-2)=0 then .t(i,j)=2
    end if
  if .t(i,j)=1 then button i&j text "😑"
  if .t(i,j)=2 then button i&j text "🤔"
go_on:
  if .t(i,j)=0 then button i&j text ""
  next j ! next i
end def

def but(a,b)
if abs((a-4)*(b-4))>3 then return 0 else return 1
end def

def check(fi,fj,ti,tj)
if .t(ti,tj)>0 then return 0
di=ti-fi ! dj=tj-fj ! if di=0 and dj=0 then return 0 
if di<>0 then
  if abs(di)<>2 or dj<>0 then return 0
  .ri=(fi+ti)/2 ! .rj=fj
  if .t(.ri,.rj)>0 then return 1
  end if
if dj<>0 then
  if abs(dj)<>2 or di<>0 then return 0
  .ri=fi ! .rj=(fj+tj)/2
  if .t(.ri,.rj)>0 then return 1
  end if
end def

def zero_moves()
for i=1 to 7 ! for j=1 to 7
  if .t(i,j)=2 then return 0
  next j ! next i
return 1
end def
IMG_1417.PNG
IMG_1417.PNG (1.57 MiB) Viewed 3261 times

User avatar
Dav
Posts: 279
Joined: Tue Dec 30, 2014 5:12 pm
My devices: iPad Mini, iPod Touch.
Location: North Carolina, USA
Contact:

Re: Frog Jump v1.1 - peg jump type puzzle game (iPad/iPhone)

Post by Dav »

Cool, Henko. We had to same idea. I just finished a classic peg solitaire game too and will post it momentarily. Your code is very tight and efficient! MIne sucks. :lol:

- Dav

User avatar
Dav
Posts: 279
Joined: Tue Dec 30, 2014 5:12 pm
My devices: iPad Mini, iPod Touch.
Location: North Carolina, USA
Contact:

Re: Frog Jump v1.1 - peg jump type puzzle game (iPad/iPhone)

Post by Dav »

Henko: The more I look at your code, it amazes me. SO much in small amount of code. Wow.

DrChip: I showed pophop to 4 people today. Three of them said it was cool and would buy pophop if it was in the App Store. . : :lol:

- Dav

User avatar
rbytes
Posts: 1338
Joined: Sun May 31, 2015 12:11 am
My devices: iPhone 11 Pro Max
iPad Pro 11
MacBook
Dell Inspiron laptop
CHUWI Plus 10 convertible Windows/Android tablet
Location: Calgary, Canada
Flag: Canada
Contact:

Re: Frog Jump v1.1 - peg jump type puzzle game (iPad/iPhone)

Post by rbytes »

Yes poop hop is very timely. The Emoji Movie now making the rounds has a major star playing the Poop Emoji. I wonder what he does to get in character. :lol:
The only thing that gets me down is gravity...

Post Reply