import random
from characters import guests as people
from adventurelib import when, start
import rooms
from sys import exit


murder_config_people = list(people)
random.shuffle(murder_config_people)
murder_location = random.choice(list(rooms.rooms))
murderer = random.choice(list(people))


current_config_people = list(people)
random.shuffle(current_config_people)
current_location = random.choice(list(rooms.rooms))

@when('where am i')
def my_room():
    print("I am in: ", current_location)

@when('go to ROOM')
@when('go to the ROOM')
def to_room(room):
    global current_location
    r = rooms.rooms.find(room)
    if current_location == r:
        print("I am already in %s" % room)
    elif r:
        print("I am now in %s" % room)
        current_location = r
    else:
        print("I can't find the %s" % room)

@when('it was PERSON')
def accuse(person):
    p = people.find(person)
    if p == murderer:
        print ("Yes, %s is the murderer!" % p)
        exit
    else:
        if p:
            print ("%s said: 'How could you!'" % p)
        else:
            print ("No one has ever heard of '%s'!" % person)


start()

@@ -972,16 +972,18 @@
     exit
+()
 %0A    els
@@ -1128,16 +1128,313 @@
 erson)%0A%0A
+@when('in the ROOM')%0Adef locate(room):%0A    r = rooms.rooms.find(room)%0A    if murder_location == r:%0A        print(%22Yes, the murder happpened in %25s%22 %25 room)%0A        exit()%0A    elif r:%0A        print(%22No, there was no murder in the %25s%22 %25 room)%0A    else:%0A        print(%22Never heard of the %25s%22 %25 room)%0A%0A
 %0Astart()

add locate