about | help | code help+videos | done | prefs |
Yoda has asked you to write a method to determine who will win a light saber battle. Two players will enter a simulated battle. Each player will have an attack and defense value. Each player's attack value decreases the other player's defense value. The player with the higher remaining defense value wins. Return 1 if player 1 wins, 2 if player 2 wins, or 0 if there is a tie. yodaLightSaber(5, 7, 1, 8) → 1 yodaLightSaber(3, 12, 4, 11) → 0 yodaLightSaber(5, 10, 3, 20) → 2 ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 230
Copyright Nick Parlante 2017 - privacy