Skip to content

Commit 36bc7ea

Browse files
authored
LE for style guide consistency (you-focus, spelling, list format, capitalization)
1 parent bb46eca commit 36bc7ea

File tree

12 files changed

+122
-123
lines changed

12 files changed

+122
-123
lines changed

top-python-game-engines/adventurelib/adventurelib_basic.py

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
"""
2-
Basic Hello World program in AdventureLib
2+
Basic "Hello, World!" program in adventurelib
33
44
This program is designed to demonstrate the basic capabilities
5-
of AdventureLib. It will:
6-
- Create a simple three room world
5+
of adventurelib. It will:
6+
- Create a simple three-room world
77
- Add a single inventory item
88
- Require that inventory item to move to the final room
99
"""
1010

1111
# Import the library contents
1212
import adventurelib as adv
1313

14-
# Define our rooms
14+
# Define your rooms
1515
bedroom = adv.Room(
1616
"""
1717
You are in your bedroom. The bed is unmade, but otherwise
@@ -38,9 +38,9 @@
3838
bedroom.south = living_room
3939
living_room.east = front_porch
4040

41-
# Define a constraint to move from the bedroom to the livingroom
41+
# Define a constraint to move from the bedroom to the living room
4242
# If the door between the living room and front porch door is locked,
43-
# we can't exit
43+
# you can't exit
4444
living_room.locked = {"east": True}
4545

4646
# None of the other rooms have any locked doors
@@ -61,7 +61,7 @@ def unlock_living_room(current_room):
6161
print("There is nothing to unlock here.")
6262

6363

64-
# Create our items
64+
# Create your items
6565
key = adv.Item("a front door key", "key")
6666
key.use_item = unlock_living_room
6767

@@ -73,11 +73,11 @@ def unlock_living_room(current_room):
7373
# Put the key in the bedroom
7474
bedroom.contents.add(key)
7575

76-
# Setup our current empty inventory
76+
# Set up your current empty inventory
7777
inventory = adv.Bag()
7878

7979

80-
# Define our movement commands
80+
# Define your movement commands
8181
@adv.when("go DIRECTION")
8282
@adv.when("north", direction="north")
8383
@adv.when("south", direction="south")
@@ -88,16 +88,16 @@ def unlock_living_room(current_room):
8888
@adv.when("e", direction="east")
8989
@adv.when("w", direction="west")
9090
def go(direction: str):
91-
"""Processes our moving direction
91+
"""Processes your moving direction
9292
9393
Arguments:
9494
direction {str} -- which direction does the player want to move
9595
"""
9696

97-
# What is our current room
97+
# What is your current room?
9898
global current_room
9999

100-
# Is there an exit in that direction
100+
# Is there an exit in that direction?
101101
next_room = current_room.exit(direction)
102102
if next_room:
103103
# Is the door locked?
@@ -113,7 +113,7 @@ def go(direction: str):
113113
print(f"You can't go {direction}.")
114114

115115

116-
# How do we look at the room
116+
# How do you look at the room?
117117
@adv.when("look")
118118
def look():
119119
"""Looks at the current room"""
@@ -130,20 +130,20 @@ def look():
130130
print(f"The following exits are present: {current_room.exits()}")
131131

132132

133-
# How do we look at items?
133+
# How do you look at items?
134134
@adv.when("look at ITEM")
135135
@adv.when("inspect ITEM")
136136
def look_at(item: str):
137137

138-
# Check if the item is in our inventory or not
138+
# Check if the item is in your inventory or not
139139
obj = inventory.find(item)
140140
if not obj:
141141
print(f"You don't have {item}.")
142142
else:
143143
print(f"It's an {obj}.")
144144

145145

146-
# How do we pick up items?
146+
# How do you pick up items?
147147
@adv.when("take ITEM")
148148
@adv.when("get ITEM")
149149
@adv.when("pickup ITEM")
@@ -163,7 +163,7 @@ def get(item: str):
163163
inventory.add(obj)
164164

165165

166-
# How do we use an item?
166+
# How do you use an item?
167167
@adv.when("unlock door", item="key")
168168
@adv.when("use ITEM")
169169
def use(item: str):
@@ -175,7 +175,7 @@ def use(item: str):
175175

176176
global inventory
177177

178-
# First, do we have the item?
178+
# First, do you have the item?
179179
obj = inventory.take(item)
180180
if not obj:
181181
print(f"You don't have {item}")
@@ -186,7 +186,7 @@ def use(item: str):
186186

187187

188188
if __name__ == "__main__":
189-
# Look at out starting room
189+
# Look at the starting room
190190
look()
191191

192192
adv.start()

top-python-game-engines/adventurelib/adventurelib_game.py

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,40 @@
11
"""
2-
Complete game written in AdventureLib
2+
Complete game written in adventurelib
33
44
This program is designed to demonstrate the capabilities
5-
of AdventureLib. It will:
5+
of adventurelib. It will:
66
- Create a large world in which to wander
77
- Contain several inventory items
88
- Set contexts for moving from one area to another
9-
- Require some puzzle solving skills
9+
- Require some puzzle-solving skills
1010
"""
1111

1212
# Import the library contents
1313
# from adventurelib import *
1414
import adventurelib as adv
1515

16-
# Import our rooms, which imports our items and characters
16+
# Import your rooms, which imports your items and characters
1717
import adventurelib_game_rooms
1818

1919
import adventurelib_game_items
2020

21-
# For our battle sequence
21+
# For your battle sequence
2222
from random import randint
2323

24-
# To allow us to exit the game
24+
# To allow you to exit the game
2525
import sys
2626

2727
# Set the first room
2828
current_room = adventurelib_game_rooms.home
2929
current_room.visited = False
3030

31-
# How many HP do we have
31+
# How many HP do you have?
3232
hit_points = 20
3333

3434
# How many HP does the giant have?
3535
giant_hit_points = 50
3636

37-
# Our current inventory
37+
# Your current inventory
3838
inventory = adv.Bag()
3939

4040

@@ -66,7 +66,7 @@ def look_at(item: str):
6666
# Check if the item is in the room
6767
obj = current_room.items.find(item)
6868
if not obj:
69-
# Check if the item is in our inventory
69+
# Check if the item is in your inventory
7070
obj = inventory.find(item)
7171
if not obj:
7272
print(f"I can't find {item} anywhere.")
@@ -80,7 +80,7 @@ def look_at(item: str):
8080
def describe(item: str):
8181
"""Prints a description of an item if it is either:
8282
1. in the current room, or
83-
2. in our inventory
83+
2. in your inventory
8484
8585
Arguments:
8686
item {str} -- the item to look at
@@ -91,7 +91,7 @@ def describe(item: str):
9191
# Check if the item is in the room
9292
obj = current_room.items.find(item)
9393
if not obj:
94-
# Check if the item is in our inventory
94+
# Check if the item is in your inventory
9595
obj = inventory.find(item)
9696
if not obj:
9797
print(f"I can't find {item} anywhere.")
@@ -121,7 +121,7 @@ def take_item(item: str):
121121
def eat(item: str):
122122
global inventory
123123

124-
# Make sure we have the thing first
124+
# Make sure you have the thing first
125125
obj = inventory.find(item)
126126

127127
# Do you have this thing?
@@ -142,14 +142,14 @@ def eat(item: str):
142142
def wear(item: str):
143143
global inventory
144144

145-
# Make sure we have the thing first
145+
# Make sure you have the thing first
146146
obj = inventory.find(item)
147147

148148
# Do you have this thing?
149149
if not obj:
150150
print(f"You don't have {item}.")
151151

152-
# Is it wearable
152+
# Is it wearable?
153153
elif obj.wearable:
154154
print(f"The {obj.description} makes a wonderful fashion statement!")
155155

@@ -160,7 +160,7 @@ def wear(item: str):
160160
)
161161

162162

163-
# Some character specific commands
163+
# Some character-specific commands
164164
@adv.when("talk to CHARACTER")
165165
def talk_to(character: str):
166166
global current_room
@@ -412,7 +412,7 @@ def flee():
412412
@adv.when("later")
413413
def goodbye():
414414

415-
# Are we fighting the giant?
415+
# Are you fighting the giant?
416416
if adv.get_context() == "giant":
417417
# Not so fast!
418418
print("The giant steps in front of you, blocking your exit!")
@@ -427,7 +427,7 @@ def goodbye():
427427
@adv.when("look")
428428
def look():
429429
"""Print the description of the current room.
430-
If we've already visited it, print a short description.
430+
If you've already visited it, print a short description.
431431
"""
432432
global current_room
433433

@@ -452,7 +452,7 @@ def describe_room():
452452
print(f"There is {item.description} here.")
453453

454454

455-
# Define our movement commands
455+
# Define your movement commands
456456
@adv.when("go DIRECTION")
457457
@adv.when("north", direction="north")
458458
@adv.when("south", direction="south")
@@ -463,16 +463,16 @@ def describe_room():
463463
@adv.when("e", direction="east")
464464
@adv.when("w", direction="west")
465465
def go(direction: str):
466-
"""Processes our moving direction
466+
"""Processes your moving direction
467467
468468
Arguments:
469469
direction {str} -- which direction does the player want to move
470470
"""
471471

472-
# What is our current room
472+
# What is your current room
473473
global current_room
474474

475-
# Is there an exit in that direction
475+
# Is there an exit in that direction?
476476
next_room = current_room.exit(direction)
477477
if next_room:
478478
# Is the door locked?
@@ -510,7 +510,7 @@ def my_prompt():
510510
# Get possible exits
511511
exits_string = get_exits(current_room)
512512

513-
# Are we in battle?
513+
# Are you in battle?
514514
if adv.get_context() == "giant":
515515
prompt_string = f"HP: {hit_points} > "
516516
else:
@@ -549,7 +549,7 @@ def get_exits(room):
549549
# What happens with unknown commands
550550
adv.no_command_matches = my_no_command_matches
551551

552-
# Look at our starting room
552+
# Look at your starting room
553553
look()
554554

555555
# Start the game

top-python-game-engines/adventurelib/adventurelib_game_characters.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
"""
2-
Characters for the AdventureLib Game
2+
Characters for the adventurelib Game
33
"""
44

5-
# Import the AdventureLib library
5+
# Import the adventurelib library
66
import adventurelib as adv
77

88
# All characters have some properties
99
adv.Item.greeting = ""
1010
adv.Item.context = ""
1111

12-
# Our characters
12+
# Your characters
1313
elder_barron = adv.Item("Elder Barron", "elder", "barron")
1414
elder_barron.description = """Elder Barron, a tall distinguished member
1515
of the community. His steely grey hair and stiff beard inspire confidence."""

top-python-game-engines/adventurelib/adventurelib_game_items.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
"""
2-
Items for the AdventureLib Game
2+
Items for the adventurelib Game
33
"""
44

5-
# Import the AdventureLib library
5+
# Import the adventurelib library
66
import adventurelib as adv
77

88
# All items have some basic properties
@@ -11,8 +11,7 @@
1111
adv.Item.edible = False
1212
adv.Item.wearable = False
1313

14-
# Create our "flavor" items
15-
# Apple
14+
# Create your "flavor" items
1615
apple = adv.Item("small red apple", "apple")
1716
apple.color = "red"
1817
apple.description = "a small ripe red apple"
@@ -33,7 +32,7 @@
3332
slug.edible = True
3433
slug.wearable = False
3534

36-
# Create the real items we need
35+
# Create the real items you need
3736
wooden_sword = adv.Item("wooden sword", "sword")
3837
wooden_sword.color = "brown"
3938
wooden_sword.description = (

top-python-game-engines/adventurelib/adventurelib_game_rooms.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
"""
2-
Rooms for the AdventureLib game
2+
Rooms for the adventurelib game
33
"""
44

55
# Import the library contents
66
import adventurelib as adv
77

8-
# Import our items as well
8+
# Import your items as well
99
import adventurelib_game_items
1010

11-
# And our characters
11+
# And your characters
1212
import adventurelib_game_characters
1313

1414

@@ -32,7 +32,7 @@ def __init__(self, description: str):
3232
self.characters = adv.Bag()
3333

3434
# All areas may have been visited already
35-
# If so, we can print a shorter description
35+
# If so, you can print a shorter description
3636
self.visited = False
3737

3838
# Which means each area needs a shorter description
@@ -176,7 +176,7 @@ def __init__(self, description: str):
176176
giant_cave.title = "Cave of the Giant"
177177
giant_cave.short_desc = "You are in the giant's cave."
178178

179-
# Setup the paths between areas
179+
# Set up the paths between areas
180180
home.south = hamlet
181181
hamlet.south = fork
182182
fork.west = village

0 commit comments

Comments
 (0)