0

I have a recurring error in my code:

line 424, in <module>
menu() line 50, in menu
main1v1() line 396, in main1v1
showPoints(playerTile, opponentTile)
line 307, in showPoints
scores = getScoreOfBoard(mainBoard)
NameError: name 'mainBoard' is not defined

I cannot seem to fix it. These two definitions are where the trouble is I believe. I am currently coding for a game called Othello, but now when I am trying to create a 1v1 instead of the previous 1vAI it creates some problems.

3
  • could you post the full error stacktrace? Commented Jul 26, 2017 at 8:10
  • check new update Commented Jul 26, 2017 at 8:13
  • Please do not update your question in such a way. Ask a new question instead. We don't want problems to be concealed once solved; that's not the point of StackOverflow. Commented Jul 26, 2017 at 8:29

1 Answer 1

3

Your function showPoints1v1 uses variable mainBoard but it is neither defined inside that, nor is an argument. You need to define it or pass it as an argument while calling it.

Sign up to request clarification or add additional context in comments.

3 Comments

oh ty, so you mean I just add it as an argument in the def showPoints1v1(playerTile, opponentTile, mainBoard
Yes. That the way if you want to use mainBoard inside your showPoints1v1 function.
Or use global, even though I personally don't like it

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.