Skip to main content
Performed a byte recount using http://mothereff.in/byte-counter#from%20win32api%20import%2a%0Afrom%20msvcrt%20import%2a%0As%3D137%0AG%3DGetSystemMetrics%0AS%3DSetCursorPos%0Ax%3DG%280%29%2F%2F2%0Ay%3DG%281%29%2F%2F2%0Ac%3D3%2a%2a.5%0AY%3Dy-2%2as%2Fc%0AS%28%28x%2Cy%29%29%0Awhile%28kbhit%28%29and%20or
Source Link
Tymric
  • 671
  • 4
  • 14

Python 418 351 314 300 275263 Bytes

Edit: Saved 67 104 118 143155 Bytes thanks to the advice in the comments

from win32api import*
from msvcrt import*
s=137
G=GetSystemMetrics
S=SetCursorPos
x=G(0)//2
y=G(1)//2
c=3**.5
Y=y-2*s/c
S((x,y))
while(kbhit()and ord(getch())==27)<1:a,b=GetCursorPos();S((min(max(a,x-s),x+s),min(max(b,int(c*a+Y-c*x),int(-c*a+Y+c*x)),int(y+s/c))))

Written in Python 3.4.1 on Windows, pywin needs to be installed.

My first code golf submission. Please feel free to suggest improvements

Python 418 351 314 300 275 Bytes

Edit: Saved 67 104 118 143 Bytes thanks to the advice in the comments

from win32api import*
from msvcrt import*
s=137
G=GetSystemMetrics
S=SetCursorPos
x=G(0)//2
y=G(1)//2
c=3**.5
Y=y-2*s/c
S((x,y))
while(kbhit()and ord(getch())==27)<1:a,b=GetCursorPos();S((min(max(a,x-s),x+s),min(max(b,int(c*a+Y-c*x),int(-c*a+Y+c*x)),int(y+s/c))))

Written in Python 3.4.1 on Windows, pywin needs to be installed.

My first code golf submission. Please feel free to suggest improvements

Python 418 351 314 300 263 Bytes

Edit: Saved 67 104 118 155 Bytes thanks to the advice in the comments

from win32api import*
from msvcrt import*
s=137
G=GetSystemMetrics
S=SetCursorPos
x=G(0)//2
y=G(1)//2
c=3**.5
Y=y-2*s/c
S((x,y))
while(kbhit()and ord(getch())==27)<1:a,b=GetCursorPos();S((min(max(a,x-s),x+s),min(max(b,int(c*a+Y-c*x),int(-c*a+Y+c*x)),int(y+s/c))))

Written in Python 3.4.1 on Windows, pywin needs to be installed.

My first code golf submission. Please feel free to suggest improvements

added 3 characters in body
Source Link
Tymric
  • 671
  • 4
  • 14

Python 418 351 314 300 276275 Bytes

Edit: Saved 67 104 118 142143 Bytes thanks to the advice in the comments

from win32api import*
from msvcrt import*
s=137
G=GetSystemMetrics
S=SetCursorPos
x=G(0)//2
y=G(1)//2
c=3**.5
Y=y-2*s/c
S((x,y))
while 1>(kbhit()and ord(getch())==27)<1:a,b=GetCursorPos();S((min(max(a,x-s),x+s),min(max(b,int(c*a+Y-c*x),int(-c*a+Y+c*x)),int(y+s/c))))

Written in Python 3.4.1 on Windows, pywin needs to be installed.

My first code golf submission. Please feel free to suggest improvements

Python 418 351 314 300 276 Bytes

Edit: Saved 67 104 118 142 Bytes thanks to the advice in the comments

from win32api import*
from msvcrt import*
s=137
G=GetSystemMetrics
S=SetCursorPos
x=G(0)//2
y=G(1)//2
c=3**.5
Y=y-2*s/c
S((x,y))
while 1>(kbhit()and ord(getch())==27):a,b=GetCursorPos();S((min(max(a,x-s),x+s),min(max(b,int(c*a+Y-c*x),int(-c*a+Y+c*x)),int(y+s/c))))

Written in Python 3.4.1 on Windows, pywin needs to be installed.

My first code golf submission. Please feel free to suggest improvements

Python 418 351 314 300 275 Bytes

Edit: Saved 67 104 118 143 Bytes thanks to the advice in the comments

from win32api import*
from msvcrt import*
s=137
G=GetSystemMetrics
S=SetCursorPos
x=G(0)//2
y=G(1)//2
c=3**.5
Y=y-2*s/c
S((x,y))
while(kbhit()and ord(getch())==27)<1:a,b=GetCursorPos();S((min(max(a,x-s),x+s),min(max(b,int(c*a+Y-c*x),int(-c*a+Y+c*x)),int(y+s/c))))

Written in Python 3.4.1 on Windows, pywin needs to be installed.

My first code golf submission. Please feel free to suggest improvements

deleted 13 characters in body
Source Link
Tymric
  • 671
  • 4
  • 14

Python 418 351 314 300 288276 Bytes

Edit: Saved 67 104 118 130142 Bytes thanks to the advice in the comments

from win32api import*
from msvcrt import*
s=137
G=GetSystemMetrics
S=SetCursorPos
x=G(0)//2
y=G(1)//2
c=3**.5
Y=y-2*s/c
S((x,y))
while 1:
1>(kbhit()and ord(getch())==27):a,b=GetCursorPos();S((min(max(a,x-s),x+s),min(max(b,int(c*a+Y-c*x),int(-c*a+Y+c*x)),int(y+s/c))))
 if kbhit()and ord(getch())==27:break

Written in Python 3.4.1 on Windows, pywin needs to be installed.

My first code golf submission. Please feel free to suggest improvements

Python 418 351 314 300 288 Bytes

Edit: Saved 67 104 118 130 Bytes thanks to the advice in the comments

from win32api import*
from msvcrt import*
s=137
G=GetSystemMetrics
S=SetCursorPos
x=G(0)//2
y=G(1)//2
c=3**.5
Y=y-2*s/c
S((x,y))
while 1:
 a,b=GetCursorPos();S((min(max(a,x-s),x+s),min(max(b,int(c*a+Y-c*x),int(-c*a+Y+c*x)),int(y+s/c))))
 if kbhit()and ord(getch())==27:break

Written in Python 3.4.1 on Windows, pywin needs to be installed.

My first code golf submission. Please feel free to suggest improvements

Python 418 351 314 300 276 Bytes

Edit: Saved 67 104 118 142 Bytes thanks to the advice in the comments

from win32api import*
from msvcrt import*
s=137
G=GetSystemMetrics
S=SetCursorPos
x=G(0)//2
y=G(1)//2
c=3**.5
Y=y-2*s/c
S((x,y))
while 1>(kbhit()and ord(getch())==27):a,b=GetCursorPos();S((min(max(a,x-s),x+s),min(max(b,int(c*a+Y-c*x),int(-c*a+Y+c*x)),int(y+s/c))))

Written in Python 3.4.1 on Windows, pywin needs to be installed.

My first code golf submission. Please feel free to suggest improvements

deleted 2 characters in body
Source Link
Tymric
  • 671
  • 4
  • 14
Loading
added 1 character in body
Source Link
Tymric
  • 671
  • 4
  • 14
Loading
deleted 11 characters in body
Source Link
Tymric
  • 671
  • 4
  • 14
Loading
deleted 4 characters in body
Source Link
Tymric
  • 671
  • 4
  • 14
Loading
deleted 36 characters in body
Source Link
Tymric
  • 671
  • 4
  • 14
Loading
Source Link
Tymric
  • 671
  • 4
  • 14
Loading