Exemplo n.º 1
0
 def test_getDirection(self):
     self.assertEqual(b.getDirection(0,35), 0)
     self.assertEqual(b.getDirection(0,getN(5,0)),1)
     self.assertEqual(b.getDirection(0,n(0,5)), b.SIZE)
     self.assertEqual(b.getDirection(0,0), 0)
     self.assertEqual(b.getDirection(5,0), -1)
     self.assertEqual(b.getDirection(6,0), -b.SIZE)
     self.assertEqual(b.getDirection(0,0), 0)
Exemplo n.º 2
0
def promptForPiece(prompt):
    input = raw_input(str(prompt) + " >>> ")
    input = input.split(',')
    try:
        piece = board.getN(int(input[0]), int(input[1]))
    except:
        print "Envalid Entry, use 'col,row'"
        return promptForPiece(prompt)

    return piece