class robot(object):
    def __init__(self, name, x, y, dir):
        self.name = name
        self.x = x
        self.y = y
        self.dir = dir
        print "robot " + name + " created.", 
        self.report()
    def forward(self):
        if self.dir == "north":
            self.y += 1
        elif self.dir == "east":
            self.x += 1
        elif self.dir == "south":
            self.y -= 1
        elif self.dir == "west":
            self.x -= 1
        else:
            self.dir = "north"
            print "... recalibrating"
        print "robot " + self.name + " moving forward...",
        self.report()
    def report(self):
        print self
    def __str__(self):
        return "robot " + self.name + " at (" + str(self.x) + ", " + str(self.y) + ") facing " + self.dir
    def right(self):
        if self.dir == "north":
            self.dir = "east"
        elif self.dir == "east":
            self.dir = "south"
        elif self.dir == "south":
            self.dir = "west"
        elif self.dir == "west":
            self.dir = "north"
        else:
            self.dir = "north"
            print "... recal. in turn r."
        print "robot " + self.name + " turning right...",
        self.report()

def test():
    a = robot("alice", 2, 3, "south")
    a.forward()
    b = robot("queen", 4, 2, "west")
    a.right()
    a.forward()
    a.forward()
    b.forward()
    a.right()
    a.forward()
    b.right()
    b.forward()
    
