Beispiel #1
0
def win(winner, turn):
    stddraw.clear()
    stddraw.setFontSize(30)
    if winner == 'X' or winner == 'O':
        stddraw.text(0.0, 0.0, "'" + winner + "'" + " player wins")
    if turn >= 9 and winner != 'X' and winner != 'O':
        stddraw.text(0.0, 0.0, " It's a tie!")
Beispiel #2
0
def showScore(score, x=0):
    stddraw.setPenColor(stddraw.WHITE)
    stddraw.filledRectangle(-350, 450, 700, 100)
    score = "Score: " + str(score)
    stddraw.setFontSize(60)
    stddraw.setPenColor(stddraw.BLACK)
    stddraw.text(-210 + x, 500, score)
def wrong_guesses(i):
    stddraw.setPenColor(stddraw.WHITE)
    stddraw.filledRectangle(-1, -1, 2, 0.2)
    stddraw.setPenColor(stddraw.RED)
    stddraw.setFontSize(40)
    stddraw.text(-0.2,-0.9,i)
    stddraw.show(0)
Beispiel #4
0
def score(score):
    stddraw.setPenColor(stddraw.WHITE)
    stddraw.setFontSize(26)
    stddraw.filledRectangle(7.2, -2.5, 2, 1)
    stddraw.setPenColor(stddraw.RED)
    stddraw.text(8.25, -1.75, "SCORE:")
    stddraw.text(8.25, -2.25, str(score) + "/1000")
Beispiel #5
0
def win():
    stddraw.clear()
    stddraw.setPenColor(stddraw.GREEN)
    stddraw.setFontSize(36)
    stddraw.text(4.5, -4.5, "Congrats! You win!")
    stddraw.show(1000)
    sys.exit()
Beispiel #6
0
def update_without_score():
    stddraw.setFontFamily("WORDSOFLOVE")
    stddraw.setFontSize(70)
    stddraw.picture(pic7, 4.5, 5)
    stddraw.setFontSize(70)
    for i in range(9):
        for j in range(9):
            if game[i][j] == "strawberry":
                stddraw.picture(pic1, (j + 1) * 0.9, i + 0.5)
            elif game[i][j] == "lemon":
                stddraw.picture(pic2, (j + 1) * 0.9, i + 0.5)
            elif game[i][j] == "orange":
                stddraw.picture(pic3, (j + 1) * 0.9, i + 0.5)
            elif game[i][j] == "pear":
                stddraw.picture(pic4, (j + 1) * 0.9, i + 0.5)
            elif game[i][j] == "grapes":
                stddraw.picture(pic5, (j + 1) * 0.9, i + 0.5)
            elif game[i][j] == "watermelon":
                stddraw.picture(pic6, (j + 1) * 0.9, i + 0.5)
    stddraw.text(1, 9.5, ":Score: ")
    stddraw.text(4.4, 9.5, ":Moves: ")
    stddraw.text(8, 9.5, ":Goal: ")

    stddraw.setFontFamily("Blah blah bang")
    stddraw.setFontSize(40)
    stddraw.text(8.7, 9.5, "700")
    stddraw.text(5.3, 9.5, str(number_of_moves))
def right():
    if moves < 0 and score < winning_score:
        stddraw.text(5.2, 10.5, "You lose!")
        stddraw.show()

    elif score > winning_score:
        stddraw.text(5.2, 10.5, "You win!")
        stddraw.show()
def there_is_no_winner(game_playertwo_click, game_playerOne_click):
    if len(game_playertwo_click) + len(game_playerOne_click) >= 9:
        stddraw.clear()
        stddraw.setFontSize(30)
        stddraw.text(1.5, 2.5, "There is no winner ! ")
        stddraw.text(1.5, 1.5, "please close you window !")
        stddraw.show(1)
        exit()
def draw_turn(turn_number):
    stddraw.setPenColor(stddraw.WHITE)
    stddraw.filledRectangle(0, 0.96, 80, 20)
    stddraw.setPenColor(stddraw.BLACK)
    if turn_number % 2 != 0:
        stddraw.text((1 / 3) / 2, 0.98, "Player 1's Turn")
    else:
        stddraw.text((1 / 3) / 2, 0.98, "Player 2's Turn")
def draw_win(turn_number):
    if turn_number % 2 == 0:
        #player two won
        stddraw.text((1 / 3) + (1 / 3) / 2, 0.98, "PLAYER 2 WON!")
    else:
        #player one won
        stddraw.text((1 / 3) + (1 / 3) / 2, 0.98, "PLAYER 1 WON!")
    stddraw.show()
Beispiel #11
0
def draw_world(world, wait=-1):
    """
    Draws the present state of Karel's world to stddraw.
    :param world: object of type World to draw
    :return:
    """
    stddraw.clear()

    _draw_labels(world.num_avenues, world.num_streets)
    _draw_status(world.num_avenues, world.num_streets, world.karel)

    for i in range(1, world.num_avenues + 1):
        for j in range(1, world.num_streets + 1):
            x = float(i) - 0.5
            y = float(j) - 0.5

            # draw beeper(s) if present
            stddraw.setPenRadius()
            b = world.beepers[i][j]
            if b > 0:
                stddraw.picture(_beeper_picture, x, y)
                if b > 1:
                    stddraw.text(x, y, str(b))
            else:
                d = 0.5 * _intersection_size
                stddraw.line(x - d, y, x + d, y)
                stddraw.line(x, y - d, x, y + d)

            # draw walls
            x1 = x + 0.5
            x0 = x1 - 1.0
            y1 = y + 0.5
            y0 = y1 - 1.0
            walls = world.walls[i][j]
            stddraw.setPenRadius(0.5 * _wall_thickness)
            if walls[constants.NORTH]:
                stddraw.line(x0, y1, x1, y1)
            if walls[constants.SOUTH]:
                stddraw.line(x0, y0, x1, y0)
            if walls[constants.EAST]:
                stddraw.line(x1, y0, x1, y1)
            if walls[constants.WEST]:
                stddraw.line(x0, y0, x0, y1)

    # draw Karel the Robot
    if world.karel is not None:
        x = float(world.karel.location_avenue) - 0.5
        y = float(world.karel.location_street) - 0.5
        d = world.karel.facing
        stddraw.picture(_karel_pictures[d], x, y)
        if world.karel.error:
            stddraw.picture(_error_picture, x, y)

    if wait >= 0:
        stddraw.show(wait)
    else:
        stddraw.show()
Beispiel #12
0
def Wguess(guessed):
    stddraw.setFontSize(22)
    stddraw.setPenColor(stddraw.GRAY)
    stddraw.text(3, 5, "Wrong Guesses:")
    stddraw.setFontSize(30)
    stddraw.setPenColor(stddraw.PINK)
    for i in range(len(guessed)):
        stddraw.text(i, 4, ''.join(guessed[i]))
    stddraw.show(500)
Beispiel #13
0
def drawLossCondition():
    stddraw.setPenColor(stddraw.WHITE)
    stddraw.filledRectangle(0.03, 4, 4.65, 2.97)
    stddraw.setFontSize(50)
    stddraw.setPenColor(stddraw.RED)
    stddraw.text(2.25, 5.75, 'YOU LOSE!')
    stddraw.setFontSize(25)
    stddraw.text(2.25, 4.75, 'Click to exit')
    stddraw.show(0)
Beispiel #14
0
def drawWinCondition():
    stddraw.setPenColor(stddraw.WHITE)
    stddraw.filledRectangle(0.03, 4, 4.65, 2.97)
    stddraw.setFontSize(50)
    stddraw.setPenColor(stddraw.MAGENTA)
    stddraw.text(2.25, 5.75, 'YOU WIN!')
    stddraw.setFontSize(25)
    stddraw.text(2.25, 4.75, 'Click to exit')
    stddraw.show(0)
def draw_all_the_things():
    stddraw.setFontSize(30)
    stddraw.text(1.5, 9.2, "Hi Handsome")
    stddraw.text(5, 9.2, "Your current Score:")
    game_array = creat_an_useful_array()
    draw_a_circle(game_array)
    draw_a_inclined(game_array)
    draw_a_square(game_array)
    draw_a_regular_triangle(game_array)
    draw_a_pentagon(game_array)
    draw_a_parallelogram(game_array)
Beispiel #16
0
def tie_game(x,y):
    stddraw.setPenColor(stddraw.WHITE)
    stddraw.filledRectangle(0,0,1,.09)
    stddraw.setPenColor(stddraw.PINK)
    stddraw.text(0.5,.0625, "It's a tie!")
    stddraw.text(.8,.0625, "Exit")
    stddraw.setFontSize(24)
    if x>.6 and x <1:
        if y > 0 and y <.125:
            sys.exit()

    stddraw.show(1000)
def determine_the_winner(game_player_click, playernumber, game_win):
    if len(game_player_click) >= 3:
        win = check_weather_win(game_player_click)
        playernumber_str = str(playernumber)
        if win == True:
            stddraw.clear()
            stddraw.setFontSize(30)
            stddraw.text(1.5, 2.5, "player" + playernumber_str + " win !")
            stddraw.text(1.5, 1.5, "please close you window !")
            game_win = False
            stddraw.show()
    return game_win
Beispiel #18
0
def player_two_win(x,y):
    stddraw.setFontSize(36)
    stddraw.setPenColor(stddraw.WHITE)
    stddraw.filledRectangle(0,0,1,.09)
    stddraw.setPenColor(stddraw.PINK)
    stddraw.text(0.5,.0625,"Player two wins!")
    stddraw.setFontSize(24)
    stddraw.text(.8,.0625, "Exit")
    if x>.6 and x <1:
        if y > 0 and y <.125:
            sys.exit()

    stddraw.show(1000)
def main_menu_click():
    global Clicked
    while not Clicked:
        if stddraw.mousePressed():
            mx = stddraw.mouseX()
            my = stddraw.mouseY()
            # determines where and what to print
            if 446 > mx > 54 and 539 > my > 301:
                stddraw.picture(images.gameBackground,250,400)
                stddraw.picture(images.scoreOverlay,327,725)
                stddraw.setFontSize(25)
                stddraw.setPenColor(color.WHITE)
                stddraw.text(327,725, '0')
                Clicked = True
        stddraw.show(0.0)
Beispiel #20
0
   def display(self,pause):
      # clear the background canvas to empty_cell_color
      stddraw.clear(self.empty_cell_color)
      # SCORE
      stddraw.setFontSize(28)
      stddraw.setPenColor(stddraw.WHITE)
      stddraw.boldText(self.grid_width + 2, self.grid_height - 1, "SCORE")
      stddraw.rectangle(self.grid_width, self.grid_height - 3.5, 4, 2)
      stddraw.boldText(self.grid_width + 2, self.grid_height - 2.5, str(self.total_score))

      # Controls
      stddraw.setFontSize(18)
      stddraw.setPenColor(stddraw.DARK_GRAY)
      stddraw.boldText(self.grid_width + 2, self.grid_height - 6, "Controls")

      stddraw.setFontSize(12)
      stddraw.boldText(self.grid_width + 2, self.grid_height - 7, "← Left Key the tetromino left by on")
      stddraw.boldText(self.grid_width + 2, self.grid_height - 7.5, "→ Right Key the tetro right by on")
      stddraw.boldText(self.grid_width + 2, self.grid_height - 8, "P to Pause")
      stddraw.boldText(self.grid_width + 2, self.grid_height - 8.5, "E/Q to Rotate")
      stddraw.boldText(self.grid_width + 2, self.grid_height - 9, "Current Speed: {:.2f}".format((1/self.delta_time)*1000))
      stddraw.boldText(self.grid_width + 2, self.grid_height - 9.5, "W to Faster Down")
      stddraw.boldText(self.grid_width + 2, self.grid_height - 10, "S to Slower Down")
      stddraw.boldText(self.grid_width + 2, self.grid_height - 10.5, "R to Restart ")
      stddraw.boldText(self.grid_width + 2, self.grid_height - 11,"Space to drop tetromino")


      stddraw.setFontSize(24)
      stddraw.setPenColor(stddraw.WHITE)
      stddraw.text(self.grid_width+2, self.grid_height-12 , "next")
      stddraw.rectangle(self.grid_width,self.grid_height-18,4,5)
      # draw the game grid
      self.next_tetromino.draw_dummy()
      self.draw_grid()
      # draw the current (active) tetromino
      if self.current_tetromino != None:
         self.current_tetromino.draw()
      # draw a box around the game grid 
      self.draw_boundaries()

      if(pause):
         stddraw.setPenColor(stddraw.BLACK)
         stddraw.setFontSize(32)
         stddraw.text(self.grid_width/2,self.grid_height/2,"Game is Paused")
      # show the resulting drawing with a pause duration = 250 ms
      stddraw.show(self.delta_time)
def display_game_over(grid_height, grid_width):
    background_color = Color(42, 69, 99)
    button_color = Color(25, 255, 228)
    text_color = Color(31, 160, 239)
    # clear the background canvas to background_color
    stddraw.clear(background_color)

    # get the directory in which this python code file is placed
    current_dir = os.path.dirname(os.path.realpath(__file__))
    # path of the image file
    img_file = current_dir + "/menu_image.png"
    # center coordinates to display the image
    img_center_x, img_center_y = (grid_width - 1) / 2, grid_height - 7
    # image is represented using the Picture class
    image_to_display = Picture(img_file)
    # display the image
    stddraw.picture(image_to_display, img_center_x, img_center_y)
    # dimensions of the start game button
    button_w, button_h = grid_width - 1.5, 2
    # coordinates of the bottom left corner of the start game button
    button_blc_x, button_blc_y = img_center_x - button_w / 2, 4
    # display the start game button as a filled rectangle
    stddraw.setPenColor(button_color)
    stddraw.filledRectangle(button_blc_x, button_blc_y, button_w, button_h)
    # display the text on the start game button
    stddraw.setFontFamily("Arial")
    stddraw.setFontSize(25)
    stddraw.setPenColor(text_color)
    text_to_display = "Game Over"
    stddraw.text(img_center_x, 5.5, text_to_display)
    stddraw.text(img_center_x, 4.5, "Score : " + str(grid.total_score))
    # menu interaction loop
    while True:
        # display the menu and wait for a short time (50 ms)
        stddraw.show(50)
        # check if the mouse has been left-clicked
        if stddraw.mousePressed():
            # get the x and y coordinates of the location at which the mouse has
            # most recently been left-clicked
            mouse_x, mouse_y = stddraw.mouseX(), stddraw.mouseY()
            if mouse_x >= button_blc_x and mouse_x <= button_blc_x + button_w:
                if mouse_y >= button_blc_y and mouse_y <= button_blc_y + button_h:
                    return True
Beispiel #22
0
def lose(chosen_word):
    stddraw.clear()
    stddraw.setPenColor(stddraw.BLACK)
    stddraw.filledSquare(0.0, 0.0, 10)
    stddraw.setFontSize(70)
    stddraw.setPenColor(stddraw.BLUE)
    stddraw.text(0.0, 0.0, "Oops :(")
    stddraw.setFontSize(30)
    stddraw.text(0.0, -4, "You couldn't guess the word!")
    stddraw.text(0.0, -5, "The word was: ")
    stddraw.text(0.0, -6, str(''.join(chosen_word)))
    stddraw.show(9000)
Beispiel #23
0
def turnStatement(turn):
    stddraw.setFontSize(20)
    if turn % 2 == 0:
        stddraw.setPenColor(stddraw.WHITE)
        stddraw.text(0.0, 0.0, "It's Player Two's Turn")
        stddraw.setPenColor(stddraw.RED)
        stddraw.text(0.0, 0.0, "It's Player One's Turn")
    else:
        stddraw.setPenColor(stddraw.WHITE)
        stddraw.text(0.0, 0.0, "It's Player One's Turn")
        stddraw.setPenColor(stddraw.RED)
        stddraw.text(0.0, 0.0, "It's Player Two's Turn")
Beispiel #24
0
def _draw_coordinate_system(minX, maxX, minY, maxY):
    """
    @param minX: smallest x value
    @param maxX: largest x value
    @param minY: smallest y value
    @param maxY: largest y value
    Draws axis and numbers them
    """
    stddraw.setPenColor(color.WHITE)
    stddraw.setPenRadius(0.01)
    stddraw.line(minX - 1, 0, maxX + 1, 0)
    stddraw.line(0, minY - 1, 0, maxY + 1)

    for x in range(minX, maxX + 1):
        if not x == 0:
            stddraw.text(x, -0.5, str(x))

    for y in range(minY, maxY + 1):
        if not y == 0:
            stddraw.text(-0.2, y, str(y))
Beispiel #25
0
    def visualize_q_table(self, width):

        qt = sorted(self.q_table.items())
        GRID_SIZE_X = width / len(self.actions)
        GRID_SIZE_Y = width / len(qt)

        for i in range(0, len(self.q_table.items())):

            for j in range(0, len(self.actions)):
                #print(str(qt[i][1][j]) + ' ',end='')
                current_val = (qt[i][1][j])
                sigmoid = 1 / (1 + math.exp(-current_val)
                               )  #get a range between 0 and 1
                state_name = qt[i][0] + " - " + str(round(qt[i][1][j], 2))
                if current_val < 0:
                    new_color = color.Color(int(sigmoid * 255), 0, 0)
                elif current_val == 0.0:
                    new_color = color.Color(0, 0, 0)
                else:
                    new_color = color.Color(0, int(sigmoid * 255), 0)
                #stddraw.setPenColor(color.BLACK)
                #stddraw.text((GRID_SIZE_X * i) + (GRID_SIZE/2),(GRID_SIZE * j) + (GRID_SIZE / 2), state_name)

                stddraw.setPenColor(new_color)
                stddraw.filledRectangle(
                    (GRID_SIZE_X * j), width - (GRID_SIZE_Y * i) - GRID_SIZE_Y,
                    GRID_SIZE_X, GRID_SIZE_Y)
                stddraw.setPenColor(color.WHITE)
                stddraw.text((GRID_SIZE_X * j) + (GRID_SIZE_X / 2),
                             width - (GRID_SIZE_Y * i) - GRID_SIZE_Y +
                             (GRID_SIZE_Y / 2), state_name)

        stddraw.setPenColor(color.BLACK)
        #gridlines
        for i in range(1, len(self.q_table.items())):
            stddraw.filledRectangle(0, GRID_SIZE_Y * i, width, 0)

        for i in range(1, len(self.actions)):
            stddraw.filledRectangle(GRID_SIZE_X * i, 0, 0, width)

        stddraw.show(0)
Beispiel #26
0
def instructions():
    stddraw.clear()
    stddraw.setPenColor(stddraw.BLACK)
    stddraw.setFontSize(30)
    stddraw.text(3.5,7,"To Win This Game All You Have To Do")
    stddraw.text(3.5,6,"Is Get Your Score Over 100 in under 25 Moves.")
    stddraw.text(3.5,5,"That's It!. Good Luck!")
Beispiel #27
0
 def draw_score(self, score):
     stddraw.setPenColor(self.boundary_color)  # using boundary_color
     # set the pen radius
     stddraw.setPenRadius(self.box_thickness)
     # coordinates of the bottom left corner of the game grid
     pos_x, pos_y = self.grid_width - 0.5, -0.5
     stddraw.rectangle(pos_x, pos_y, 3.5, self.grid_height)
     stddraw.setPenColor(Color(167, 160, 151))
     stddraw.filledRectangle(pos_x + 0.03, pos_y + 0.09, 3.4,
                             self.grid_height - 0.2)
     # set the text
     text_color = Color(0, 0, 0)
     stddraw.setFontFamily("Arial")
     stddraw.setFontSize(30)
     stddraw.setPenColor(text_color)
     text_to_display = "SCORE"
     text_to_display2 = "NEXT"
     stddraw.text(12 + 1.2, 5, text_to_display2)
     stddraw.text(self.grid_width + 1.2, 15, text_to_display)
     stddraw.text(self.grid_width + 1.2, 14, str(score))
     # get the tetromino's type to create next tetromino to show in the next section
     tet_type = self.current_tetromino.get_type()
     if tet_type == 'I':
         width = 4
         height = 11
     elif tet_type == 'O':
         width = 2
         height = 12
     else:
         width = 3
         height = 11
     next_tetromino = Tetromino(tet_type, height, width)
     next_tetromino.draw_next_tet(self.current_tetromino)
     stddraw.setPenRadius()  # reset the pen radius to its default value
Beispiel #28
0
def pie_diagram(probabilities):
    """
    @param probabilities: Array with probabilities
    Checks if the sum of the probabilities equals 100, initialises a background, draws one pie segment for each
    probability in a different color. Displaces the probabilities of each slice outside of the chart.
    """
    probability_sum = 0
    for probability in probabilities:
        probability_sum += probability
    if probability_sum != 100:
        print('Sum of probabilities is not 100')
        return
    stddraw.setXscale(-1.5, 1.5)
    stddraw.setYscale(-1.5, 1.5)
    stddraw.clear(color.DARK_GRAY)

    counter = 0
    colors = [color.RED, color.ORANGE, color.YELLOW, color.GREEN, color.BLUE, color.CYAN,
              color.MAGENTA, color.PINK, color.BOOK_LIGHT_BLUE, color.BOOK_RED]

    for probCount in range(len(probabilities)):
        probability = probabilities[probCount]
        pointsX = [0]
        pointsY = [0]
        for i in range(0, probability + 1):
            x, y = _get_circle_coordinates(counter)
            pointsX.append(x)
            pointsY.append(y)
            counter += 1
        counter -= 1 # Start the next pie segment on the same point where the last ended
        # draw text
        x, y = _get_circle_coordinates(counter - probability / 2.0)
        x *= 1.1
        y *= 1.1
        stddraw.setPenColor(colors[probCount % 10])
        stddraw.text(x, y, f'{probability}%')
        stddraw.filledPolygon(pointsX, pointsY)

    stddraw.show()
Beispiel #29
0
def drawBoard(board, columns, rows, score, turn):
    """

    :param board: 2d array that is to be drawn
    :param columns: columns in 2d array
    :param rows: rows in 2d array
    :param score: current score
    :param turn: current turn

    prints the 2d array to the screen with the score and current turn at the bottom
    of the screen
    """
    sd.clear()
    for i in range(columns):
        for j in range(rows):
            if board[i][j] == " ":
                False
            else:
                board[i][j].draw(i, j)
    sd.setFontSize(40)
    sd.text(3.5, -.5, "Score " + str(score))
    sd.text(1, -.5, "Turn: " + str(turn))
    sd.show(1)
def draw_results(guesses_remaining, word_to_guess):
    if guesses_remaining == 0:
        stddraw.setPenColor(stddraw.DARK_RED)
        stddraw.text(0.5, 0.3, "You lost! Try playing again.")
    else:
        stddraw.setPenColor(stddraw.DARK_GREEN)
        stddraw.text(0.5, 0.3, "Congrats! You won the game!")
    stddraw.text(0.5, 0.225, "The word was: " + word_to_guess)
    stddraw.show()
Beispiel #31
0
vy = .023

radius = .05
dt = 20
start = time.time()

t = 0
while True:
    # Update ball position and draw it there.
    if abs(rx + vx) + radius > 1.0:
        vx = -vx
    if abs(ry + vy) + radius > 1.0:
        vy = -vy
    rx = rx + vx
    ry = ry + vy
    
    #stddraw.clear()

    stddraw.setPenColor(stddraw.GRAY)
    stddraw.filledSquare(0, 0, 1.0)

    stddraw.setPenColor(stddraw.BLACK)
    stddraw.filledCircle(rx, ry, radius)
    stddraw.text(0, 0, "YOOOOOO")
    #stddraw.sleep(dt)
    stddraw.show()
    t += 1
finish = time.time()

print finish - start
Beispiel #32
0
# banner.py
#-----------------------------------------------------------------------

import stddraw
import sys

# Accept string command-line argument s. Draw s, and move it across
# the screen, left-to-right, wrapping around when it reaches the border.

s = sys.argv[1]

# Remove the 5% border.
stddraw.createWindow()
stddraw.setXscale(1.0/22.0, 21.0/22.0)
stddraw.setYscale(1.0/22.0, 21.0/22.0)

# Set the font.
stddraw.setFontFamily('Arial') 
stddraw.setFontSize(60)
stddraw.setPenColor(stddraw.BLACK)

i = 0.0
while True:
    stddraw.clear()
    stddraw.text((i % 1.0),       0.5, s)
    stddraw.text((i % 1.0) - 1.0, 0.5, s)
    stddraw.text((i % 1.0) + 1.0, 0.5, s)
    stddraw.sleep(60)
    stddraw.show()
    i += 0.01
Beispiel #33
0
#-----------------------------------------------------------------------
# shapestext.py
#-----------------------------------------------------------------------

import stddraw

# Draw some shapes and some text.
stddraw.createWindow()
stddraw.square(.2, .8, .1)

stddraw.filledSquare(.8, .8, .2)

stddraw.circle(.8, .2, .2)

xd = [.1, .2, .3, .2]
yd = [.2, .3, .2, .1]
stddraw.filledPolygon(xd, yd)

stddraw.setFontFamily('Times')
stddraw.setFontSize(40)
stddraw.text(.2, .5, 'black')

stddraw.setPenColor(stddraw.WHITE)
stddraw.setFontFamily('Courier')
stddraw.setFontSize(30)
stddraw.text(.8, .8, 'white')

stddraw.show()
stddraw.wait()