[BOARD]    
image=frogsbackground.png

[REALBOARD ELEMENT TYPES]
name=greenFrog
state=1
hueMin=71
hueMax=192
saturationMin=0.27
saturationMax=1.0
valueMin=0.09
valueMax=0.9
sizeMin=200
sizeMax=5000

name=redFrog
hueMin=337
hueMax=19
saturationMin=0.44
saturationMax=1.0
valueMin=0.28
valueMax=1.0
sizeMin=200
sizeMax=5000

[ELEMENT TYPES]
name=greenFrog
states=1
image=greenFrog.png
point=1,1

name=redFrog
states=1
image=redFrog.png
point=1,1

[LOCATION TYPES]
name=stone
image=stone.png
shape=circle(30)
point=1,1

[LOCATIONS]
name=s(1)
type=stone
point=40,250
camera=20,135
robot=-9,20,0

name=s(2)
type=stone
point=130,250
camera=110,135
robot=-6,20,0

name=s(3)
type=stone
point=220,250
camera=203,135
robot=-3,20,0

name=s(4)
type=stone
point=310,250
camera=297,135
robot=0,20,0

name=s(5)
type=stone
point=400,250
camera=385,135
robot=3,20,0

name=s(6)
type=stone
point=490,250
camera=473,135
robot=6,20,0

name=s(7)
type=stone
point=580,250
camera=576,135
robot=9,20,0

[PLAYER NAMES]
1=p1

[MOVABLE ELEMENTS]

name=gf(1)
type=greenFrog
player=1
location=s(1)

name=gf(2)
type=greenFrog
player=1
location=s(2)

name=gf(3)
type=greenFrog
player=1
location=s(3)

name=rf(1)
type=redFrog
player=1
location=s(5)

name=rf(2)
type=redFrog
player=1
location=s(6)

name=rf(3)
type=redFrog
player=1
location=s(7)

[EXPRESSIONS]

FrogsAtHome
  FORALL($J,1,3,ELTYPE(CONTENT("s($J)")) == "redFrog")  
  FORALL($J,5,7,ELTYPE(CONTENT("s($J)")) == "greenFrog")
END

StoneOccupied($POS)
  $POS > 0
  $POS <= 7
  NOT EMPTY("s($POS)")
END

MoveAvailable($TO)
	$TO > 0
	$TO <= 7
	EMPTY("s($TO)")
END

GetPossibleMovesGreenFrog($POS)
	$POSSIBLEMOVES = {}	
	$STEPPOS = ($POS + 1)
	$JUMPPOS = ($POS + 2)
	IF(StoneOccupied($POS+1) AND MoveAvailable($JUMPPOS), $POSSIBLEMOVES = $POSSIBLEMOVES UNION {"s($JUMPPOS)"}, true)
	IF(MoveAvailable($STEPPOS), $POSSIBLEMOVES = $POSSIBLEMOVES UNION {"s($STEPPOS)"}, true)
	$POSSIBLEMOVES
END

GetPossibleMovesRedFrog($POS)
	$POSSIBLEMOVES = {}	
	$STEPPOS = ($POS - 1)
	$JUMPPOS = ($POS - 2)
	IF(StoneOccupied($POS-1) AND MoveAvailable($JUMPPOS), $POSSIBLEMOVES = $POSSIBLEMOVES UNION {"s($JUMPPOS)"}, true)
	IF(MoveAvailable($STEPPOS), $POSSIBLEMOVES = $POSSIBLEMOVES UNION {"s($STEPPOS)"}, true)
	$POSSIBLEMOVES
END

[SCORINGS]

[END OF GAME]
situation=FrogsAtHome
winner=1

[GAME RULES]

name=greenFrogMove
element=gf($J)
from=s($K)
to=s($L)
toLocations=GetPossibleMovesGreenFrog($K)
condition=true

name=redFrogMove
element=rf($J)
from=s($K)
to=s($L)
toLocations=GetPossibleMovesRedFrog($K)
condition=true
