rem YNIBBLES
rem
rem Author:
rem  Unknown
rem
rem Updater: Jacob Busby (Jacob.Busby@hants.gov.uk)
rem
rem Notes:
rem  Original version came on demo disk
rem  Based on QBASIC NIBBLES/NOKIA SNAKE
rem  Interesting footnote: Has been used in marraige 
rem   preparation advice.
rem
rem Known bugs/ineficiencies:
rem
rem  Messy code because I have no way to print this 
rem  listing.
rem
rem  Occasionally worms can cross over.
rem
rem Change History
rem
rem 12/03/01 Initial development complete
rem 12/03/01 Removed inverse move bug
rem 12/03/01 Added Warp Gates
rem 12/03/01 Designed some new levels
rem 03/05/01 Decided to try shipping things out to 
rem          subroutines, so I can write a 2 player 
rem          version.
rem 05/05/01 Defined global variables in CAPS
rem 05/05/01 Added PLAYERS and started adding these to
rem          variables and subroutines.
rem 06/05/01 Two player mode working now. Still need to
rem          fix "left-behind" bug.
rem 06/05/01 "Left-behind" bug fixed. Still to do: 
rem          Scores, lives and new levels.
rem 06/05/01 Lives and scores now done. Added GROWBYTARGET
rem          option for a tougher game. Still to do: Move
rem          PS2 keys to Global Variables, add warp gates
rem          as boolean and rem code.
rem 08/05/01 Made warp gates boolean. Added a new level.
rem          Might want to remove GROWBYTARGET and work
rem          on an infinite levels basis, with growth 
rem          getting progressively more difficult, as
rem          the game progresses. Added global variables
rem          for PS2 controllers.
rem 09/05/01 We now have five repeating levels that get
rem          more difficult due to worm growth. All to do
rem          now is improve comments and debug.
rem 13/06/01 Surviving worm now gets bonus ponts equal to
rem          level squared times lives left.
rem 08/07/01 Changed program name to YNIBBLES.
rem 17/08/01 Changed colour of scores so you can tell
rem          which player is which.
rem 13/09/01 changed level bonus to life squared times 
rem          level. Gave players an extra life when
rem          level bonus is awarded.

rem Sanity variables

TRUE = 1
FALSE = 0

rem PS2 controller variables

EX = 16384
OH = 8192
UP = 16
DOWN = 64
LEFT = 128
RIGHT = 32

rem Screen variables

GRIDHEIGHT = 16
GRIDWIDTH = 27
SQUARESIZE = 20

rem Game variables.
rem
rem Change these variables to alter various aspects of the
rem game. The variables are as follows:
rem
rem  MAXLEVELS - The maximum number of levels before the 
rem              game repeats itself. You can add new 
rem              levels in the data section of the code.
rem  MAXWORMSIZE - The maximum size each worm can grow to.
rem  PLAYERS - The number of players (1-2)
rem  SPEED - The speed at which the game is played.
rem  STARTLIVES - The number of lives each worm starts 
rem               with.
rem  STARTWORMGROWTH - The initial growth rate when a worm
rem                    obtains a number. This increases by
rem                    one each time the game goes "round
rem                    the clock.
rem  WARPGATES - TRUE means warp gates are in use, FALSE
rem              means that they aren't.  

MAXLEVELS = 5
MAXWORMSIZE = 100
PLAYERS = 2
SPEED = 0.09
STARTLIVES = 5
STARTWORMGROWTH = 2
STARTWORMLENGTH = 4
WARPGATES = TRUE

rem OK. Let's play.

Main()

rem ------------------------------------------------------
rem ------------------------------------------------------

sub Main()

  FirstRun = TRUE  
  while (TRUE = TRUE)
    Set_Up()
    if FirstRun = TRUE then
      Intro()
      FirstRun = FALSE
    fi
    Play_Game()
  wend

end sub

rem ------------------------------------------------------
rem ------------------------------------------------------

sub Play_Game()

  GameOver = FALSE
  restore level1
  levelNum = 1
  Start_New_Level()

end sub

rem ------------------------------------------------------
rem ------------------------------------------------------

sub Start_New_Level()

  StartNewLevel = TRUE
  while (GameOver = FALSE)
    if StartNewLevel = TRUE then
      Read_Level_Data_Into_Grid()
    fi
    Draw_Level()
    Create_New_Worm(player)
    goalNum = 0
    Get_New_Goal()
    Game_Loop()
  wend

end sub

rem ------------------------------------------------------
rem ------------------------------------------------------

sub Game_Loop()

  StartNewLevel = FALSE
  RestartLevel = FALSE
  while (GameOver = FALSE and StartNewLevel = FALSE and RestartLevel = FALSE)
    Determine_Direction_Change()
    Evaluate_Strikes()
    if GameOver = FALSE then
      Update_Worm()
    fi
    wait SPEED
  wend
  Clean_Grid()

end sub

rem ------------------------------------------------------
rem Clean_Grid
rem
rem This subroutine cleans the grid by restoring all the
rem grid values to their initial status. 
rem ------------------------------------------------------

sub Clean_Grid()

  for player = 1 to PLAYERS
    for segment = 1 to wormLength(player)
      segX = worm(player,segment,1)
      segY = worm(player,segment,2)
      grid(segY,segX) = initgrid(segY,segX)
    next segment
  next player
  grid(goalY, goalX) = 0

end sub

rem ------------------------------------------------------
rem Read_Level_Data_Into_Grid()
rem 
rem This subroutine takes the variables from the data
rem section and feeds them into the grid array.
rem ------------------------------------------------------

sub Read_Level_Data_Into_Grid()

  for h = 1 to GRIDHEIGHT
    for w = 1 to GRIDWIDTH
      read grid(h, w)
      if WARPGATES = FALSE then
        if h = 1 or h = GRIDHEIGHT or w = 1 or w = GRIDWIDTH then
          grid(h, w) = 1
        fi
      fi
      initgrid(h, w) = grid(h, w)
    next w
  next h

end sub

rem ------------------------------------------------------
rem Create_New_Worm
rem
rem This routine sets up the new worms for each player.
rem ------------------------------------------------------

sub Create_New_Worm(player)

  for player = 1 to PLAYERS
    wormLength(player) = 1
    worm(1,1,1) = 2
    if PLAYERS = 2 then    
      worm(2,1,1) = GRIDWIDTH - 1
    fi
    if player = 1 then
      worm(1, 1, 2) = int(GRIDHEIGHT/2)
    else
      worm(2, 1, 2) = int(GRIDHEIGHT/2) + 1
    fi
    grid(worm(player, 1, 2), worm(player, 1, 1)) = 1
    if player = 1 then
      dirx(player,1) = 1
    else 
      dirx(player,1) = -1
    fi
    diry(player,1) = 0
    maxWormLength(player) = STARTWORMLENGTH
  next player

end sub

rem ------------------------------------------------------
rem Determine_Direction_Change
rem
rem This routine reads the input from the joypads and 
rem adjusts the worms direction accordingly.
rem ------------------------------------------------------
 
sub Determine_Direction_Change()

  for player = 1 to PLAYERS
    dirx(player,2) = dirx(player,1)
    diry(player,2) = diry(player,1)
    if player = 1 then
      k = peek("port1")
    else
      k = peek("port2")
    fi
    if and(k, DOWN) <> 0 then
      dirx(player,1) = 0
      diry(player,1) = 1
      if diry(player,2) = -1 then
        diry(player,1) = -1 
      fi
    elsif and(k, UP) <> 0 then
      dirx(player,1) = 0
      diry(player,1) = -1
      if diry(player,2) = 1 then
        diry(player,1) = 1 
      fi
    elsif and(k, LEFT) <> 0 then
      dirx(player,1) = -1
      diry(player,1) = 0
      if dirx(player,2) = 1 then
        dirx(player,1) = 1 
      fi
    elsif and(k, RIGHT) <> 0 then
      dirx(player,1) = 1
      diry(player,1) = 0
      if dirx(player,2) = -1 then
        dirx(player,1) = -1 
      fi
    fi  

    newHeadX(player) = worm(player, 1, 1) + dirx(player,1)
    newHeadY(player) = worm(player, 1, 2) + diry(player,1)

    rem This section handles the warp-gates.

    if newHeadX(player) = 0 then
      newHeadX(player) = GRIDWIDTH
    elsif newHeadX(player) > GRIDWIDTH then
      newHeadX(player) = 1
    fi
    if newHeadY(player) = 0 then
      newHeadY(player) = GRIDHEIGHT
    elsif newHeadY(player) > GRIDHEIGHT then
      newHeadY(player) = 1
    fi
  next player

end sub

rem ------------------------------------------------------
rem Evaluate_Strikes
rem
rem This subroutine works out any crashes - into walls,
rem other worms or values.
rem ------------------------------------------------------

sub Evaluate_Strikes()

  for player = 1 to PLAYERS
    hit = grid(newHeadY(player), newHeadX(player))

rem If hit = 1 then the worm crashed into a wall or
rem itself.

    if hit = 1 then
      setrgb 1, 255, 0, 255
      lives(player) = lives(player) - 1
      if lives(player) = 0 then
        GameOver = TRUE

rem Give the surviving worm extra points equal to level
rem squared times lives left.

        if (player = 1 and PLAYERS = 2) then
          score(2) = score(2) + (levelNum * lives(2) * lives(2))
          Update_Text()
        elsif (player = 2 and PLAYERS = 2) then
          score(1) = score(1) + (levelNum * lives(1) * lives(1))
          Update_Text()
        fi
        text 20, (GRIDHEIGHT + 3) * SQUARESIZE, "GAME OVER! Press O to start again."
        Wait_For_Key(OH)
      else
        text 20, (GRIDHEIGHT + 3) * SQUARESIZE, "Crash!!! Press X to start again."
        Wait_For_Key(EX)
        RestartLevel = TRUE
      fi
    fi

rem If hit = 2 then the worm capture a value.

    if hit = 2 then
      maxWormLength(player) = maxWormLength(player) + WormGrowth
      if maxWormLength(player) > MAXWORMSIZE then 
        maxWormLength(player) = MAXWORMSIZE
      fi
      score(player) = score(player) + goalNum
      Update_Text()
      if goalNum = 9 then
        setrgb 1, 255, 0, 255
        if mod(levelNum, MAXLEVELS) = 0 then
          text 20, (GRIDHEIGHT + 3) * SQUARESIZE, "BONUS POINTS!!! Press X to continue."
          score(1) = score(1) + (levelNum * 10)
          lives(1) = lives(1) + 1
          if PLAYERS = 2 then
            score(2) = score(2) + (levelNum * 10)
            lives(2) = lives(2) + 1
          fi
          restore level1
          levelNum = levelNum + 1
          WormGrowth = WormGrowth + 1
          StartNewLevel = TRUE
          Wait_For_Key(EX)
        else
          text 20, (GRIDHEIGHT + 3) * SQUARESIZE, "Finished Level " + str$(levelNum) + "!!! Press X to begin next level."
          Wait_For_Key(EX)
          levelNum = levelNum + 1
          StartNewLevel = TRUE
        fi
      else
        Get_New_Goal()
      fi
    fi
  next player

end sub

rem ------------------------------------------------------
rem Update_Worm
rem
rem This routine updates the worms position, and, if 
rem necessary, lets the worm grow.
rem ------------------------------------------------------

sub Update_Worm()

  for player = 1 to PLAYERS

  rem This section makes the worm "grow"

    if wormLength(player) = maxWormLength(player) then
      grid(worm(player, wormLength(player), 2), worm(player,wormLength(player),1)) = 0
      clear fill rectangle (worm(player,wormLength(player),1)-1) * SQUARESIZE, (worm(player,wormLength(player),2)-1) * SQUARESIZE to worm(player,wormLength(player),1) * SQUARESIZE, worm(player,wormLength(player),2) * SQUARESIZE
    else
      wormLength(player) = wormLength(player) + 1
    fi

rem This section shows where the worms tail has been.

    for w = wormLength(player) to 2 step -1
      worm(player,w,1) = worm(player,w-1,1)
      worm(player,w,2) = worm(player,w-1,2)
    next

rem This section draws the new worm head.

    worm(player, 1, 1) = newHeadX(player)
    worm(player, 1, 2) = newHeadY(player)
    grid(worm(player, 1, 2), worm(player, 1, 1)) = 1
    if player = 1 then
      setrgb 1, 0, 0, 255
    else
      setrgb 1, 255, 0, 0
    fi
    fill rectangle (worm(player,1,1)-1) * SQUARESIZE, (worm(player,1,2)-1) * SQUARESIZE to worm(player,1,1) * SQUARESIZE, worm(player,1,2) * SQUARESIZE
  next player

end sub

rem ------------------------------------------------------
rem Draw_Level
rem
rem This routine uses the data in the grid array to draw 
rem the current level.
rem ------------------------------------------------------

sub Draw_Level()

  clear window
  scry = 0
  setrgb 1, 0, 255, 0
  for h = 1 to GRIDHEIGHT
    scrx = 0
    for w = 1 to GRIDWIDTH
      if grid(h, w) <> 0 then
        fill rectangle scrx, scry to scrx + SQUARESIZE, scry + SQUARESIZE
      fi
      scrx = scrx + SQUARESIZE
    next w
    scry = scry + SQUARESIZE
  next h
  Update_Text()

end sub

rem ------------------------------------------------------
rem Update_Text
rem
rem This routine updates the text in relation to levels,
rem lives and scores.
rem ------------------------------------------------------

sub Update_Text()

  clear fill rectangle 0, ((GRIDHEIGHT + 4) * SQUARESIZE) to ((GRIDWIDTH + 1) * SQUARESIZE), ((GRIDHEIGHT + 8) * SQUARESIZE)
  setrgb 1, 255, 255, 255
  text 20, (GRIDHEIGHT + 5) * SQUARESIZE, "Level " + str$(levelNum)
  text 20, (GRIDHEIGHT + 6) * SQUARESIZE, "Score"
  text 20, (GRIDHEIGHT + 7) * SQUARESIZE, "Lives"
  setrgb 1, 0, 64, 255
  text 80, (GRIDHEIGHT + 6) * SQUARESIZE, str$(score(1))
  text 80, (GRIDHEIGHT + 7) * SQUARESIZE, str$(lives(1))
  if PLAYERS = 2 then
    setrgb 1, 255, 0, 0
    text ((GRIDWIDTH * SQUARESIZE)- 20), (GRIDHEIGHT + 6) * SQUARESIZE, str$(score(2))
    text ((GRIDWIDTH * SQUARESIZE) - 20), (GRIDHEIGHT + 7) * SQUARESIZE, str$(lives(2))
  fi
  
end sub

rem ------------------------------------------------------
rem sub Get_New_Goal()
rem
rem This routine randomly generates new goal number 
rem locations.
rem ------------------------------------------------------

sub Get_New_Goal()

  goalNum = goalNum + 1
  label getRandomGoal
  goalX = 1 + int(ran(GRIDWIDTH))
  goalY = 1 + int(ran(GRIDHEIGHT))

  if grid(goalY, goalX) <> 0 then
    goto getRandomGoal
  fi
  grid(goalY, goalX) = 2
  setrgb 1, 255, 255, 0
  text (goalX - 1) * SQUARESIZE, goalY * SQUARESIZE - 4, str$(goalNum)

end sub

rem *** ADMINISTRATION ROUTINES ***

rem ------------------------------------------------------
rem ------------------------------------------------------

sub Set_Up()

  close window
  open window 640, 512
  dim grid(GRIDHEIGHT, GRIDWIDTH)
  dim initgrid(GRIDHEIGHT, GRIDWIDTH)

rem Worm
rem  1: Which player
rem  2: Worm segment
rem  3: X co-ordinate (1), Y co-ordinate (2)

  dim worm(PLAYERS,MAXWORMSIZE,2)

rem dirx
rem  1: Which player
rem  2: Current direction(1), Previous direction(2)

  dim dirx(PLAYERS,2)
  dim diry(PLAYERS,2)
  dim newHeadX(PLAYERS)
  dim newHeadY(PLAYERS)
  dim wormLength(PLAYERS)
  dim maxWormLength(PLAYERS)

  dim score(PLAYERS)
  dim lives(PLAYERS)

  for player = 1 to PLAYERS
    lives(player) = STARTLIVES
    score(player) = 0
  next player

  PlayerWhoDied = 0
  WormGrowth = STARTWORMGROWTH

end sub

rem ------------------------------------------------------
rem Intro
rem ------------------------------------------------------

sub Intro()

  clear window
  setrgb 1, 255, 255, 255
  text 10, 100, "Guide your worm using the directional pad to collect the" + chr$(10) + "numbers before your opponent does."

  text 10, 150, "You are not allowed to crash into the walls, your" + chr$(10) + "opponent or yourself!!"

  text 10, 200, "Press X to start."
  Wait_For_Key(EX)
  clear window

end sub

rem ------------------------------------------------------
rem Wait_For_Key(KeyNeeded)
rem ------------------------------------------------------

sub Wait_For_Key(KeyNeeded)

  KeyPress1 = peek("port1")
  KeyPress2 = peek("port2")
  while (KeyPress1 <> KeyNeeded and KeyPress2 <> KeyNeeded) 
    KeyPress1 = peek("port1")
    KeyPress2 = peek("port2")
    wait 0.05
  wend

end sub

rem *** DATA ***

rem ------------------------------------------------------
rem ------------------------------------------------------

label level1
data 1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1
data 1,0,0,0,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1,1,1,0,0,1
rem data 0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0
rem data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1
rem data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
rem data 1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1








