Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import math
- print "START X: "
- #sx = int(raw_input())
- print "START Y: "
- #sy = int(raw_input())
- sx = 66
- sy = 81
- rot = 0
- ang = 0
- power = 0
- powers = [5, 10, 20, 25, 30, 40, 50, 80, 100]
- def HigherPower(X):
- for result in powers:
- if result > X:
- return result
- def RequestPower():
- key = 0
- while (len(powers) < key) or (key-1<0):
- for indx in range(len(powers)):
- print (str(indx+1) + ": " + str(powers[indx]))
- key = int(raw_input())
- return powers[key-1]
- calibrated = 0
- rot_off = 0
- power_off = 0
- tg45 = 2**0.5
- print "\
- Captains office:\n\
- Captain laser: 48, 47, 1\n\
- Captain ID card: 46, 47, 1\n\
- Captain closet: 44, 47, 1\n\
- "
- print "POWER:"
- power = RequestPower()
- while 1:
- if not calibrated:
- print "Not calibrated"
- print "POWER: " + str(power)
- print "ANG: 45"
- print "ROT: 0"
- print "EX, EY, TIME"
- ex = int(raw_input())
- ey = int(raw_input())
- time = float(raw_input())
- py = time*5
- # 2 * 4 = 8
- power_off = math.trunc(py * tg45 - power)
- print "P_OFF: " + str(power_off)
- dist = ((ex - sx)**2 + (ey - sy)**2)**0.5
- cos_res = (ex-sx)/dist
- rot_off = math.trunc(math.degrees(math.asin(cos_res)))
- #10 = 2 + 2*4 --2
- #8 = 2*4 //2
- #4 = 4
- print "R_OFF: " + str(rot_off)
- power = power + power_off
- calibrated = 1
- print "Where to go?"
- print "DX, DY"
- dx = int(raw_input())
- dy = int(raw_input())
- dst = ((dx - sx)**2 + (dy - sy)**2)**0.5
- rot = math.degrees(math.acos((dx-sx)/dst)) - rot_off
- print "ROT: " + str(rot)
- print "POWER: " + str(power-power_off)
- if ((10*dst) / power**2) >= 1:
- print "TOO FAR, NOT ENOUGH POWER"
- need_power = round((10*dst)**0.5 - power_off)
- print "NEED AT LEAST " + str(HigherPower(need_power)) + " POWER"
- print "ENTER NEW POWER:"
- power = RequestPower()
- power += power_off
- continue
- ang = round(math.degrees(math.asin((10 * dst) / power**2)) / 2)
- print "ANG: " + str(ang)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement