Thanks eryksun, that was the bug. Thanks for pointing out the tabs as well,
they were added by vim's autoindent. I've set expandtab for python files
now.

I decided to change the code such that current_player and turn_number are
hidden behind properties meaning I won't overwrite them accident or
stupidity later.


On 6 December 2012 01:31, eryksun <eryk...@gmail.com> wrote:

> On Wed, Dec 5, 2012 at 1:11 PM, C M Caine <cmca...@googlemail.com> wrote:
> >
> > The full code is on pastebin http://pastebin.com/tUh0W5Se
> >
> >>>> import game
> >>>> S = game.State()
> >>>> S1 = S.move_state(1).move_state("SWAP")
> >>>> S2 = S.move_state(1)
> >>>> S3 = S2.move_state("SWAP")
> >>>> S1 == S3
> > False
>
> In lines 156-160 you change players by mutating the object. You need
> to use a local variable such as "next_player" and return State(board,
> self.turn_number + 1, next_player).
>
> Also, you're mixing tabs and 2-space indents. Please choose one or the
> other. The most popular style is 4-space indents, as recommended by
> the PEP 8 style guide.
>
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to