Created
          October 14, 2012 10:16 
        
      - 
      
- 
        Save svs/3888175 to your computer and use it in GitHub Desktop. 
    naive game controller
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | # POST /games/1/join_game {:id => <game_id>, :user_id => <player_id> } | |
| def join_game | |
| @game = Game.find(params[:id]) | |
| @game.players << User.find(:user_id) | |
| ... | |
| end | |
| # POST /games/1/leave_game {:id => <game_id>, :user_id => <player_id> } | |
| def leave_game | |
| @game = Game.find(params[:id]) | |
| @game.players -= User.find(:user_id) | |
| ... | |
| end | |
| # POST /games/1/make_move {:id => <game_id>, :move => {:user_id => <player_id>, :x => <x-coord>, :y => <y-coord>}} | |
| def make_move | |
| @game = Game.find(params[:id]) | |
| @game.add_move(params[:move]) | |
| end | |
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment