I want to be able to switch operands each time through a loop. So the first time through I'd like to add column. The second time through the loop I'd like to subtract from column. The third time through I would like to subtract from column and subtract from row. The fourth time through I'd like to subtract from column and add to row. Is this possible to write one loop to accomplish this instead of several? Thanks for the help!
#add
for x in range(1,8):
if game[column+x][row] == 'W':
game[column+x][row] = 'B'
elif game[column+x][row] == 'B':
return
#subtract
for x in range(1,8):
if game[column-x][row] == 'W':
game[column-x][row] = 'B'
elif game[column-x][row] == 'B':
return
#etc....
for x in range(1,8):
if game[column-x][row-x] == 'W':
game[column-x][row-x] = 'B'
elif game[column-x][row-x] == 'B':
return
for x in range(1,8):
if game[column-x][row+x] == 'W':
game[column-x][row+x] = 'B'
elif game[column-x][row+x] == 'B':
return