Re: [Tutor] what happens when...

2006-09-14 Thread Alan Gauld
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

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] what happens when...

2006-09-14 Thread josip
When I remove board I get message: global name 'board' is not defined.  Ok I understand that.  But I would like to get some explaination to understand better.     Thanks!John Fouhy <[EMAIL PROTECTED]> wrote:  On 14/09/06, josip <[EMAIL PROTECTED]>wrote:>> Hi all!> Can You explain me what happens when in this function I remove board arg:> def human_move(board, human)?> What is doing that argument?Have you tried removing the argument and running the code? What errormessage do you get? What do you think it means?-- John. 
		Stay in the know. Pulse on the new Yahoo.com.  Check it out. 
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] what happens when...

2006-09-13 Thread John Fouhy
On 14/09/06, josip <[EMAIL PROTECTED]> wrote:
>
> Hi all!
> Can You explain me what happens when in this function I remove board arg:
> def human_move(board, human)?
> What is doing that argument?

Have you tried removing the argument and running the code?  What error
message do you get?  What do you think it means?

-- 
John.
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor