test/games/cheese_game.rb
# a game must implement these  functions
a game must implement these  functions
a game must implement these functions
def gameloop
    move = get_input 
    if move == :left
      @player_position = @player_position > 0 ? @player_position-1 : @map_size-1;
    elsif move == :right
      @player_position = @player_position < @map_size-1 ? @player_position+1 : 0;
    end
    if @player_position == @cheese_x
      @score += 1
      @player_position = @start_position
    end
    if @player_position == @pit_x
      @score -= 1
       @player_position = @start_position
    end
  end
def gameloop move = get_input if move == :left @player_position = @player_position > 0 ? @player_position - 1 : @map_size - 1 ; elsif move == :right @player_position = @player_position < @map_size - 1 ? @player_position + 1 : 0 ; end if @player_position == @cheese_x @score += 1 @player_position = @start_position end if @player_position == @pit_x @score -= 1 @player_position = @start_position end end
a game must implement these  functions
a game must implement these functions