out of range error in Connect 4
Trying to make a Connect 4 game, but I am having trouble bracketing the board. Everything here works fine if I make it without the boarders (like a 6x7 Tic Tac Toe), but when I try to add the edges on the sides, top and bottom I start getting my "index is out of range". I figure my mistake has something to do with player moves going on odd rows & columns now instead of even rows & columns (like it does on TicTacToe), but I don't know how to fix it.
anyways, you forgot that arrays start at 0, so you have to actually subtract 2 making it:
(15 + 1) / 2 = 8 and that is in fact bigger than what your array has.
@Coder100 doesn't a column range of 15 mean they're numbered 0-14? I was trying to place the player input in only the odd number columns/rows with the "if row%2 != 0". I thought that would limit it to (13 + 1) / 2 = 7 for columns and (11 + 1) / 2 = 6 for rows. I could totally be doing this the wrong way, this was just my line of thought.