Skip to content

Instantly share code, notes, and snippets.

@kitayuta
Created October 4, 2014 13:44
Show Gist options
  • Save kitayuta/c22ccb04d2ae97a3db0b to your computer and use it in GitHub Desktop.
Save kitayuta/c22ccb04d2ae97a3db0b to your computer and use it in GitHub Desktop.
Code Formula 2014 本選 F問題 ビジュアライザ
import pygame
from pygame.locals import *
import sys
ssize=(750,750)
pygame.init()
screen=pygame.display.set_mode(ssize)
rs=[]
while True:
screen.fill((255,255,255))
pygame.display.update()
nowr=100-len(rs)
x,y=pygame.mouse.get_pos()
pygame.draw.circle(screen,(0,0,0),(x,y),max(1,nowr/2),1)
for i in range(len(rs)):
pygame.draw.circle(screen,(255,0,0),rs[i],max(1,(100-i)/2),1)
pygame.display.update()
for event in pygame.event.get():
if event.type==MOUSEBUTTONDOWN:
if event.button==1:
rs.append(event.pos)
x,y=event.pos
print x*2,y*2,100-len(rs)+1
if event.button==2:
rs.pop
if event.type==QUIT:
rs.reverse()
for x,y in rs:
print x*2,y*2
sys.exit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment