# Task
Two players - `"black"` and `"white"` are playing a game. The game consists of several rounds. If a player wins in a round, he is to move again during the next round. If a player loses a round, it's the other player who moves on the next round. Given whose turn it was on the previous round and whether he won, determine whose turn it is on the next round.



# Input/Output


`[input]` string `lastPlayer`/`$last_player`

`"black"` or `"white"` - whose move it was during the previous round.

`[input]` boolean `win`/`$win`

`true` if the player who made a move during the previous round won, `false` otherwise.

`[output]` a string

Return `"white"` if white is to move on the next round, and `"black"` otherwise.

# Example

For `lastPlayer = "black" and win = false`, the output should be `"white"`.

For `lastPlayer = "white" and win = true`, the output should be `"white"`.

Difficulty: EASY
Starter code: def whoseMove(lastPlayer, win):
	

Solutions:
def whoseMove(lastPlayer, win):
	return lastPlayer if win else 'white' if lastPlayer == 'black' else 'black'


def whoseMove(lastPlayer, win):
	players = ['white', 'black']
	return lastPlayer if win else players[players.index(lastPlayer) - 1]


def whoseMove(lastPlayer, win):
	return ['white', 'black'][(lastPlayer == 'black') == win]


def whoseMove(lastPlayer, win):
	if lastPlayer == 'black':
		if win == True:
			return 'black'
		else:
			return 'white'
	elif win == True:
		return 'white'
	else:
		return 'black'


def whoseMove(lastPlayer, win):
	return {'white', 'black'}.difference({lastPlayer}).pop() if not win else lastPlayer


def whoseMove(lastPlayer, win):
	if lastPlayer == 'black':
		return ['black', 'white'][not win]
	return ['black', 'white'][win]


def whoseMove(lastPlayer, win):
	if lastPlayer == 'black' and win:
		return 'black'
	elif lastPlayer == 'white' and win:
		return 'white'
	elif lastPlayer == 'white' and (not win):
		return 'black'
	return 'white'


def whoseMove(lastPlayer, win):
	op = ['black', 'white']
	op.remove(lastPlayer)
	return lastPlayer if win else op[0]


whoseMove = lambda s, b: s if b else 'white' if s == 'black' else 'black'


whoseMove = lambda l, w, a=['black', 'white']: a[[not w, w][a.index(l)]]


def whoseMove(lastPlayer, win):
	return {'black': 'white', 'white': 'black'}.get(lastPlayer) if not win else lastPlayer


def whoseMove(last_player: str, win: bool) -> str:
	return ['white', 'black'][any([all([last_player == 'black', win is True]), all([last_player == 'white', win is False])])]


whoseMove = lambda b, w: 'bwlhaictke'[(b < 'w') + w & 1::2]


def whoseMove(lastPlayer, win):
	lib = {'white': 'black', 'black': 'white'}
	return lastPlayer if win == True else lib[lastPlayer]


from itertools import cycle, dropwhile, islice
whoseMove = lambda last, win: next(islice(dropwhile(last.__eq__, cycle(('black', 'white'))), win, win + 1))


def whoseMove(p, win):
	return p if win else ['white', 'black'][p == 'white']


def whoseMove(lastPlayer, win):
	players = 'blackwhite'
	if win:
		result = lastPlayer
	else:
		result = players.replace(lastPlayer, '')
	return result


from itertools import cycle, dropwhile, islice

def whoseMove(lastPlayer, win):
	order = dropwhile(lastPlayer.__eq__, cycle(('black', 'white')))
	return win and lastPlayer or next(order)


def whoseMove(lastPlayer, win):
	return ('white', 'black')[win ^ lastPlayer.startswith('w')]


def whoseMove(x, y, b='black', w='white'):
	return x if y else w if x == b else b


def whoseMove(lastPlayer, win):
	return 'black' if lastPlayer == 'black' and win or (lastPlayer == 'white' and (not win)) else 'white'


def whoseMove(lastPlayer, win):
	return lastPlayer if win else [n for n in ['black', 'white'] if n != lastPlayer][0]


def whoseMove(lastPlayer, win):
	d = {'black': 'white', 'white': 'black'}
	return lastPlayer if win else d.get(lastPlayer)


whoseMove = lambda l, w: 'bwlhaictke'[(l[0] == 'b') != w::2]


def whoseMove(p, win):
	return 'white' if p == 'white' and win or (p == 'black' and (not win)) else 'black'


opposite = {'white': 'black', 'black': 'white'}

def whoseMove(last, win):
	return last if win else opposite[last]


def whoseMove(lp, win):
	if win:
		return lp
	else:
		return [i for i in ['black', 'white'] if i not in lp][0]


def whoseMove(lastPlayer, win):
	l = ['black', 'white']
	return lastPlayer if win else l[l.index(lastPlayer) - 1]


def whoseMove(last_player, win):
	other = 'black' if last_player == 'white' else 'white'
	return last_player if win else other


def whoseMove(lastPlayer, win):
	if win == False:
		return {'white': 'black', 'black': 'white'}[lastPlayer]
	if win == True:
		return lastPlayer


def whoseMove(lastPlayer, win):
	return lastPlayer if win else list({'black', 'white'} - {lastPlayer})[0]


whoseMove = lambda lp, win: {True: 'white', False: 'black'}[(lp == 'black') ^ win]


def whoseMove(lastPlayer, win):
	if win:
		return lastPlayer
	elif not win:
		if lastPlayer == 'black':
			return 'white'
		else:
			return 'black'


def whoseMove(p, n):
	return p if n else 'black' if p == 'white' else 'white'


def whoseMove(lastPlayer, win):
	lose = {'white': 'black', 'black': 'white'}
	return lastPlayer if win else lose.get(lastPlayer)


def whoseMove(lp, abool):
	if lp == 'black':
		if abool == True:
			ansr = 'black'
		else:
			ansr = 'white'
	if lp == 'white':
		if abool == True:
			ansr = 'white'
		else:
			ansr = 'black'
	return ansr


def whoseMove(lastPlayer, win):
	a = ['black', 'white']
	return lastPlayer if win else a[(a.index(lastPlayer) + 1) % 2]


def whoseMove(lastPlayer, win):
	if win == True:
		return lastPlayer
	elif lastPlayer == 'white' and win == False:
		return 'black'
	elif lastPlayer == 'black' and win == False:
		return 'white'


def whoseMove(lp, w):
	if lp == 'white' and w == True or (lp == 'black' and w == False):
		return 'white'
	return 'black'


whoseMove = lambda l, w: l if w else ''.join([chr(x ^ y) for (x, y) in zip([21, 4, 8, 23, 14], l.encode())])


whoseMove = lambda l, w: ['black', 'white'][((l[0] == 'w') + 1 - w) % 2]


def whoseMove(last, win):
	if win == True:
		return last
	else:
		return 'black' if last == 'white' else 'white'


def whoseMove(lastPlayer, win):
	winlose = ['black', 'white']
	winlose.remove(lastPlayer)
	return lastPlayer * win + winlose[0] * (not win)


def whoseMove(lastPlayer, win):
	if win == True:
		return lastPlayer
	else:
		return 'black' if lastPlayer == 'white' and win == False else 'white'


def whoseMove(lastPlayer, win):
	pls = ['black', 'white']
	return lastPlayer if win else pls[pls.index(lastPlayer) - 1]


def whoseMove(lastPlayer, win):
	if lastPlayer == 'black' and win:
		return 'black'
	if lastPlayer == 'black' and win == False:
		return 'white'
	if lastPlayer == 'white' and win:
		return 'white'
	if lastPlayer == 'white' and win == False:
		return 'black'


def whoseMove(last_player, win):
	return last_player if win else {'white': 'black'}.get(last_player, 'white')


def whoseMove(l, w):
	return 'white' if l == 'black' and (not w) or (l == 'white' and w) else 'black'


def whoseMove(lastPlayer, win):
	l = lastPlayer
	w = win
	if l == 'white' and w == False:
		return 'black'
	if l == 'white' and w == True:
		return 'white'
	if l == 'black' and w == True:
		return 'black'
	if l == 'black' and w == False:
		return 'white'


def whoseMove(lastPlayer, win):
	loser = {'white': 'black', 'black': 'white'}
	winer = {'black': 'black', 'white': 'white'}
	if win:
		return winer[lastPlayer]
	else:
		return loser[lastPlayer]


def whoseMove(lastPlayer, win):
	players = ('black', 'white', 'black')
	return players[players.index(lastPlayer) + (not win)]


def whoseMove(lastPlayer, win):
	temp = {'black': 'white', 'white': 'black'}
	if win == True:
		return lastPlayer
	else:
		return temp[lastPlayer]


def whoseMove(lastPlayer, win):
	if lastPlayer == 'white' and win is True:
		return 'white'
	if lastPlayer == 'black' and win is True:
		return 'black'
	if lastPlayer == 'white' and win is False:
		return 'black'
	if lastPlayer == 'black' and win is False:
		return 'white'


def whoseMove(lastPlayer, win):
	if lastPlayer == 'black':
		return 'white' if win == False else 'black'
	elif lastPlayer == 'white':
		return 'black' if win == False else 'white'


opponents = {'black': 'white', 'white': 'black'}

def whoseMove(last_player, win):
	return last_player if win else opponents[last_player]


def whoseMove(lastPlayer, win):
	players = ['white', 'black']
	if win:
		return lastPlayer
	else:
		players.remove(lastPlayer)
		return players[0]


whoseMove = lambda last_player, win: ('black', 'white', 'black')[('black', 'white').index(last_player) + (not win)]


def whoseMove(lastPlayer, win):
	if lastPlayer == 'white':
		other_player = 'black'
	else:
		other_player = 'white'
	return lastPlayer if win is True else other_player