minijuego de Python
de importación de gráficos *def cn(x): return x.decode('utf-8')
def quit(): _quit=1
ejecución global
running=1
def redraw(rect): canvas.blit(img) def default():
configuración global, color, fuente
con={"l": 15, "x": 15, "y": 33, "r": 13, "n": 15}
color={"bg": 0x7777bb, "fg": 0x333333, "p1": 0x000000, "p2": 0xffffff, "w": 0xff0000}
font=u "Sans MT 936_S60 " def inicial():
img global, lienzo, con, color, cur_x, cur_y, turn, pos1, pos2, pos
appuifw.appuifw.app.screen='full '
appuifw.app.body=canvas=appuifw.Canvas()
img=Image.new((240, 320))
img.clear (color["bg"])
cur_x=7
cur_y=7
turn=1<
pos1=[]
pos2=[]
pos=[]
para i en el rango(con["n"]*con["n"]):
pos.append(0)def paint_back():
img global, color, fuente
#img.text((90, 25), cn( 'Happy Backgammon'), color["fg"], fuente)
para i en el rango(con["x"], con["x"] con["l"]*con[" n"]-1,con["l"]):
img.line((i,con["y"],i,con["y"] con["l"]* (con["n"]-1)), color["fg"])
para i en el rango(con["y"], con["y"] con["l"] *con["n"]-1,con["l"]):
img.line((con["x"],i,con["x"] con["l" ]*(con["n"]-1), i), color["fg"])
img.text((40, 270), cn('jugador 1'), color[ "p1"], fuente)
img.text((160, 270), cn('jugador 2'), color["p2"], fuente)
img. punto((90, 263), color["p1"], ancho=con["r"],
fill=color["p1 "])
img.point((144, 263), color["p1"], ancho=con["r"], fill=color["p1 "] )
img.text((160, 270), cn('jugador 2'), color["p2"], fuente)