1. 18 Dec, 2016 3 commits
    • Terence Martin's avatar
      Fix AI bug · 1749dc5a
      Terence Martin authored
      During simulation of a drop, a vanished gray brick would count as a
      bonus brick and add points to the ball, even though in practice this
      is not a situation in which points are scored.
      
      As a result of this the AI would prioritize moves through vanished
      gray bricks over regular drops for no discernible reason.
      1749dc5a
    • Terence Martin's avatar
      Enhance Player entity movement API · 6e654caa
      Terence Martin authored
      This is how this should have been implemented originally, but I just
      threw a quick couple of functions together for expediency to try and
      get the change finished before the end of that devember day.
      
      This merges the methods for moving left and right to simple
      translation and updates the documentation comment on this and the
      jumpTo method to not suck.
      6e654caa
    • Terence Martin's avatar
      Add computer animations to Player entity · 97e5cc01
      Terence Martin authored
      This is a simple operation but allows us to support the computer
      player as well. This adds in the animations that are needed in order
      to display as the computer and a parameter in the contructor to
      specify which type of player to be.
      
      The code to select the appropriate animation was already set up to
      work as desired so no changes were needed.
      97e5cc01
  2. 17 Dec, 2016 10 commits
    • Terence Martin's avatar
      Implement simple AI tests · 29cbb3c8
      Terence Martin authored
      This just has the AI run to select a ball, then jump the player there
      and push it so we can see what happens.
      
      This updates the player to have a new test method for jumping to a
      specific location in the maze instead of just going left and right.
      29cbb3c8
    • Terence Martin's avatar
      Implement simple AI · 769484a9
      Terence Martin authored
      This just finds all pushable balls and then simulates them moving
      through the maze to see which one is best. This uses a simple metric
      of just which ball would score the most points at this exact second.
      769484a9
    • Terence Martin's avatar
      Get Maze ready for AI · ec9dcc28
      Terence Martin authored
      This creates some accessor methods for entering and exiting the
      simulation for all entities that require it, and exposes the method
      that calculates the next ball position so that outside code can see
      it.
      ec9dcc28
    • Terence Martin's avatar
      Implement simulation save/restore for Brick · d398dc3f
      Terence Martin authored
      For a bonus brick, we handle touches different. If we are not
      simulating, we do what we always did (only nicer; forgot to refactor
      some code).
      
      If we ARE simulating, we update the score in the ball that touched us
      to indicate that we actually were collected by this ball and then set
      a flag saying it happened so we won't do it again.
      d398dc3f
    • Terence Martin's avatar
      Implement simulation save/restore for Arrow · 06e11cbe
      Terence Martin authored
      For the arrow the only state we save is the direction we're pointing.
      This also updates the flip method to take a boolean that indicates if
      this flip is part of a simulation, so that it knows if it should
      change the visual orientation to match or not.
      
      Currently the simulation code does not invoke the update() method, so
      it is basically operating under the hope that an automatic arrow will
      be pointing the right direction when the ball gets there (same as a
      human).
      06e11cbe
    • Terence Martin's avatar
      Implement simulation save/restore for Ball · 8078c39a
      Terence Martin authored
      For the ball the only state we need to track is the position we were
      at before we were pushed (so we can go back there) and the score that
      is associated with this ball.
      
      Calling code is currently expected not to hide us visually if we're in
      a simulation.
      8078c39a
    • Terence Martin's avatar
      Implement core simulation save/restore · 7d1b3091
      Terence Martin authored
      This includes the new API methods for saving and restoring the state
      of a MazeEntity instance (non-visual only) so that we can perform a
      number of simulations in the AI selector without disturbing the actual
      game state.
      7d1b3091
    • Terence Martin's avatar
      Set up for AI; include simulation flag · 20c051e8
      Terence Martin authored
      In order to use our existing code for regular and AI purposes, we now
      are able to pass a parameter to the MazeCell methods that are
      responsible for touching and redirecting the ball, so that the method
      can tell for what purpose this is happening (regular or AI).
      
      The existing code invokes this with a parameter that indicates that
      this operation is a regular one so that everything happens as per
      usual.
      20c051e8
    • Terence Martin's avatar
      Fix incidental typos · a0ca9aab
      Terence Martin authored
      I noticed some rather egregious typos while researching what will be
      done  today, so I fixed them.
      
      Sorry, I just can't *not* fix that when I see it.
      a0ca9aab
    • Terence Martin's avatar
      Block addition of temporary todo lists · 563a8eca
      Terence Martin authored
      563a8eca
  3. 16 Dec, 2016 7 commits
    • Terence Martin's avatar
      Change game thumbnail · 4db6cb11
      Terence Martin authored
      4db6cb11
    • Terence Martin's avatar
      Put in ball pushing · 3ad57cee
      Terence Martin authored
      This adds a simple API to the Maze entity that allows the player to
      push the ball if it's facing downward, facing a ball, and a ball is
      not already dropping.
      3ad57cee
    • Terence Martin's avatar
      Include walking · f274dd58
      Terence Martin authored
      The Scene can now make the player walk left and right in the scene. If
      the player is not facing in the correct direction, it rotates to face
      the given direciton, otherwise it walks in that direction.
      
      The movement is constrained to the limits of the columns of the maze
      grid between the walls.
      f274dd58
    • Terence Martin's avatar
      Position player properly · e4d87f90
      Terence Martin authored
      Using the new API, we position the player above the first column in
      the maze.
      e4d87f90
    • Terence Martin's avatar
      Give Player entity a reference point · 9dddef01
      Terence Martin authored
      This adds a reference point property to the player entity, which it
      will use to update its position on screen.
      
      This is done in combination with its map posiition and this reference
      position so that we can easily shift the player around and still know
      what position it's in.
      9dddef01
    • Terence Martin's avatar
      Include a Player into the game · 74392e29
      Terence Martin authored
      This is currently crude, as the player remains stationary at the upper
      left corner, but it's enough to prove everything is working as
      expected.
      
      This uses the spacebar as the push key (which seems more natural), so
      the debug toggle key is now F12.
      74392e29
    • Terence Martin's avatar
      Include Player entity · 499a0bde
      Terence Martin authored
      This is the first crack at this. THe player can face a direction and
      push in all directions, and is capable of not running an action until
      its  current action is completed.
      499a0bde
  4. 15 Dec, 2016 12 commits
    • Terence Martin's avatar
      Clean up debugging calls · cf426ef5
      Terence Martin authored
      Shift the onus of checking to see if debugging is turned on or not
      from the calling class to the MazeDebugger class, which leaves without
      doing anything if debugging is not turned on.
      
      A boolean return tells you if anything was done or not, so that the
      Scene can eat keys as needed.
      cf426ef5
    • Terence Martin's avatar
      Shift debug flag to the debugger object · 1bcd5b79
      Terence Martin authored
      This moves the flag that says if the debugger is turned on or not into
      the debug object itself. This lengthens the code a bit but finishes the
      isolation.
      1bcd5b79
    • Terence Martin's avatar
      Refactor most debugging code into a new class · 272b499a
      Terence Martin authored
      This does for debugging what the previous commits did for the
      generation of the maze. This pulls all of the debug options out and
      puts them into their own class.
      
      This still needs a bit of work, si\nce the flag and a couple of other
      things are still held in the Maze.
      272b499a
    • Terence Martin's avatar
      Rearrange debug code a bit · 40494759
      Terence Martin authored
      This cleans up the debug code by moving one last function upwards to
      where it lives.
      40494759
    • Terence Martin's avatar
      Refactor Maze generation · f0224daa
      Terence Martin authored
      This shifts the code that generates the maze into its own class, which
      shortens up and clarifies the Maze code itself and also makes it
      easier to tweak generation in the future, since it will be self
      contained.
      f0224daa
    • Terence Martin's avatar
      Clarify ball dropping · 549186a3
      Terence Martin authored
      There were several places where code was being used to check if a cell
      in the maze was blocked or not. This has been factored out into the
      MazeContent class so that we can easily do it in one step.
      549186a3
    • Terence Martin's avatar
      Implement simple accessors for ActorPool access · 3d835944
      Terence Martin authored
      This simplifies the code marginally for the purposes of pulling an
      entity out of the associated ActorPool instance, but exposes a simple
      method for external code to be able to get at our entities so that the
      debug code can go away.
      3d835944
    • Terence Martin's avatar
      Remove the last of the instanceof uses · 5568b6a9
      Terence Martin authored
      This implements a new helper in the MazeContent entity that allows you
      to fetch the name of the entity at a given location with a built in
      null check.
      5568b6a9
    • Terence Martin's avatar
      Fix missing documentation in Teleport entity · e1e4797a
      Terence Martin authored
      All I can say is, whoops.
      e1e4797a
    • Terence Martin's avatar
      Remove almost all of the instanceof uses · 795e459e
      Terence Martin authored
      We now favor using the internal name of the entity, which for our
      purposes here is the name provided to the MazeCell constructor.
      
      ts-game-engine uses this for debugging so it's exposed, but it
      probably should be. This has been added to the new interface to
      remind us that it should be added along with everything else.
      795e459e
    • Terence Martin's avatar
      Add kill() method to MazeCell and new interface · b64b9a85
      Terence Martin authored
      In order to make code even clearer that wants to kill an entity based
      on its pool, add a kill() method directly to MazeCell that invokes the
      killEntity() method for us as a convenience.
      b64b9a85
    • Terence Martin's avatar
      Use new pool tracking for easier disposal · d0d9d641
      Terence Martin authored
      In order to make the code a little clearer in a few places, instead of
      having wordy code to select the appropriate pool for killing an
      entity, we can just use its pool directly.
      d0d9d641
  5. 14 Dec, 2016 5 commits
    • Terence Martin's avatar
      Add ActorPool tracking to MazeCell · 4fdee268
      Terence Martin authored
      This adds to ActorPool an interface that extends the Actor class and
      adds a single optional parameter named "pool" that is an ActorPool.
      The ActorPool generic description now says that it takes an object of
      this new interface, which means it works with any Actor which may
      optionally have such a  property.
      
      The MazeCell entity adds this property, which means that all
      subclasses get it as well.
      
      The idea here is that any entity that is stored in an ActorPool tracks
      its pool, which means that we can use any entity to remove it from the
      associated pool (if desired) without having to know what type of
      object that is is.
      
      This is defined in this manner (optional parameter) so that we don't
      have to update the Actor class in ts-game-engine to provide this
      property by default. This will happen when this class gets rolled into
      ts-game-engine.
      4fdee268
    • Terence Martin's avatar
      Create new MazeContent class · a277ce17
      Terence Martin authored
      This class wraps the maze contents and the operations for getting and
      setting cells and markers in it, removing that from the Maze itself.
      
      This cleans up the code and also allows us to  do something like pass
      the content easily as a get() property so that e.g. the scene that owns
      us can modify, which means we can also get a bunch of the debug code
      out of there as well.
      a277ce17
    • Terence Martin's avatar
      Alter drop speed for end of game · 28cef7d2
      Terence Martin authored
      The ball speed while dropping should be faster at the end of the game
      than it is while things are being played normally since there are
      conceivably many ball in this situation and we don't want it to take
      forever.
      28cef7d2
    • Terence Martin's avatar
      Refactor ball dropping code · fdc8455c
      Terence Martin authored
      Shift the code that sets up for a ball move to be in its own method so
      that it is not duplicated in multiple places, since we need to be able
      to do it manually and also automatically.
      fdc8455c
    • Terence Martin's avatar
      Drop balls automatically at game end · 6e64eb8c
      Terence Martin authored
      This new logic detects when all of the gray bricks have finished
      vanishing, and then one by one is selects balls from the maze and
      drops them one last time.
      
      The same drop code is used as for the regular drop, except that in
      this phase the ball is always vanished when it stops moving, even if
      it doesn't hit the goal line.
      
      We move balls from the bottom up so that every ball gets a fair chance
      to move through the maze without being blocked.
      6e64eb8c
  6. 13 Dec, 2016 3 commits
    • Terence Martin's avatar
      Clean up debug code a bit · 45e35481
      Terence Martin authored
      This is just some simple cleanup. Since bricks that are vanished out
      of the maze are reaped now, the code for unhiding them is no longer
      needed since it can't do anything anyway.
      
      This also removes the control from the scene and the documentation.
      
      There are a couple of smaller changes as well in a similar vein.
      45e35481
    • Terence Martin's avatar
      Rearrange method in Maze entity · 61538a2a
      Terence Martin authored
      Shift the setDimensions() method to be under the constructor, since it
      is now responsible for kicking off the level generation that happens
      almost but not quite at construction time.
      61538a2a
    • Terence Martin's avatar
      Implement move tracking and gray brick removal · 18716469
      Terence Martin authored
      Every time a ball has finished moving and either come to rest or
      finished vanishing away, we check to see if there are any balls still
      left to play.
      
      If there are none, we tell all of the gray bricks to vanish. Once this
      happens any balls that move and come to a rest no longer perform this
      check.
      
      All that is left now is to perform the loop whereby we start at the
      bottom right side of the grid and slowly iterate back up and left
      dropping balls and vanishing them when they come to rest, which would
      signal the end of the round.
      18716469