diff options
author | Nguyễn Gia Phong <vn.mcsinyx@gmail.com> | 2018-03-05 23:59:02 +0700 |
---|---|---|
committer | Nguyễn Gia Phong <vn.mcsinyx@gmail.com> | 2018-03-05 23:59:02 +0700 |
commit | 2bafc0c75ac5f9c42593c4905f12bfda66afad1b (patch) | |
tree | cd48730ce038060d84872e740ba84619bb9059c6 /brutalmaze/misc.py | |
parent | 3cf78b680a5301e0a76c908ed153e9d61b62973d (diff) | |
download | brutalmaze-2bafc0c75ac5f9c42593c4905f12bfda66afad1b.tar.gz |
Add documentation for remote control
Diffstat (limited to 'brutalmaze/misc.py')
-rw-r--r-- | brutalmaze/misc.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/brutalmaze/misc.py b/brutalmaze/misc.py index 1047114..e6da56c 100644 --- a/brutalmaze/misc.py +++ b/brutalmaze/misc.py @@ -19,7 +19,7 @@ __doc__ = 'Brutal Maze module for miscellaneous functions' -from math import cos, sin, pi +from math import degrees, cos, sin, pi from random import uniform import pygame @@ -57,6 +57,13 @@ def sign(n): return -1 if n < 0 else 1 if n else 0 +def deg(x): + """Convert angle x from radians to degrees casted to a nonnegative + integer. + """ + return round2((lambda a: a if a > 0 else a + 360)(degrees(x))) + + def cosin(x): """Return the sum of cosine and sine of x (measured in radians).""" return cos(x) + sin(x) |