Pi Day Challenge
The formula for the perimeter of a circle is P = 2 π r. The formula for the area of a circle is A = π r². Therefore, P² / A equals 4 π, and a quarter of that equals π. According to the isoperimetric inequality, among all closed curves in the plane of fixed perimeter, a circle maximizes the area of its enclosed region. Therefore, the closer a shape is to a circle, the closer its (1/4) P² / A value is to π. This method is used to measure the roundness of the shape you've drawn.
| Status | Released |
| Platforms | HTML5 |
| Rating | Rated 5.0 out of 5 stars (5 total ratings) |
| Author | matrix67 |
| Genre | Educational |
| Tags | Drawing, High Score |
| Average session | A few seconds |
| Languages | English |
| Inputs | Mouse, Touchscreen |

Comments
Log in with itch.io to leave a comment.
Possible highest score, using JS:
in https://html-classic.itch.zone/html/9930300/index.html
function Circle(x, y, radius, steps, n) { const canvas = document.getElementById('canvas'); let angle = 0; const change = (2 * Math.PI) / steps; let newX = x + radius; let newY = y; let mouseDownEvent = new MouseEvent('mousedown', { clientX: newX, clientY: newY }); canvas.dispatchEvent(mouseDownEvent); for(i=0;i<steps * n;i++){ angle += change newX = x + radius * Math.cos(angle); newY = y + radius * Math.sin(angle); let mouseMoveEvent = new MouseEvent('mousemove', { clientX: newX, clientY: newY }); canvas.dispatchEvent(mouseMoveEvent); }; let mouseUpEvent = new MouseEvent('mouseup'); canvas.dispatchEvent(mouseUpEvent); } Circle(700, 700, 10000000, 10000, 1)My Best:3.148596-S+
PI<3.15-S+ <3.16-S <3.17-A+ <3.18-A <3.2-B+ <3.3-B <3.4-C <4-D >4-D-
123
3.20
with samsung tablet and spen :3
GPT is really changing everything... While others already posted a perfect score using a program, I also used GPT-4 to achieve that in one shot. Just copy paste the code and it just works. What's really impressive is, I also cloned this game in 3 minutes with GPT's help. The cloned page is here: https://yage.ai/circle.html . And the specific prompt I used can be found in this link: https://chat.openai.com/share/96575893-4961-4f1b-8bdd-5c8715ae768e
This was the best I could do free-hand with a regular ol' wired PC mouse. I'm satisfied:
3.196583
Cheat, but still by hand
cheat
wow!how?
so amazing
import math import time from pynput.mouse import Controller, Button circle_radius = 350 circle_center_x = 1200 circle_center_y = 500 duration = 5 mouse = Controller() mouse.position = (1550, 500) mouse.press(Button.left) start_time = time.time() elapsed_time = 0 while elapsed_time < duration: current_angle = (elapsed_time / duration) * 2 * math.pi x = circle_center_x + int(circle_radius * math.cos(current_angle)) y = circle_center_y + int(circle_radius * math.sin(current_angle)) mouse.position = (x, y) elapsed_time = time.time() - start_time mouse.release(Button.left) mouse.position = (circle_center_x, circle_center_y)import time import pyautogui import math from decimal import Decimal # 获取窗口左上角坐标和宽度、高度 window_name = "Pi Day Challenge by matrix67" window_info = pyautogui.getWindowsWithTitle(window_name)[0] window_left = window_info.left window_top = window_info.top window_width = window_info.width window_height = window_info.height # 点击窗口标题栏,将焦点切换到指定窗口 window_info.activate() # 计算圆的半径 radius = Decimal(664) # 计算圆心坐标 center_x = window_left + window_width // 2 center_y = window_top + window_height // 2+Decimal(90) # 点击窗口标题栏,将焦点切换到指定窗口 pyautogui.click(window_info.left + 50, window_info.top + 10) # 计算圆上某一点的坐标 angle = 0 # 将角度设置为圆的某个角度,这里设为 45 度 a = center_x + radius * Decimal(math.cos(angle)) b = center_y + radius * Decimal(math.sin(angle)) pyautogui.moveTo(a, b, duration=0) # 按下鼠标左键 pyautogui.mouseDown(button='left') time.sleep(0.5) # 绘制圆形 steps = 100 for step in range(steps+1): angle = (Decimal(2) * Decimal(math.pi) / Decimal(steps)) * Decimal(step) x = center_x + radius * Decimal(math.cos(angle)) y = center_y + radius * Decimal(math.sin(angle)) pyautogui.moveTo(x, y, duration=0) # 抬起鼠标左键 pyautogui.mouseUp(button='left') # 恢复鼠标位置 pyautogui.moveTo(center_x, center_y, duration=0)import time import pyautogui import math # 获取窗口左上角坐标和宽度、高度 window_name = "Pi Day Challenge by matrix67" window_info = pyautogui.getWindowsWithTitle(window_name)[0] window_left = window_info.left window_top = window_info.top window_width = window_info.width window_height = window_info.height # 点击窗口标题栏,将焦点切换到指定窗口 window_info.activate() # 计算圆的半径 radius = 664.95 # 计算圆心坐标 center_x = window_left + window_width // 2 center_y = window_top + window_height // 2+90 # 点击窗口标题栏,将焦点切换到指定窗口 pyautogui.click(window_info.left + 50, window_info.top + 10) # 计算圆上某一点的坐标 angle = 0 # 将角度设置为圆的某个角度,这里设为 45 度 a = int(center_x + radius * math.cos(angle)) b = int(center_y + radius * math.sin(angle)) pyautogui.moveTo(a, b, duration=0) # 按下鼠标左键 pyautogui.mouseDown(button='left') time.sleep(0.5) # 绘制圆形 steps = 100 for step in range(steps+1): angle = (2 * math.pi / steps) * step x = int(center_x + radius * math.cos(angle)) y = int(center_y + radius * math.sin(angle)) pyautogui.moveTo(x, y, duration=0) # 抬起鼠标左键 pyautogui.mouseUp(button='left') # 恢复鼠标位置 pyautogui.moveTo(center_x, center_y, duration=0)Wow That's wild, game destroyed
I wish I was a circle.
Managed to snag an S+ score, but let’s be real, it was all thanks to some sneaky pyautogui wizardry. I’m basically the cheater’s champion of the pi-day-challenge!
Fun, needs better resolution to go for high scores.
With mouse
draw with ahk
F8:: MouseGetPos, startX, startY radius := 600 pi:= 4 * ATan(1) centerX := startX centerY := startY-radius step := 120 Loop,120 { x:=centerX+Round(radius*Sin(A_Index*(360/step)*pi/180),0) y:=centerY+Round(radius*Cos(A_Index*(360/step)*pi/180),0) MouseMove, x, y, 0 } return ESC:: ExitApp