I'm have to create connect 4 as an assignment. We have been given code to tic tac toe to base it on. I have adjusted the board code but keep getting this error message
Error:Traceback (most recent call last):
File "C:\Users\Brett Bullman\Desktop\Programming\Lab 6\Lab6_Python\tic_tack_toe_fixed\main.py", line 38, in <module>
main()
File "C:\Users\Brett Bullman\Desktop\Programming\Lab 6\Lab6_Python\tic_tack_toe_fixed\main.py", line 17, in main
gboard.show_board_fixed() # show empty grid at the beginning of the game
File "C:\Users\Brett Bullman\Desktop\Programming\Lab 6\Lab6_Python\tic_tack_toe_fixed\gameboardfixed.py", line 63, in show_board_fixed
print(' ' + self.__board[5][0] + ' | ' + self.__board[5][1] + ' | ' + self.__board[5][2])
IndexError: list index out of range
This is the code:>>> def show_board_fixed(self): print(' | | | | | | ') print(' ' + self.__board[0][0] + ' | ' + self.__board[0][1] + ' | ' + self.__board[0][2]) print(' | | | | | | ') print('---------------------------') print(' | | | | | | ') print(' ' + self.__board[1][0] + ' | ' + self.__board[1][1] + ' | ' + self.__board[1][2]) print(' | | | | | | ') print('---------------------------') print(' | | | | | | ') print(' ' + self.__board[2][0] + ' | ' + self.__board[2][1] + ' | ' + self.__board[2][2]) print(' | | | | | | ') print('---------------------------') print(' | | | | | | ') print(' ' + self.__board[3][0] + ' | ' + self.__board[3][1] + ' | ' + self.__board[3][2]) print(' | | | | | | ') print('---------------------------') print(' | | | | | | ') print(' ' + self.__board[4][0] + ' | ' + self.__board[4][1] + ' | ' + self.__board[4][2]) print(' | | | | | | ') print('---------------------------') print(' | | | | | | ') print(' ' + self.__board[5][0] + ' | ' + self.__board[5][1] + ' | ' + self.__board[5][2]) print(' | | | | | | ')also would i have to adjust the self.board to suit all spaces? Thanks