Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Validation checking
#1
Can I please have some help, I am passing in variables correctly and I am trying to check if the column is within the correct table (6 by 6) and I am returning board but the error I get is this:

line 29, in <module>
is_valid_location(board, column, invalid)
NameError: name 'board' is not defined
turn = 0
row = 6
columns = 6
invalid = True
game_over = False

def board_create(columns, row):
    board = [[' '] * columns for row in range(row)]
    return board

def drop_piece():
    pass

def is_valid_location(board, column):
    if column > 6 or column <= 0:
        invalid = True
    
def get_next_open_row():
    pass    

board_create(columns, row)

while not game_over:
    if turn == 0:
        while invalid == True:
            column = input("Player 1 make your selection (1-6):")
            is_valid_location(board, column, invalid)
    else:
        while invalid == True:
            column = input("Player 2 make your selection (1-6):")
            is_valid_location(board, column, invalid)
    turn = turn + 1
    turn = turn % 2
Would appreciate some help.
Reply


Messages In This Thread
Validation checking - by Help_me_Please - Aug-14-2019, 01:31 PM
RE: Validation checking - by buran - Aug-14-2019, 01:35 PM
RE: Validation checking - by perfringo - Aug-14-2019, 01:39 PM
RE: Validation checking - by Help_me_Please - Aug-14-2019, 01:43 PM
RE: Validation checking - by perfringo - Aug-14-2019, 01:52 PM
RE: Validation checking - by Help_me_Please - Aug-14-2019, 03:41 PM
RE: Validation checking - by perfringo - Aug-14-2019, 07:55 PM
RE: Validation checking - by ichabod801 - Aug-14-2019, 05:01 PM
RE: Validation checking - by jefsummers - Aug-14-2019, 06:39 PM
RE: Validation checking - by Help_me_Please - Aug-15-2019, 02:17 PM
RE: Validation checking - by ichabod801 - Aug-15-2019, 03:06 PM
RE: Validation checking - by Help_me_Please - Aug-15-2019, 03:33 PM
RE: Validation checking - by ichabod801 - Aug-15-2019, 03:36 PM
RE: Validation checking - by Help_me_Please - Aug-15-2019, 04:03 PM
RE: Validation checking - by buran - Aug-15-2019, 04:51 PM
RE: Validation checking - by ichabod801 - Aug-15-2019, 04:54 PM
RE: Validation checking - by Help_me_Please - Aug-16-2019, 09:40 AM
RE: Validation checking - by perfringo - Aug-16-2019, 10:17 AM
RE: Validation checking - by jefsummers - Aug-16-2019, 11:46 AM
RE: Validation checking - by perfringo - Aug-16-2019, 12:11 PM
RE: Validation checking - by ichabod801 - Aug-16-2019, 12:33 PM
RE: Validation checking - by Help_me_Please - Aug-16-2019, 12:46 PM
RE: Validation checking - by jefsummers - Aug-16-2019, 02:18 PM
RE: Help please stuck with summer work - by nilamo - Aug-15-2019, 04:47 PM
Connect 4 - by Help_me_Please - Aug-16-2019, 11:38 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020