Write the shortest program possible that traps the mouse cursor inside an upward pointing equilateral triangle with a side length of 274 pixels and a centroid at the exact middle of the screen.
(Triangle because of cheese wedges.)
While your program is running, the tip of the cursor should never be able to move outside of this triangle, and should move and function normally inside. When the Esc
key is hit the program must end, releasing the mouse.
Scoring
This is code-golf, the shortest code in bytes wins. You may only use standard ASCII.
Details
- Besides things like shutting off the computer or killing the process or pressing
Alt-F4
orCtrl-Alt-Delete
, the only way to release the cursor should be theEsc
key. - If the cursor is outside the triangle when the program starts it should be placed somewhere inside.
- The cursor must be able to move smoothly up and down the two angled sides of the triangles.
- If the display is extended over multiple monitors the triangle may appear in the center of any one monitor or the center of all of them combined. (If you only have one monitor you do not need to test for this.)
- It's fine if touchscreen users can still click things outside the triangle.
Tiny bonus question: Where did I get 274 from?