Untitled
unknown
plain_text
10 months ago
872 B
13
Indexable
MAX_X = 9
MAX_Y = 4
class State:
x: int
y: int
def sum_x_y(self):
return self.x + self.y
def pour_full_x(self):
if self.x < MAX_X:
print("Pour full X")
self.x = MAX_X
return 1
print("Fail to pour full X")
return 0
def pour_full_y(self):
if self.y < MAX_Y:
print("Pour full X")
self.y = MAX_Y
return 1
return 0
def pour_x_to_y(self):
if self.y < MAX_Y:
print("Pour X to Y")
self.y = min(self.sum_x_y(), MAX_Y)
def pour_y_to_x(self):
print("Pour Y to X")
self.x = min(self.sum_x_y(), MAX_X)
def empty_x(self):
print("Empty X")
self.x = 0
def empty_y(self):
print("Empty Y")
self.y = 0
Editor is loading...
Leave a Comment