[Tutor] what happens when...

Alan Gauld alan.gauld at btinternet.com
Fri Sep 15 01:06:57 CEST 2006


def human_move(human):  # <= here is board removed
    legal = legal_moves(board)

where does the board come from here?
If you had it as a parameter then thats where it would come from.
Without a parameter you need to have a global variable called board.

The parameters are the communications context between 
your function and the world outside. Everything that your function 
needs to operate should be passed into it (or local to it.) At least 
thats the ideal.

HTH,


-- 
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld



More information about the Tutor mailing list