<commit_before>#!/usr/bin/python

#
# Tutorial 7 shows how to introduce mortality your game.
#

from advent import *
from advent_devtools import *


# We'll start out with our familiar brightworks entryway:

game = Game("Brightworks Adventure")

sidewalk = game.new_location(
  "Sidewalk",
  "There is a large glass door to the east. The sign says 'Come In!'")

vestibule = game.new_location(
  "Vestibule",
"""A small area at the bottom of a flight of stairs.
There is a glass door to the west and door to the south.""")

office = game.new_location(
  "Office",
"""A nicely organized office.
There is a door to the north.""")

game.new_connection("Glass Door", sidewalk, vestibule, [IN, EAST], [OUT, WEST])
game.new_connection("Office Door", vestibule, office, [IN, SOUTH], [OUT, NORTH])

cat = Pet("cat")
cat.set_location(sidewalk)

player = game.new_player(sidewalk)

#
# Lets put a deadly object in the office:
# The object is a Drink and the arguments we pass to Drink() are:
#   - name of the object "vial"
#   - description of the object "a small vial of..."
#   - a verb to perform when the Drink is consumed, we use the Die() verb
#     which kills any actor that performs it, after printing out the text
#     provided to Die()
#   - an Object() to replace the vial after it is consumed, "empty vial"
#
# Try the following commands in this tutorial:
# > drink vial
# you will need to restart the game now :)
# > look
# > tell cat drink vial
# > look
# 
sidewalk.add_object(Drink("vial",
                          "a small vial of dark sinister looking liquid",
                          Die("choking violently and collapsing onto the floor..."),
                          Object("empty vial", "an empty vial with an acrid odor")))

            
# add our player to the game
game.add_actor(player)

# and let's add a test to check the code we wrote above:
test_script = Script("test",
"""
> look
> take vial
> give cat vial
> tell cat drink vial
> look
> end<commit_msg>fix tutorial 7 by adding the cat to the game<commit_after>#!/usr/bin/python

#
# Tutorial 7 shows how to introduce mortality your game.
#

from advent import *
from advent_devtools import *


# We'll start out with our familiar brightworks entryway:

game = Game("Brightworks Adventure")

sidewalk = game.new_location(
  "Sidewalk",
  "There is a large glass door to the east. The sign says 'Come In!'")

vestibule = game.new_location(
  "Vestibule",
"""A small area at the bottom of a flight of stairs.
There is a glass door to the west and door to the south.""")

office = game.new_location(
  "Office",
"""A nicely organized office.
There is a door to the north.""")

game.new_connection("Glass Door", sidewalk, vestibule, [IN, EAST], [OUT, WEST])
game.new_connection("Office Door", vestibule, office, [IN, SOUTH], [OUT, NORTH])

cat = Pet("cat")
cat.set_location(sidewalk)
cat.set_allowed_locations([sidewalk])

player = game.new_player(sidewalk)

#
# Lets put a deadly object in the office:
# The object is a Drink and the arguments we pass to Drink() are:
#   - name of the object "vial"
#   - description of the object "a small vial of..."
#   - a verb to perform when the Drink is consumed, we use the Die() verb
#     which kills any actor that performs it, after printing out the text
#     provided to Die()
#   - an Object() to replace the vial after it is consumed, "empty vial"
#
# Try the following commands in this tutorial:
# > drink vial
# you will need to restart the game now :)
# > look
# > tell cat drink vial
# > look
# 
sidewalk.add_object(Drink("vial",
                          "a small vial of dark sinister looking liquid",
                          Die("choking violently and collapsing onto the floor..."),
                          Object("empty vial", "an empty vial with an acrid odor")))

            
# add our player to the game
game.add_actor(player)

# add the cat to the game
game.add_actor(cat)

# and let's add a test to check the code we wrote above:
test_script = Script("test",
"""
> look
> take vial
> give cat vial
> tell cat drink vial
> look
> end
{'fraction_non_alphanumeric': 0.10235640648011782, 'fraction_numerical': 0.0007363770250368188, 'mean_word_length': 3.26255230125523, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2915315', 'n_tokens_mistral': 1272, 'n_tokens_neox': 1231, 'n_words': 540}