def draw(self, colour): printval = abs(self.value % 10) serialprint.setColor(colour) for y in range(5): for x in range(3): if constants.DIGITS[printval][y][x] == "X": serialprint.print_at(self.position.y + y, self.position.x + x, " ")
def checkWinner(): global is_winner if score1.value >= constants.WINNER_SCORE: #printing function message = constants.WINNER[1] is_winner = True elif score2.value >= constants.WINNER_SCORE: #printing function message = constants.WINNER[0] is_winner = True if (is_winner): if score1.value == constants.WINNER_SCORE: serialprint.setColor(constants.COLOURS["BlueScore"]) else: serialprint.setColor(constants.COLOURS["RedScore"]) for y in range(5): for x in range(len(message[0])): if message[y][x] == "X": serialprint.print_at(9 + y, 24 + x, " ")
def draw(self, colour): serialprint.setColor(constants.COLOURS["Reset"]) for y in range(self.position.y): serialprint.print_at(y, self.position.x, " ") serialprint.setColor(colour) for y in range(self.position.y, self.position.y + self.length): serialprint.print_at(y, self.position.x, " ") serialprint.setColor(constants.COLOURS["Reset"]) for y in range(self.position.y + self.length, constants.ROWS): serialprint.print_at(y, self.position.x, " ")
def printHardwareDebugHeader(): print("\033[2J") serialprint.print_at(1, 1, "Diagnostic Information:", CONSOLE=True) serialprint.print_at(2, 1, "| A RAW ADC | Serve | ASize | Bat Pos | Size |", CONSOLE=True) serialprint.print_at(3, 1, "|----------------------------------------------|", CONSOLE=True) serialprint.print_at(5, 1, "|----------------------------------------------|", CONSOLE=True) serialprint.print_at(6, 1, "| B RAW ADC | Serve | BSize | Bat Pos | Size |", CONSOLE=True) serialprint.print_at(7, 1, "|----------------------------------------------|", CONSOLE=True) serialprint.print_at(9, 1, "|----------------------------------------------|", CONSOLE=True)
def printHardwareDisplay(aval, a1, a2, apos, asize, bval, b1, b2, bpos, bsize): serialprint.print_at(4, 1, "| " + str(aval).rjust(8) + " | " + str(a1).rjust(5) + " | " + str(a2).rjust(5) + " | " + str(apos).rjust(3) + "/" + str(24-asize).ljust(2) + " | " + str(asize).rjust(3) + " |", CONSOLE=True) serialprint.print_at(8, 1, "| " + str(bval).rjust(8) + " | " + str(b1).rjust(5) + " | " + str(b2).rjust(5) + " | " + str(bpos).rjust(3) + "/" + str(24-bsize).ljust(2) + " | " + str(bsize).rjust(3) + " |", CONSOLE=True)
def draw(self): #serialprint.setColor(colour) serialprint.print_at(self.position.y, self.position.x, "o")
def erase(self): serialprint.print_at(self.lastposition.y, self.lastposition.x, " ")
def draw(self): for y in range(1, self.length, 4): serialprint.print_at(y, self.x, "|") serialprint.print_at(y + 1, self.x, "|")