Esempio n. 1
0
 def __init__(self, world, coords, letter_text):
     """
     @param world: game map
     @param coords: coordinates of letter
     @param letter_text: string that contains letter
     """
     super(Letter, self).__init__(world, coords)
     numerology.alpha_to_int(letter_text)
     if len(letter_text)==1:
         self.letter = letter_text
     else:
         raise WrongBFOperatorTextError
Esempio n. 2
0
 def getchar(self):
     """
     Gets letter from game map to current registry value
     """
     letter = self.world.get_letter(self.coord)
     if letter is not None:
         l = letter.letter
         self.memory.input(numerology.alpha_to_int(l))
     else:
         self.memory.input(0)
Esempio n. 3
0
 def test_fuzzy(self):
     caps = [string.uppercase[random.randint(0,len(string.uppercase)-1)] for x in range(100)]
     lows = [x.lower() for x in caps]
     for cap, low in zip(caps, lows):
         self.assertEqual(numerology.alpha_to_int(cap), numerology.alpha_to_int(low))
Esempio n. 4
0
 def test_alpha_to_int(self):
     for alpha, num in self.__ALPHA_NUM:
         res = numerology.alpha_to_int(alpha)
         self.assertEqual(num, res)