import turtle,random t=turtle.Pen() t.speed(0) size = 50 masu = 9 #9×9 time = 0 score = 0 check = [] def Field(): for x in range(masu + 1): t.up() t.goto((x - masu/2)*size, -(masu/2)*size) t.down() t.goto((x - masu/2)*size, (masu/2)*size) for y in range(masu + 1): t.up() t.goto(-(masu/2)*size, (y - masu/2)*size) t.down() t.goto((masu/2)*size, (y - masu/2)*size) t.up() def Check(x,y): if x < 1 or y < 1 or masu < x or masu < y: return False global check for a in check: if x == a[0] and y == a[1]: return False check.append([x,y]) return True def Paint(x,y): t.goto(x*size, y*size) t.begin_fill() t.goto((x+1)*size, y*size) t.goto((x+1)*size,(y-1)*size) t.goto(x*size, (y-1)*size) t.end_fill() """ for dx in range(size + 1): t.up() for dy in range(size + 1): t.goto(x*size + dx, y*size - dy) t.down() """ return 1 def Score(x,y): s = random.choice([100,50,10,0]) print("今回:{}pt".format(s)) return s Field() while time < 5: a = int(input("列番号:")) b = int(input("行番号:")) if Check(a,b): x = a - masu/2 - 1 y = masu/2 - b + 1 time += Paint(x,y) score += Score(x,y) else: print("error") print("合計:{}pt".format(score))