Find the winner of a game of donating i candies in every i | Function to find the winning player in a game of donating i candies to opponent in i - th move ; Steps in which number of candies of player A finishes ; Steps in which number of candies of player B finishes ; If A 's candies finishes first ; Otherwise ; Candies possessed by player A ; Candies possessed by player B
function stepscount ( a , b ) { let chanceA = 2 * a - 1 ; ; let chanceB = 2 * b ; if ( chanceA < chanceB ) { document . write ( " " ) ; } else if ( chanceB < chanceA ) { document . write ( " " ) ; } return 0 ; } let A = 2 ; let B = 3 ; stepscount ( A , B ) ;