title: Coin Game Winner Every Player Three Choices
signature: func coinGameWinnerEveryPlayerThreeChoices(x int, y int, n int) bool {
test_code: package main
  
  import (
      "fmt"
      "reflect"
      "math"
      "sort"
  )
  
  // SOLUTION CODE
  // ===================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE
  // ===================================
  func validateSolution(actual bool, expected bool) bool {
      return reflect.DeepEqual(actual,expected)
  }
  
  func driver(x int, y int, n int, expected bool) string {
      if validateSolution(PLACEHOLDER_FN_NAME(x, y, n),expected) {
              return "PASSED"
      }
      return "FAILED"
  
  }
  
  func main() {
  
      // Use imports to avoid undefined errors
      var _ = reflect.DeepEqual
      _ = math.Abs
      _ = sort.Sort
      result := ""
      result = driver(6, 
  	27, 
  	51, false)
      fmt.Printf("TEST-0...%s\n", result)
      
      result = driver(32, 
  	88, 
  	69, true)
      fmt.Printf("TEST-1...%s\n", result)
      
      result = driver(99, 
  	18, 
  	48, false)
      fmt.Printf("TEST-2...%s\n", result)
      
      result = driver(22, 
  	1, 
  	74, true)
      fmt.Printf("TEST-3...%s\n", result)
      
      result = driver(26, 
  	78, 
  	95, false)
      fmt.Printf("TEST-4...%s\n", result)
      
      result = driver(67, 
  	51, 
  	27, true)
      fmt.Printf("TEST-5...%s\n", result)
      
      result = driver(69, 
  	57, 
  	91, true)
      fmt.Printf("TEST-6...%s\n", result)
      
      result = driver(39, 
  	8, 
  	9, false)
      fmt.Printf("TEST-7...%s\n", result)
      
      result = driver(7, 
  	82, 
  	41, true)
      fmt.Printf("TEST-8...%s\n", result)
      
      result = driver(91, 
  	56, 
  	7, true)
      fmt.Printf("TEST-9...%s\n", result)
      
          
  }
source_py: def coin_game_winner_every_player_three_choices(x, y, n):
      dp = [0 for i in range((n + 1))]
      dp[0] = False
      dp[1] = True
      for i in range(2, (n + 1)):
          if (((i - 1) >= 0) and (not dp[(i - 1)])):
              dp[i] = True
          elif (((i - x) >= 0) and (not dp[(i - x)])):
              dp[i] = True
          elif (((i - y) >= 0) and (not dp[(i - y)])):
              dp[i] = True
          else:
              dp[i] = False
      return dp[n]
source_cpp: bool coin_game_winner_every_player_three_choices(int x, int y, int n) {
    int dp [ n + 1 ];
    dp [ 0 ] = false;
    dp [ 1 ] = true;
    for ( int i = 2;
    i <= n;
    i ++ ) {
      if ( i - 1 >= 0 and ! dp [ i - 1 ] ) dp [ i ] = true;
      else if ( i - x >= 0 and ! dp [ i - x ] ) dp [ i ] = true;
      else if ( i - y >= 0 and ! dp [ i - y ] ) dp [ i ] = true;
      else dp [ i ] = false;
    }
    return dp [ n ];
  }