Here I go again.
I tried to create a computer enemy for my connect 4 game:
def turn_comp(): import random print 'Computer ist am Zug!' playchip = random.randint(0, columns) board[playchip] = 'O' print_board()
Even though I limited the range of randint with 0 and columns (in a 4x4 board columns = 4) the computer chooses a number out of range.
//Edit: If I limit the range to (0, columns - 1) it seems to work perfectly
//Edit2: Is it because the list index starts with 0 (and not with 1)? I guess this is it...
Thanks in advance.
Edited 7 Years Ago by sentinel123: n/a