if it is player 1 's turn then  current picked score added to  his total. choose maximum of  the two scores as P1 tries to  maximize his score.
if ( money [ beg ] + scoreOne . first > money [ ed ] + scoreTwo . first ) { return { money [ beg ] + scoreOne . first , " L " + scoreOne . second } ; } else return { money [ ed ] + scoreTwo . first , " R " + scoreTwo . second } ; }