OK. I've got it working this far. Now I want the script to generate eight pieces, each with a random colour. Here's my current code:
#!/usr/bin/env python import random import time import math class LinePuzzlePiece: """This class defines a single playing piece for LinePuzzle""" def __init__(self): random.seed(time) index = int(math.floor(random.uniform(0, 8))) colorlist = ["red", "blue", "green", "yellow", "purple", "cyan", "orange", "white"] self.color = colorlist[index] def printcolor(self): print self.color piececount = 0 mypiece = ["", "", "", "", "", "", "", "", ""] while (piececount < 9): mypiece[piececount] = LinePuzzlePiece() mypiece[piececount].printcolor() piececount += 1 The problem is that while eight pieces are created and assigned a colour, the colour is always the same. I need the colours of the pieces to be in a somewhat random order. What am I doing wrong? _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor