title: syntax error, unexpected keyword_end, expecting $end
body: <p>i am just starting my journey with ruby and am very new to programming in general as well. This is code for a homework assignment. I am getting syntax error as described in title. I understand that I have added some extra end while end of file was expected? right?
  but where is this extra "end".</p>
  
  <p>The code:</p>
  
  <pre><code>class WrongNumberOfPlayersError &lt; StandardError ; end
  class NoSuchStrategyError &lt; StandardError ; end
  
  def rps_result(move1,move2)
  
    if (move1 == "r" &amp;&amp; move2 == "s") || (move1 == "s" &amp;&amp; move2 == p) || (move1 == "p" &amp;&amp; move2 == "r")
      return true 
    else 
      return false
    end
  </code></pre>
  
  <p>end</p>
  
  <pre><code>  def rps_game_winner(player1, player2)    
      strategy = /[rps]/
      raise NoSuchStrategyError unless (move1 =~ strategy) &amp; (move2 =~ strategy) 
  
      move1 = player1[1].downcase
      move2 = player2[2].downcase
  
      rps_result(move1, move2)? player1 : player2
    end
  end
  
  def rps_tournament_winner(game)
    round_winners = []
  
    if game.length &lt; 2
      raise WrongNumberOfPlayersError
    else
      game.each_slice(2) do
        |l1 , l2|
        round_winners &lt;&lt; rps_game_winner(l1, l2)
      end
  
      rps_tournament_winner(round_winners) 
    end
  end
  
  rps_tournament_winner([[[["Richard", "S"], ["Dave", "S"]], [["Richard", "R"], ["Michael", "S"]]], [[["Allen", "S"], ["Omer", "P"]], [["David E.", "R"], ["Richard X.", "P"]]]])
  </code></pre>