MCPcopy Create free account
hub / github.com/bedroombuilds/python2rust / neighbor

Method neighbor

29_pattern_matching_revisited/python/cmd_split.py:14–26  ·  view source on GitHub ↗
(self, direction)

Source from the content-addressed store, hash-verified

12 def describe(self):
13 print("the room is dark and small, it contains", self.objects);
14 def neighbor(self, direction):
15 match direction:
16 case "left":
17 print("changed to room", direction)
18 return Room(set(["knife", "bread", "butter"]))
19 case "north":
20 print("changed to room", direction)
21 return Room(set(["polar-bear", "ice", "snow"]))
22 case "right" |"front" |"back":
23 print("No Room", direction)
24 case _:
25 print("unknown direction")
26 return self
27
28class Character:
29 def __init__(self):

Callers 1

cmd_split.pyFile · 0.45

Calls 2

RoomClass · 0.70
printFunction · 0.50

Tested by

no test coverage detected