MCPcopy Create free account
hub / github.com/asweigart/PythonStdioGames / displayClue

Function displayClue

src/gamesbyexample/lostkitty.py:71–82  ·  view source on GitHub ↗

Display a clue telling the player that the cat is very near, near, far, or very far away.

(playerx, playery, catx, caty)

Source from the content-addressed store, hash-verified

69
70
71def displayClue(playerx, playery, catx, caty):
72 """Display a clue telling the player that the cat is very near,
73 near, far, or very far away."""
74 distance = getDistance(playerx, playery, catx, caty)
75 if distance <= 2.0:
76 print('You hear a meow very nearby.')
77 elif distance <= 4.0:
78 print('You hear a meow nearby.')
79 elif distance <= 6.0:
80 print('You hear a meow far away.')
81 else:
82 print('You hear a meow very far away.')
83
84
85def getOrdIndicator(number):

Callers 1

mainFunction · 0.85

Calls 1

getDistanceFunction · 0.70

Tested by

no test coverage detected