modify output format
This commit is contained in:
parent
b0eb9a40db
commit
8eb2e55057
@ -16,7 +16,7 @@ import numpy as np
|
||||
import os
|
||||
import math
|
||||
|
||||
File_Directory = 'drive/MyDrive/Ecole/PolyHash2022/DataSet/'
|
||||
File_Directory = 'drive/MyDrive/polyhash/DataSet/'
|
||||
File_Name = 'f_festive_flyover.in.txt'
|
||||
File_Path = File_Directory+File_Name
|
||||
|
||||
@ -138,7 +138,7 @@ class Santa:
|
||||
assert self.isAllowedBySpeedLimit(s)
|
||||
self.speed[1] += s
|
||||
self.consumeCarrot()
|
||||
print("AccUp:",s)
|
||||
print("AccUp",int(s))
|
||||
else:
|
||||
pass
|
||||
def AccDown(self, s):
|
||||
@ -146,7 +146,7 @@ class Santa:
|
||||
assert self.isAllowedBySpeedLimit(s)
|
||||
self.speed[1] -= s
|
||||
self.consumeCarrot()
|
||||
print("AccLeft:",s)
|
||||
print("AccDown",int(s))
|
||||
else:
|
||||
pass
|
||||
def AccRight(self, s):
|
||||
@ -154,7 +154,7 @@ class Santa:
|
||||
assert self.isAllowedBySpeedLimit(s)
|
||||
self.speed[0] += s
|
||||
self.consumeCarrot()
|
||||
print("AccRight:",s)
|
||||
print("AccRight",int(s))
|
||||
else:
|
||||
pass
|
||||
def AccLeft(self, s):
|
||||
@ -162,7 +162,7 @@ class Santa:
|
||||
assert self.isAllowedBySpeedLimit(s)
|
||||
self.speed[0] -= s
|
||||
self.consumeCarrot()
|
||||
print("AccLeft:",s)
|
||||
print("AccLeft",int(s))
|
||||
else:
|
||||
pass
|
||||
|
||||
@ -177,7 +177,7 @@ class Santa:
|
||||
self.weightOfGift -= p.weightOfGift
|
||||
assert self.weightOfGift >= 0
|
||||
p.getScore()
|
||||
print("Delivert gift to",p.name)
|
||||
print("DeliverGift",p.name)
|
||||
else:
|
||||
pass
|
||||
|
||||
@ -186,9 +186,9 @@ class Santa:
|
||||
self.position[0] += self.speed[0] * t
|
||||
self.position[1] += self.speed[1] * t
|
||||
self.timeLimit -= t
|
||||
print("Float:",t)
|
||||
print("Float",int(t))
|
||||
else:
|
||||
pass
|
||||
self.timeLimit -= self.timeLimit
|
||||
|
||||
def getSituation(self):
|
||||
print("Now position is:",self.position)
|
||||
@ -214,6 +214,7 @@ class Santa:
|
||||
self.Float(1)
|
||||
|
||||
self.DiliveryGift(p)
|
||||
v = self.nowSpeedLimit()
|
||||
|
||||
t = x/v
|
||||
self.AccDown(v)
|
||||
@ -230,6 +231,7 @@ class Santa:
|
||||
self.Float(1)
|
||||
|
||||
self.DiliveryGift(p)
|
||||
v = self.nowSpeedLimit()
|
||||
|
||||
t = abs(x)/v
|
||||
self.AccUp(v)
|
||||
@ -245,6 +247,7 @@ class Santa:
|
||||
self.Float(1)
|
||||
|
||||
self.DiliveryGift(p)
|
||||
v = self.nowSpeedLimit()
|
||||
|
||||
v = x
|
||||
self.AccDown(v)
|
||||
@ -260,8 +263,9 @@ class Santa:
|
||||
self.Float(1)
|
||||
|
||||
self.DiliveryGift(p)
|
||||
v = self.nowSpeedLimit()
|
||||
|
||||
v = x
|
||||
v = abs(x)
|
||||
self.AccUp(v)
|
||||
self.Float(1)
|
||||
self.AccDown(v)
|
||||
@ -278,6 +282,7 @@ class Santa:
|
||||
self.Float(1)
|
||||
|
||||
self.DiliveryGift(p)
|
||||
v = self.nowSpeedLimit()
|
||||
|
||||
t = x//v
|
||||
v1 = v - (x - t*v)
|
||||
@ -299,6 +304,7 @@ class Santa:
|
||||
self.Float(1)
|
||||
|
||||
self.DiliveryGift(p)
|
||||
v = self.nowSpeedLimit()
|
||||
|
||||
t = abs(x)//v
|
||||
v1 = v - (abs(x) - t*v)
|
||||
@ -308,14 +314,15 @@ class Santa:
|
||||
self.Float(1)
|
||||
self.AccDown(v - v1)
|
||||
self.Float(1)
|
||||
|
||||
|
||||
else:
|
||||
self.DiliveryGift(p)
|
||||
|
||||
def oneWay(self, p:Person):
|
||||
if self.timeLimit >0:
|
||||
self.LoadCarrots(12)
|
||||
print("LoarCarrots:12")
|
||||
print("LoadCarrots 12")
|
||||
self.LoadGift(p.weightOfGift)
|
||||
print("LoarGift:",p.weightOfGift)
|
||||
print("LoadGift",p.name)
|
||||
v = self.nowSpeedLimit()
|
||||
if isinstance(p.x_position/v,int) and p.x_position > 0 :
|
||||
t = p.x_position/v
|
||||
@ -330,7 +337,7 @@ class Santa:
|
||||
self.AccLeft(v)
|
||||
self.Float(t)
|
||||
self.AccRight(v)
|
||||
self.Float()
|
||||
self.Float(1)
|
||||
|
||||
|
||||
elif isinstance(p.x_position/v,int) and p.x_position < 0:
|
||||
@ -372,7 +379,7 @@ class Santa:
|
||||
|
||||
self.kidoneWay(p.y_position,p)
|
||||
|
||||
v = p.x_position
|
||||
v = abs(p.x_position)
|
||||
self.AccRight(v)
|
||||
self.Float(1)
|
||||
self.AccLeft(v)
|
||||
@ -421,7 +428,6 @@ class Santa:
|
||||
self.Float(1)
|
||||
elif p.x_position == 0 :
|
||||
self.kidoneWay(p.y_position,p)
|
||||
print("Get score:",Score)
|
||||
|
||||
s = Santa()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user