Advertisement
Guest User

Untitled

a guest
Dec 8th, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.07 KB | None | 0 0
  1. initial_angle = 0xD078%65536 #### Input as hex or a signed or unsigned integer (python treats hex like a decimal integer; the mod 65536 allows for signed int input)
  2. goal_angle_list = [0x0720, 0x0AF2, 0x0EEA] #### These are the working angles for sun's song
  3.  
  4. if initial_angle > 65535 or initial_angle < 0 or isinstance(initial_angle, int) == False:
  5.     print('Error: The initial angle is not a valid input')
  6.  
  7. Solution_Found = False
  8. for i in range(8192):
  9.     for angle in goal_angle_list:
  10.         if (initial_angle + i*1800)%65536 == angle:
  11.             Solution_Found = True
  12.             print("%d = %s is a working initial angle with %d Left ESS turns for goal angle %d = %s" %(initial_angle, hex(initial_angle), i, angle, hex(angle)))
  13.        
  14.         if (initial_angle - i*1800)%65536 == angle:
  15.             Solution_Found = True
  16.             print("%d = %s is a working initial angle with %d Right ESS turns for goal angle %d = %s" %(initial_angle, hex(initial_angle), i, angle, hex(angle)))
  17.  
  18. if Solution_Found == False:
  19.     print("No solutions were found for this initial angle.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement