我想在屏幕上渲染一些unicode characeters.
使用pygame.font显示一个奇怪的角色.
import pygame
pygame.init()
screen = pygame.display.set_mode((500, 500))
pygame.display.set_caption("TEST")
FONT = pygame.font.Font(None, 64)
font_surf = FONT.render("?", True, pygame.Color("red"))
screen.blit(font_surf, (20, 20))
pygame.display.flip()
pygame.time.delay(1000)
Run Code Online (Sandbox Code Playgroud)
我也尝试过使用pygame.freetype.它什么都没显示.
import pygame.freetype
pygame.freetype.init()
screen = pygame.display.set_mode((500, 500))
pygame.display.set_caption("TEST")
FONT = pygame.freetype.Font(None)
FONT.render_to(screen, (20, 20), "?", size=(40, 40))
pygame.display.flip()
pygame.time.delay(1000)
Run Code Online (Sandbox Code Playgroud) 这是问题陈述
一家餐厅有4个比萨基地:
全麦披萨
木火比萨
奶酪填充披萨
薄皮披萨  
有8个浇头:
番茄,洋葱,奶酪,Pepporoni,辣椒,大蒜,芝士,土豆,
计算比萨饼的价格给予比萨饼基础和0或更多的配料(假设每个基础和打顶有一些价格配置).
我的伪代码解决方案是:
    public class Pizza {
        public int getPrice(base, String... toppings){
            PizzaBaseMap.get(base) + toppingsMap.sum(t -> toppingsMap.get(t))
        }
    Hashmap<String, int> PizzaBaseMap= {
        whole_wheat : 1
        wood_fire : 2
        cheese_filled : 2
        thin_crust : 4
    }
    Hashmap<String, int> toppingsMap = {
        tomato : 1
        onion : 2
        cheese : 4
        pepporoni : 5
        capsicum : 2
        garlic : 2
        paneer : 4
        potato : 4
    }
    //client Code 
    int Price = new Pizza().getPrice("whole_wheat", ["tomato", …Run Code Online (Sandbox Code Playgroud)