예제 #1
0
 def getZone(self, zoneType, game, event=None, player=None):
     """ Return the zone for the given zone type and game """
     if zoneType == zone_types.CHARACTER:
         return CharacterZone(game.currentTurn.player.character)
     elif zoneType == zone_types.DECK:
         return DeckWithDiscardPileZone(player.deck, zoneType=zone_types.DECK)
     if zoneType == zone_types.DESTROYED:
         return DeckZone(game.destroyedDeck, zoneType=zone_types.DESTROYED)
     elif zoneType == zone_types.DISCARD_PILE:
         return DeckZone(player.discardPile, zoneType=zone_types.DISCARD_PILE)
     elif zoneType == zone_types.EVENT:
         return EventZone(event)
     elif zoneType == zone_types.GAINED:
         return GainedZone(game.currentTurn.gainedCards, self.getZone(zone_types.DISCARD_PILE, game, event=event, player=player))
     elif zoneType == zone_types.HAND:
         return ListZone(player.hand, zoneType=zone_types.HAND)
     elif zoneType == zone_types.KICK:
         return DeckZone(game.kickDeck, zoneType=zone_types.KICK)
     elif zoneType == zone_types.LINE_UP:
         return Zone(game.lineUp)
     elif zoneType == zone_types.MAIN_DECK:
         return DeckZone(game.mainDeck, zoneType=zone_types.MAIN_DECK)
     elif zoneType == zone_types.ONGOING:
         return ListZone(player.ongoing, zoneType=zone_types.ONGOING)
     elif zoneType == zone_types.PLAYED:
         return ListZone(game.currentTurn.playedCards, zoneType=zone_types.PLAYED)
     elif zoneType == zone_types.SUPERVILLAIN:
         return Zone(game.superVillainStack, zoneType=zone_types.SUPERVILLAIN)
     elif zoneType == zone_types.UNDER_CHARACTER:
         return ListZone(player.underCharacter, zoneType=zone_types.UNDER_CHARACTER)
     elif zoneType == zone_types.WEAKNESS:
         return DeckZone(game.weaknessDeck, zoneType=zone_types.WEAKNESS)
     return None
예제 #2
0
def test_exceptions():
    with pytest.raises(ValueError):
        z1 = Zone(0)

    with pytest.raises(ValueError):
        z2 = Zone([1, 2, 3])

    with pytest.raises(ValueError):
        z3 = Zone([1, 2])
예제 #3
0
파일: eclipse.py 프로젝트: bobifle/eclipse
def main(opt):
    configureLogger(opt.verbose)
    if opt.clean:
        log.warning("cleaning the build directory")
        shutil.rmtree('build')
    zone = Zone('Library')
    zone.build(pcs() + npcs() + morphs() + libTokens())
    ecp = Campaign('eclipse')
    dmScreen = Zone('DM Screen')
    ecp.build([zone, dmScreen], propertySets(),
              [eclipseTable(), nameTable(),
               morphTable()])
    log.warning('Done building %s with a total of %s macros, %s assets' %
                (ecp, len(list(ecp.macros)), len(list(ecp.assets))))
    return ecp
예제 #4
0
 def setZones(self, zones):
     try:
         if type(zones[0]) <> type(Zone()):
             print 'The argument must be a Zone list'
     except:
         print 'The argument must be a Zone list'
         pass
예제 #5
0
    def __init__(self):
        self.zone = Zone(100, 100)

        self.merchants = {}
        self.init_merchants(20)

        self.order = {}
예제 #6
0
파일: zones.py 프로젝트: bjf/maasapi
 def __iter__(s):
     center(s.__class__.__name__)
     s.__fetch_if_needed()
     for item in s.__zones:
         n = Zone(s.__maas, item)
         yield n
     cleave(s.__class__.__name__)
예제 #7
0
    def __init__(self, eng):
        self.eng = eng  # get the engine

        # Set up all sprite groups
        self.all_sprites = pg.sprite.Group()  # everything
        self.background = pg.sprite.Group()  # background tiles
        self.foreground = pg.sprite.Group()  # non-interacting blocks
        self.blocks = pg.sprite.Group()  # non-moving sprites that interact
        self.players = pg.sprite.Group()  # sprites you can control
        self.friends = pg.sprite.Group()  # moving friendly sprites
        self.foes = pg.sprite.Group()  # enemies
        self.hud = pg.sprite.Group()  # HUD (health, money etc.)
        self.misc = pg.sprite.Group()  # other (dialog boxes etc.)

        # set up the groups list (this is the order in which you want them to
        #   be drawn)
        self.groups_list = [
            self.background, self.foreground, self.blocks, self.players,
            self.friends, self.foes, self.hud, self.misc
        ]
        # define groups that are diegetic (i.e. groups that exist in the game
        # world and will be affected by camera movement) EXCLUDES players
        self.diegetic_groups = [
            self.background, self.foreground, self.blocks, self.friends,
            self.foes
        ]
        # set up player
        self.player = Player(self)

        # Zone class will set up the blocks and background
        self.current_zone = Zone(self, "zone1")
예제 #8
0
def setup():
    global zones
    GPIO.setmode(GPIO.BCM)
    data = []
    try:
        with open(STATE_FILE) as json_file:
            data = json.load(json_file)
    except:
        logging.debug("State file not available - ignoring")
    print(data)
    if str(1) in data:
        logging.info("State file found for zone %d - Value %f" %
                     (1, data[str(1)]))
        zones.append(Zone(1, 14, 17, data[str(1)]))
    else:
        zones.append(Zone(1, 14, 17))
예제 #9
0
def build_zone_list(term="\n"):
    debug = 1
    if (debug == 1):
        print("in build_zone_list()")

    startZ = 1
    csvindex = 0
    list_of_zones = list()

    #build list of zones from file
    with open('zonedata.csv') as csvfile:
        reader = csv.reader(csvfile, delimiter=',', quotechar='|')
        for row in reader:
            data = row[0]

            if (startZ == 1):
                #zone title
                ztemp = Zone(data)
                list_of_zones.append(ztemp)
                startZ = 0
            elif ("Meta" in data):
                list_of_zones[csvindex].set_meta(data)
            elif ("Policy" in data):
                list_of_zones[csvindex].set_policy(data)
            elif (data == "****"):
                #end of zone section
                startZ = 1
                csvindex = csvindex + 1
            else:
                tmp_net = Network(data)
                list_of_zones[csvindex].add_network(tmp_net)
        #end of for row
    #end of csv

    return (list_of_zones)
예제 #10
0
 def __init__(self):
     self.zones = []
     self.no_mines_left = 0
     for x in range(10):
         self.zones.append([])
         for y in range(10):
             mine = bool(randint(0,9) < 1)
             if mine: self.no_mines_left += 1
             self.zones[x].append(Zone(x, y, mine))
예제 #11
0
    def loadZone(self, name, path):
        if path[len(path)-1] != '/':
            path += '/'

        if self.zone:
            self.zone.rootNode.removeNode()
            
        self.zone = Zone(self, name, path)
        error = self.zone.load()
        if error == 0:
            self.consoleOff()
            self.setFlymodeText()
            base.setBackgroundColor(self.fog_colour)
예제 #12
0
    def __init__(self, mac_data, timestep):
        #print "Wifimodel constructor %s" % self
        self.essid = ""
        self.macaddress = mac_data

        self.zone_raw = Zone()
        self.zone_predicted = Zone()

        self.rssi_raw = 0
        self.rssi_predicted = 0
        self.rssi_delta = 0
        self.rssi_step_delta = 0
        self.rssi_step_predicted = 0

        self.timestamp = 0
        self.timestamp_step_delta = 0

        self.quality_raw = 0
        self.quality_max = 0
        self.aged = 0
        self.history = list() 

        self.cla_model = Predictor(timestep)
예제 #13
0
	def __init__(self, authtoken):
		self.server = 'https://api.rach.io/1/public/'
		self.headers = {
			'Content-Type': 'application/json',
			'Authorization': 'Bearer %s' % authtoken
			}
		self.h = httplib2.Http('.cache')

		self.person = Person(self)
		self.device = Device(self)
		self.zone = Zone(self)
		self.schedulerule = Schedulerule(self)
		self.flexschedulerule = FlexSchedulerule(self)
		self.notification = Notification(self)
예제 #14
0
def qca_sim(fn, **kwargs):
    '''Simulate all possible outcomes for each zone of a given qca circuit'''

    # parse QCADesigner file
    cells, spacing, zones, J, feedback = parse_qca_file(fn, show=False)

    # check for specification of adjacency type
    if 'adj' in kwargs:
        if kwargs['adj'].lower() == 'full':
            J = convert_to_full_adjacency(cells, spacing, J)
        elif kwargs['adj'].lower() == 'lim':
            J = convert_to_lim_adjacency(cells, spacing, J)

    # set the solver type
    if 'solver' in kwargs:
        try:
            solver = SOLVERS[kwargs['solver'].lower()]
        except:
            print('No solver specified. Using default...')
            solver = SOLVERS['default']
    else:
        solver = SOLVERS['default']

    # set up zone formulation
    Gz = construct_zone_graph(cells, zones, J, feedback, show=False)
    Zones = {key: Zone(key, Gz, J, cells, feedback) for key in Gz.nodes()}
    # solve every zone for every possible set of inputs
    solution = Solution(Gz)
    for i in xrange(len(zones)):
        for j in xrange(len(zones[i])):
            key = (i, j)
            cases, outs, z_order = Zones[key].solve_all(solver)
            solution.add_zone(Zones[key], outs, z_order)

    # write solution to file
    solution.write_to_file('./qca_sim_test')

    # run solution inputs (single sets)
    input_inds = solution.get_inputs()

    input_pols = gen_pols(len(input_inds))  # set of all possible input pols

    print 'start'
    out = {}  # dict of outputs lists for each input polarization list
    for pols in input_pols:
        input_pol = {(0, 0): [(pols, )]}
        out[pols] = solution.run_input_sequence(input_pol)

    pprint(out)
예제 #15
0
def main():
    Zone.status += status_callback
    Zone.success += success_callback
    Zone.download_progress += save_callback

    global term_width
    term_width = get_terminal_size()[0]

    global args
    args = parse_args()

    username = args.username
    if not username:
        if 'APPD_SSO_USERNAME' in os.environ:
            username = os.environ['APPD_SSO_USERNAME']
        else:
            print 'Username: '******'APPD_SSO_PASSWORD' in os.environ:
            password = os.environ['APPD_SSO_PASSWORD']
        else:
            password = getpass.getpass()

    z = Zone(args.zone,
             args.version,
             username=username,
             password=password,
             debug=args.debug)

    if args.no_download:
        print z.get_url(args.product,
                        platform=args.os,
                        bits=args.bits,
                        package=args.format)
    else:
        z.download_product(args.product,
                           platform=args.os,
                           bits=args.bits,
                           package=args.format,
                           output=args.output)

    if not args.quiet:
        print 'Done!'

    sys.exit(0)
예제 #16
0
 def createZones(self):
     """
     100mm are equal to 378 px.
     'Real' width is 680 px
     """
     with open('assets/mapCoords.csv', 'r') as f:
         f.readline()
         for line in f:
             (name, x, y, w, h) = line.split(",")
             x = int(x)
             y = int(y)
             w = int(w)
             h = int(h)
             zone = Zone(self, name, (x, y), (w, h), self.scale)
             zone.zoneActivated.connect(self.parent.log.addEntry)
             self.zones[name] = zone
예제 #17
0
파일: main.py 프로젝트: bgerp/ztm
def main():
    """Main"""

    global __zone, __logger, __time_to_stop

    # If it is Unix like.
    if os.name == "posix":
        process_name = "python3"
        process_title = "Zontromat"

        # Check if the process is already running.
        processes = find_proc(process_name, process_title)
        if len(processes) > 0:
            sys.exit(125)

        # Create process name.
        setproctitle.setproctitle(process_title)

    # Add signal handler.
    signal.signal(signal.SIGINT, interupt_handler)
    signal.signal(signal.SIGTERM, interupt_handler)

    settings = ApplicationSettings.get_instance()

    # Read settings content.
    settings.read()

    # Create log.
    crate_log_file()
    __logger = get_logger(__name__)

    # Wait for settings.
    if not settings.exists:
        settings.create_default()
        __logger.warning(
            "Creating default application settings file. Please edit before next start. ({})"
            .format(settings.path))
        sys.exit(0)

    # Create zone.
    __zone = Zone()

    # Initialize the zone.
    __zone.init()

    # Run the zone.
    __zone.run()
예제 #18
0
    def __init__(self, request):
        """Initialize."""
        self._access_token = None
        self._access_token_expiration = None
        self._client_request = request
        self._host = None
        self._ssl = True
        self.api_version = None
        self.hardware_version = None
        self.mac = None
        self.name = None
        self.software_version = None
        self.connection_type = None

        # API endpoints:
        self.programs = Program(self._request)
        self.provisioning = Provision(self._request)
        self.zones = Zone(self._request)
        self.watering = Watering(self._request)
예제 #19
0
파일: game.py 프로젝트: ubcrm/sim-2d
 def __init__(self):
     self.zones = {
         ZoneType.blue_hp_buff: Zone(ZoneType.blue_hp_buff),
         ZoneType.red_hp_buff: Zone(ZoneType.red_hp_buff),
         ZoneType.blue_ammo_buff: Zone(ZoneType.blue_ammo_buff),
         ZoneType.red_ammo_buff: Zone(ZoneType.red_ammo_buff),
         ZoneType.move_debuff: Zone(ZoneType.move_debuff),
         ZoneType.shoot_debuff: Zone(ZoneType.shoot_debuff)
     }
     self.teams = {True: Team(True), False: Team(False)}
     self.bullets: list[Bullet] = []
     self.time_remaining = 180 * S
     self.winner = Winner.tbd
     random.seed(time.time())
예제 #20
0
    def parse_config(self, yml_dir):
        """
        Read the YAML config files of zones, parse the data and create zone/beacon objects. The created zone objects
        are appended to the classes list of zones for later use.
        :param yml_dir: String: directory of the YAML config file containing the definitions of zones
        """
        # open YAML config file and store content as dictionary
        with open(yml_dir, 'r') as stream:
            yml = yaml.load(stream)

        # parse dictionary of YAML content and create list of zones
        for i in range(len(yml)):
            # get content of all zones in yml file and append to zones list
            z = 'zone' + str(
                i)  # dictionary keys for each zone (zone0, zone1, zone2, etc.)
            zone = yml[z]  # content of current zone
            # get polygon of current zone
            poly = []
            for j in range(0, len(zone['polygon']), 3):
                poly.append([
                    zone['polygon'][j], zone['polygon'][j + 1],
                    zone['polygon'][j + 2]
                ])
            # get content of all beacons of current zone from beacon0, beacon1, beacon2, etc.
            beacons = []
            for k in range(
                    len(zone) - 4
            ):  # -4 because of non-beacon entries (name, frame_id, polygon)
                b = 'beacon' + str(
                    k)  # dictionary keys for each beacon inside the zone
                beacon = zone[b]  # content of current beacon
                beacons.append(
                    Beacon(beacon['EID'], beacon['position'],
                           zone['frame_id']))  # initialize Beacon object
                # increment number of beacons
                self.n_beacons += 1
            # append information about current zone to list and start with next iteration if more zones are defined
            self.zones.append(
                Zone(zone['name'], zone['frame_id'], zone['threshold'], poly,
                     beacons))
예제 #21
0
    def __prepareZones(self):
        last = -1
        while 1:
            # getting where is 'include' directive
            pos = self.contents.find('zone ', last + 1)
            if pos == -1: return None
            # fix
            if pos > 1:
                char = self.contents[pos - 1]
                if char <> '\n' and char <> '\r' and \
                   char <> ' '  and char <> '\t' and \
                   char <> ';':
                    return None
            # marking 'include' position
            last = pos

            # creating a Zone instance
            thisZone = Zone()
            try:
                OneZonePart = self.contents[pos:].split('}')[0]
                # Getting Name
                thisZone.setName(self.__getStr(OneZonePart.split('{')[0]))
                # Getting Filename
                thisZone.setFile(
                    self.__getStr(OneZonePart.split('file')[1].split(';')[0]))
                #Getting type
                if OneZonePart.split('type')[1].split(';')[0].upper().find(
                        'SLAVE') <> -1:
                    thisZone.setType('slave')
                else:
                    thisZone.setType('master')

                self.zones.append(thisZone)
            except:
                pass

            # destroying thisZone instance
            thisZone = None
예제 #22
0
def test_fields():

    # sample areas
    a1 = Area(name="area1",
              desc="area desc",
              domain=[8],
              action=lambda: 1,
              resource_id="r_id")
    a2 = Area(name="area2",
              desc="area desc",
              domain=[9],
              action=lambda: 0,
              resource_id="r_id")

    # test initialization
    areas = [a1, a2]
    z = Zone(areas)

    # test fields
    assert z.areas == areas

    # test dump
    assert z.dump() == [a1.dump(), a2.dump()]
예제 #23
0
def test_getAdjacent():

    # Put two areas in a zone
    a = Area(name="A",
             desc="area_desc",
             domain=[8],
             action=lambda: 5,
             resource_id="a_id")
    b = Area(name="B",
             desc="area_desc",
             domain=[9],
             action=lambda: 5,
             resource_id="b_id")
    z = Zone([a, b])
    for x in z.areas:
        x.zone = z

    assert a.zone == z
    assert b.zone == z

    # Test adjacency
    assert a.getAdjacent() == b
    assert b.getAdjacent() == a
예제 #24
0
def main():
    #Initialize screen
    pyg.init()
    width = 1000
    height = 600
    fps = 30
    withBorder = True
    screen = pyg.display.set_mode((width, height))
    screen_rect = screen.get_rect()
    screen_rect.x = screen_rect.y = 0
    pyg.display.set_caption('IA41 - Tangram')
    icon = pyg.image.load('Textures/icone.png')
    pyg.display.set_icon(icon)
    screen.fill((200, 200, 200))
    clock = pyg.time.Clock()
    clock.tick(fps)

    #Initialize variables
    list_GraphicForm = init_forms(width, height)
    running = True
    phase = 1
    move = False
    turn = False
    interval = 180
    pasInterval = 45
    ptInitial = [0, 0]
    ptFinal = [0, 0]
    ptTmp = [0, 0]
    lastPtTmp = [0, 0]
    list_ptsForme = []
    list_ptsFormeSurface = []
    actualForm = None
    silhouetteForme = None
    zoneDessin = Zone((width / 2, 0), (width / 2, height),
                      "Textures/ZoneDessin.png")
    zoneDepart = Zone((width / 4 - height / 4, height / 4),
                      (height / 2, height / 2), "Textures/ZoneDepart.png")
    titreBg = Zone((0, 0), (width / 2, height), "Textures/menuBg.png", False)
    zoneTransition = Zone((0, 0), (width / 2, height),
                          "Textures/ZoneDessin.png")
    msgSelect = Zone((0, 3 * height / 4), (width / 2, 20 * height / 600),
                     "Textures/messageSelection.png")
    buttonLock = Button((width / 4 - width / 8, height - height / 6),
                        (width / 4, height / 8), "Textures/buttonLock.png")
    buttonCheck = Button(
        (width / 2 - height * 50 / 600, height - height * 50 / 600),
        (height * 50 / 600, height * 50 / 600), "Textures/buttonCheck.png")

    #"Magnet", is applied to all forms in order to have a good start position
    for gForm in list_GraphicForm:
        for gForm2 in list_GraphicForm:
            gForm.magnet(gForm2, width, height)

    while running:
        #first phase, the user move and rotate forms to create a new one (silhouette)
        if phase == 1:
            #Place zones
            screen.blit(titreBg.surface, titreBg.rect)
            screen.blit(zoneDessin.surface, zoneDessin.rect)
            screen.blit(zoneDepart.surface, zoneDepart.rect)

            #Draw Forms
            for gForm in list_GraphicForm:
                if zoneDessin.isOn(gForm):
                    draw(screen, gForm, withBorder)
                else:
                    draw(screen, gForm)

            #Place Button
            screen.blit(buttonLock.surface, buttonLock.rect)

            pyg.display.flip()

            if zoneDessin.rect.collidepoint(pyg.mouse.get_pos()):
                withBorder = True
            else:
                withBorder = False

            for evt in pyg.event.get():
                if evt.type == pyg.QUIT:
                    running = False

                elif evt.type == pyg.MOUSEBUTTONDOWN:
                    for graphicForm in list_GraphicForm:
                        if graphicForm.isOn(
                                pyg.mouse.get_pos(),
                                graphicForm.formeSurface.get_height()):
                            ptInitial = pyg.mouse.get_pos()
                            actualForm = graphicForm
                            lastPtTmp = ptInitial
                            #Put the actual form at the end of the list to be printed last
                            list_GraphicForm[-1], list_GraphicForm[
                                list_GraphicForm.index(
                                    actualForm)] = list_GraphicForm[
                                        list_GraphicForm.index(
                                            actualForm)], list_GraphicForm[-1]
                            if graphicForm.isCornerSelected(
                                    pyg.mouse.get_pos(),
                                    graphicForm.formeSurface.get_height()):
                                turn = True
                            else:
                                move = True
                    #testing if we are on a button and move to the phase  2
                    zoneDepartVide = 1
                    if buttonLock.isOn(pyg.mouse.get_pos()):
                        for Gforme in list_GraphicForm:
                            if zoneDepart.isOn(Gforme):
                                zoneDepartVide = 0
                        if zoneDepartVide:
                            zoneDessin = Zone((width / 2, 0),
                                              (width / 2, height),
                                              "Textures/ZoneDessin.png")
                            phase = 2

                #Move the selected form
                elif pyg.mouse.get_pressed()[0] and move:
                    ptTmp = pyg.mouse.get_pos()
                    actualForm.move(lastPtTmp, ptTmp, width, height)
                    for i in range(len(list_GraphicForm) - 1):
                        formTmp = list_GraphicForm[i]
                        if zoneDessin.isOn(actualForm) or zoneDessin.isOn(
                                formTmp):
                            if actualForm.isCutting(
                                    formTmp,
                                    graphicForm.formeSurface.get_height()
                            ) or formTmp.isCutting(
                                    graphicForm,
                                    graphicForm.formeSurface.get_height()):
                                actualForm.move(ptTmp, lastPtTmp, width,
                                                height)
                                break
                        if zoneDessin.isOn(actualForm) and zoneDessin.isOn(
                                actualForm):
                            if not (actualForm.isCutting(
                                    formTmp,
                                    graphicForm.formeSurface.get_height())
                                    and formTmp.isCutting(
                                        graphicForm,
                                        graphicForm.formeSurface.get_height())
                                    ):
                                actualForm.magnet(formTmp, width, height)
                    screen.fill((200, 200, 200))
                    lastPtTmp = ptTmp

                #Rotate the selected form
                elif pyg.mouse.get_pressed()[0] and turn:
                    ptTmp = pyg.mouse.get_pos()
                    angle = (lastPtTmp[1] - ptTmp[1])
                    if abs(angle) > pasInterval:
                        sens = angle / abs(angle)
                        for i in range(pasInterval):
                            actualForm.forme.rotation(pi * sens / interval)
                        screen.fill((200, 200, 200))
                        lastPtTmp = ptTmp

                #Move the selected form
                elif evt.type == pyg.MOUSEBUTTONUP and move:
                    ptFinal = pyg.mouse.get_pos()
                    actualForm.move(lastPtTmp, ptFinal, width, height)
                    for i in range(len(list_GraphicForm) - 1):
                        formTmp = list_GraphicForm[i]
                        if zoneDessin.isOn(actualForm) or zoneDessin.isOn(
                                formTmp):
                            if actualForm.isCutting(
                                    formTmp,
                                    graphicForm.formeSurface.get_height()
                            ) or formTmp.isCutting(
                                    graphicForm,
                                    graphicForm.formeSurface.get_height()):
                                actualForm.move(ptFinal, lastPtTmp, width,
                                                height)
                                break
                        if zoneDessin.isOn(actualForm) and zoneDessin.isOn(
                                actualForm):
                            if not (actualForm.isCutting(
                                    formTmp,
                                    graphicForm.formeSurface.get_height())
                                    and formTmp.isCutting(
                                        graphicForm,
                                        graphicForm.formeSurface.get_height())
                                    ):
                                actualForm.magnet(formTmp, width, height)
                    if not zoneDessin.isOn(actualForm):
                        actualForm.initialize()
                    screen.fill((200, 200, 200))
                    actualForm = None
                    move = False

                #Rotate the selected form
                elif evt.type == pyg.MOUSEBUTTONUP and turn:
                    ptTmp = pyg.mouse.get_pos()
                    angle = (lastPtTmp[1] - ptTmp[1])
                    if abs(angle) > pasInterval:
                        sens = angle / abs(angle)
                        for i in range(pasInterval):
                            actualForm.forme.rotation(pi * sens / interval)
                        screen.fill((200, 200, 200))
                    actualForm = None
                    turn = False

        #Second phase, creation of the silhouette
        elif phase == 2:
            #Place zones
            screen.blit(zoneTransition.surface, zoneTransition.rect)
            screen.blit(zoneDessin.surface, zoneDessin.rect)

            #Draw Forms
            for gForm in list_GraphicForm:
                if zoneDessin.isOn(gForm):
                    draw(screen, gForm, withBorder)
                else:
                    draw(screen, gForm)

            #Print the silhouette in real time
            if len(list_ptsForme) > 1:
                pyg.draw.lines(zoneTransition.surface, (200, 200, 200), False,
                               list_ptsForme, 5)

            screen.blit(msgSelect.surface, msgSelect.rect)
            screen.blit(buttonCheck.surface, buttonCheck.rect)

            pyg.display.flip()

            if zoneDessin.rect.collidepoint(pyg.mouse.get_pos()):
                withBorder = True
            else:
                withBorder = False

            for evt in pyg.event.get():
                if evt.type == pyg.QUIT:
                    running = False

                elif evt.type == pyg.MOUSEBUTTONDOWN:
                    for graphicForm in list_GraphicForm:
                        if graphicForm.isOn(
                                pyg.mouse.get_pos(),
                                graphicForm.formeSurface.get_height()):
                            newSommet = graphicForm.getCornerSelected(
                                pyg.mouse.get_pos(),
                                graphicForm.formeSurface.get_height())
                            if newSommet != []:
                                newSommet[0] -= width / 2
                                list_ptsForme.append(newSommet)

                    # Testing if the silhouette is finished and move to phase 3
                    if buttonCheck.isOn(pyg.mouse.get_pos()):
                        if list_ptsForme != []:
                            list_ptsFormeTmp = [list_ptsForme[0]]
                            for i in range(1, len(list_ptsForme)):
                                if (list_ptsForme[i][0] !=
                                        list_ptsForme[i - 1][0]) or (
                                            list_ptsForme[i][1] !=
                                            list_ptsForme[i - 1][1]):
                                    list_ptsFormeTmp.append(list_ptsForme[i])
                            list_ptsForme = list_ptsFormeTmp
                            if len(list_ptsForme) > 2 and list_ptsForme[
                                    0] == list_ptsForme[-1]:
                                list_ptsFormeSurface = [
                                    deepcopy(pt) for pt in list_ptsForme
                                ]
                                for pt in list_ptsForme:
                                    pt[0] += width / 2
                                silhouetteForme = silhouette(list_ptsForme)
                                silhouetteForme.clean_couples()
                                zoneTransition = Zone(
                                    (0, 0), (width / 2, height),
                                    "Textures/ZoneDessin.png")
                                phase = 3

        #Laste phase, call of the AI
        elif phase == 3:

            for evt in pyg.event.get():
                if evt.type == pyg.QUIT:
                    running = False

            #Draw forms
            pyg.draw.lines(zoneDessin.surface, (255, 0, 0), False,
                           list_ptsFormeSurface, 5)

            forms_ia = init_forms(width, height)

            #Print the forms give to the AI
            for gforme in forms_ia:
                pyg.draw.polygon(zoneTransition.surface, (0, 0, 0),
                                 gforme.get_sommets(gforme.forme.new_scale))
                pyg.draw.polygon(zoneTransition.surface, (200, 200, 200),
                                 gforme.get_sommets(gforme.forme.new_scale), 4)

            #Place zones
            screen.blit(zoneTransition.surface, zoneTransition.rect)
            screen.blit(zoneDessin.surface, zoneDessin.rect)

            pyg.display.flip()

            # create and call the AI with the silhouette and a list a form (starting square)
            ia = Ia(silhouetteForme, forms_ia, width, height)

            pyg.display.flip()

            list_GraphicForm = ia.list_form
            list_ptsForme = []

            zoneTransition = Zone((0, 0), (width / 2, height),
                                  "Textures/ZoneDessin.png")
            phase = 1
    pyg.quit()
    exit()
예제 #25
0
 def __init__(self, file_name):
     try:
         with open(file_name, 'r') as open_file:
             config_dict = yaml.safe_load(open_file)
     except Exception as e:
         print(
             'There was an error loading the given file. Ensure file name was entered correctly and was a YAML file.'
         )
         print(e)
         sys.exit(1)
     try:
         zone_dict = config_dict['Zones']
     except Exception:
         print(
             'Zones not found. Please make sure zones are present and formatted correctly.'
         )
         sys.exit(1)
     try:
         self.ethernet_settings = config_dict['Ethernet_Settings']
     except Exception:
         print(
             'Network info not found. Please make sure info is present and formatted correctly.'
         )
         sys.exit(1)
     try:
         self.hysteresis_value = int(config_dict['Hysteresis_Value'])
     except Exception:
         print(
             'Hysteresis Value not found. The default value of 5 will be used.'
         )
         self.hysteresis_value = 5
     if self.hysteresis_value < 0:
         print(
             'Hysteresis value is less than 0. The default value of 5 will be used.'
         )
         self.hysteresis_value = 5
     zone_list = []
     for name, data in zone_dict.items():
         if type(name) is not str:
             print('Zone {} rejected. Zone name was not a string'.format(
                 name))
         else:
             try:
                 vertices = data['Vertices']
                 color = data['RGB']
             except Exception:
                 print(
                     'Zone {} rejected. Vertices and RGB Color were either named incorrectly or not present'
                     .format(name))
             else:
                 if type(color) != list:
                     print(
                         'Zone {} rejected. RGB values were not in a list'.
                         format(name))
                 elif len(color) != 3:
                     print(
                         'Zone {} rejected. RGB list should consist of 3 values'
                         .format(name))
                 elif type(vertices) != list:
                     print(
                         'Zone {} rejected. Zone points were not in a list'.
                         format(name))
                 elif len(vertices) < 3:
                     print(
                         'Zone {} rejected. Not enough points to make a polygon'
                         .format(name))
                 else:
                     vertex_num = 0
                     for vertex in vertices:
                         vertex_num += 1
                         if type(vertex) != list:
                             print(
                                 'Zone {} rejected. Each point needs to be a list in the form of [x, y]'
                                 .format(name))
                             break
                         elif len(vertex) != 2:
                             print(
                                 'Zone {} rejected. Each point should have exactly two coordinates'
                                 .format(name))
                             break
                         elif (type(vertex[0]) is not float
                               and type(vertex[0]) is not int) or (
                                   type(vertex[1]) is not float
                                   and type(vertex[1]) is not int):
                             print(
                                 'Zone {} rejected. A point should consist of two floats and/or integers'
                                 .format(name))
                             break
                         elif vertex_num == len(vertices):
                             print('Zone {} accepted.'.format(name))
                             zone_list.append(Zone(name, vertices, color))
     if len(zone_list) > 0:
         self.zones = zone_list
     else:
         print('Error: There were no usable zones.')
         sys.exit(1)
예제 #26
0
def main():
    global sunnum, font, fontImg
    # peashooter = Peashooter()
    clickimage = []
    # sunflower = SunFlower()
    wallnut = WallNut()
    p1 = []
    peaList = []
    sunFlowerList = []

    sunList = []
    zombieList = []
    zombie = Zombie()
    zombieList.append(zombie)

    enemy_zombie_list = []

    flower_product_list = []

    # FPS
    block = pygame.time.Clock()

    index = 0
    # 是否点击卡片
    is_pick = False
    # 区域种植判断
    is_plant = False
    # 太阳下落时间
    SUN_EVENT = pygame.USEREVENT + 1
    pygame.time.set_timer(SUN_EVENT, 3000)  # 3秒出现一个

    # 太阳花产能
    FLOWER_PRODUCT_SUM_EVENT = pygame.USEREVENT + 1
    pygame.time.set_timer(FLOWER_PRODUCT_SUM_EVENT, 5000)

    #
    ZOMBIE_EVENT = pygame.USEREVENT + 1
    pygame.time.set_timer(ZOMBIE_EVENT, 5000)

    z = Zone()
    bulletList = []
    PAUSE = False
    FINAL = 0

    while 1:

        pygame.mixer.music.play()  # 播放音乐
        block.tick(25)  # FPS为25

        # 鼠标点击
        press = pygame.mouse.get_pressed()
        # 鼠标坐标
        x, y = pygame.mouse.get_pos()

        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                sys.exit()
            if event.type == SUN_EVENT:
                sun = Sun()
                sunList.append(sun)
            # 太阳花产能
            if event.type == FLOWER_PRODUCT_SUM_EVENT:
                for flower in sunFlowerList:
                    if not flower.isProductSum:
                        sun = Sun()
                        sun.rect.left = flower.rect.left
                        sun.rect.top = flower.rect.top
                        sun.belong = flower
                        flower_product_list.append(sun)
                        flower.isProductSum = True  # 无法生产

            if event.type == ZOMBIE_EVENT:
                zombie = Zombie()
                zombieList.append(zombie)

            # 暂停,点击ESC
            if event.type == pygame.KEYDOWN:
                if event.key == 27:
                    PAUSE = not PAUSE

            if event.type == pygame.MOUSEMOTION:
                if 537 <= x <= 749 and 378 <= y <= 481:
                    if press[0]:
                        PAUSE = not PAUSE
                if not is_pick:
                    if press[0]:
                        if 330 <= x <= 330 + card.get_rect().width and 7 <= y <= 7 + card.get_rect().height:
                            peashooter = Peashooter()
                            clickimage.append(peashooter)
                            pick_type = 'pea'
                            is_pick = True
                        if 380 <= x <= 380 + card_1.get_rect().width and 7 <= y <= 7 + card_1.get_rect().height:
                            sunflower = SunFlower()
                            clickimage.append(sunflower)
                            pick_type = 'flower'
                            is_pick = True

                else:
                    if z.is_plant_zone(x, y):
                        if z.getIndex(x, y) and not is_plant:
                            if pick_type == 'pea':
                                p = Peashooter()
                                a, b = z.getIndex(x, y)
                                p.zone = z.getGridPos(a, b)
                                if not z.plantInfo[b][a]:
                                    p1.append(p)
                                    is_plant = True
                                    if press[0]:
                                        peaList.append(p)
                                        enemy_zombie_list.append(p)
                                        # bullet = p.shot()
                                        # bulletList.append(bullet)
                                        clickimage.clear()
                                        p1.clear()
                                        is_pick = False
                                        z.plantInfo[b][a] = 1
                                        sunnum = str(int(sunnum) - 100)
                                        fontImg = font.render(sunnum, True, (0, 0, 0))

                                        # print(z.plantInfo[a][b])
                            elif pick_type == 'flower':
                                f = SunFlower()
                                a, b = z.getIndex(x, y)
                                f.zone = z.getGridPos(a, b)
                                if not z.plantInfo[b][a]:
                                    p1.append(f)
                                    is_plant = True
                                    if press[0]:
                                        sunFlowerList.append(f)
                                        enemy_zombie_list.append(f)
                                        clickimage.clear()
                                        p1.clear()
                                        is_pick = False
                                        z.plantInfo[b][a] = 1
                                        sunnum = str(int(sunnum) - 100)
                                        fontImg = font.render(sunnum, True, (0, 0, 0))
                        else:
                            p1.clear()
                            is_plant = False

                    if press[2]:
                        is_pick = False
                        clickimage.clear()
                        p1.clear()
                        is_plant = False

                        # if 330 <= x <= 405 and 180 <= y <= 274:

                    # else:
                    #     p1.clear()

                for sun in sunList:
                    if sun.rect.collidepoint((x, y)):
                        if press[0]:
                            # 点击太阳消失
                            sunList.remove(sun)
                            # 收集加分
                            # global sunnum, font, fontImg
                            sunnum = str(int(sunnum) + 25)
                            fontImg = font.render(sunnum, True, (0, 0, 0))

                for sun in flower_product_list:
                    if sun.rect.collidepoint((x, y)):
                        if press[0]:
                            # 点击太阳消失
                            flower_product_list.remove(sun)
                            # 收集加分
                            sunnum = str(int(sunnum) + 25)
                            fontImg = font.render(sunnum, True, (0, 0, 0))
                            # 收集后可继续生产
                            sun.belong.isProductSum = False

        # 打印图片
        if int(zombie.rect.left) < 200:
            FINAL += 1
            PAUSE = True
        if not PAUSE:
            screen.blit(backgroud, (0, 0))
            screen.blit(card_slot, (250, 0))
            screen.blit(card, (330, 7))
            screen.blit(card_1, (380, 7))
            screen.blit(card_2, (430, 6))
            screen.blit(fontImg, (275, 60))

            if index > 13:
                index = 0
            # screen.blit(peashooter.images[index % 13], peashooter.rect)
            # screen.blit(sunflower.images[index % 18], sunflower.rect)
            # screen.blit(wallnut.images[index % 16], wallnut.rect)

            for image in clickimage:
                screen.blit(image.images[0], (x, y))
            for p in p1:
                screen.blit(p.images[0], p.zone)
            # 豌豆射手
            for pea in peaList:
                if pea.is_live:
                    if index % 99 == 1:
                        bullet = pea.shot()
                        bulletList.append(bullet)
                    screen.blit(pea.images[index % 13], pea.zone)
                else:
                    peaList.remove(pea)
                    enemy_zombie_list.remove(pea)
            # 太阳花
            for sunFlower in sunFlowerList:
                if sunFlower.is_live:
                    screen.blit(sunFlower.images[index % 18], sunFlower.zone)
                else:
                    sunFlowerList.remove(sunFlower)
                    enemy_zombie_list.remove(sunFlower)
            # 阳光
            for sun in sunList:
                screen.blit(sun.images[index % 22], sun.rect)
                sun.down()

            # 产能
            for sun in flower_product_list:
                screen.blit(sun.images[index % 22], sun.rect)

            for bullet in bulletList:
                if bullet.status:
                    screen.blit(bullet.images, bullet.rect)
                    bullet.move()
                    bullet.hit(zombieList)
                else:
                    bulletList.remove(bullet)

            for zombie in zombieList:
                if zombie.is_live:
                    zombie.changimage()
                    screen.blit(zombie.images[index % 20], zombie.rect)
                    zombie.move()
                    zombie.attack(enemy_zombie_list)
                else:
                    zombieList.remove(zombie)

            pygame.display.update()

            index += 1
        else:
            if FINAL > 0:
                screen.blit(final_draw, (350, 70))
            else:
                screen.blit(pause_draw, (450, 100))

        pygame.display.update()
예제 #27
0
 def addZone(self, data):
     self.zones.append( Zone(data) )
예제 #28
0
 def zones_build(self, build_dir):
     # Regular zones
     Zone.BUILD_DIR = build_dir
     reg_zone = Zone(self.cur, self.fd, 0, ".")
     reg_zone.walk_domain(0, ".")
예제 #29
0
#db = Database(False)
ipc_file = "ipc_file.txt"
rain_threshold = .8
temp_threshold = 10
json_convert = JSON_Interface()

soc = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
host = socket.gethostname()
port = 5538


#########TESTING
db = Database(True)
from event import Event
from zone import Zone
z = Zone(1)
z2 = Zone(2)
z3 = Zone(3)

db.add_zone(z)
db.add_zone(z2)

test_event0 = Event(3.0, 4.0, 'Sunday', 1, 1)
test_event1 = Event(1.0, 2.0, 'Sunday', 1, 1)
test_event2 = Event(2.0, 3.0, 'Sunday', 1, 1)
test_event3 = Event(1.5, 2.5, 'Sunday', 1, 1)
test_event4 = Event(1.0, 2.0, 'Sunday', 1, 2)
test_event5 = Event(1.0, 2.0, 'Sunday', 1, 3)
test_event6 = Event(1.5, 3.0, 'Sunday', 1, 3)
test_event7 = Event(1.0, 2.0, 'Sunday', 1, 3)
예제 #30
0
    def __init__(self):
        self.zones = [
            Zone(
                "Accounting Office",
                "You are in the 'Accounting Office'. A dim fluorescent light illuminates the room. Papers are scattered across the desk and floor. A quiet hum fills the air.\n\nTo the 'North' is the 'Monitoring Room'.\nTo the 'South' is the 'Vault'.",
                "The room reeks of cigarettes.",
                [item.COMPUTER, item.CLIENT_LIST]),
            Zone(
                "Alley",
                "You are in the 'Alley'. The concrete ground is wet and covered with mud. Garbage is littered everywhere.\n\nTo the 'North' is the 'Parking Lot'.\nTo the 'West' is a 'Hallway'.",
                "You'd think someone would at least pick up the garbage.", []),
            Zone(
                "Backstage",
                "You are 'Backstage'. Costumes and props are scattered across the furniture. You can faintly hear the sound of cars passing by outside.\n\nTo the 'South' is the 'Theater'.\nTo the 'East' is the 'Green Room'.",
                "You wonder how often the casino puts on a show. Some of these costumes look like they haven't been cleaned in ages.",
                [item.CIRCUIT_BOX]),
            Zone(
                "Casino Floor",
                "You are on the 'Casino Floor'. It seems unusually quiet for a Friday night. Empty slot machines line the walls. You notice a few people playing cards. The 'Casino Floor' seems to be a hub for most of the casino's other rooms.\n\nTo the north is the 'Restaurant' and a 'Hallway'.\nTo the south is the 'Storage Room', the 'Janitorial Closet' and the 'Club Room'.\nTo the east is the 'Monitoring Room', the 'Private Room' and a 'Washroom'.\nTo the west is the 'Lobby' and the 'Staff Room'.",
                "The carpet is in dire need of a cleaning. You notice a security camera on the ceiling in the corner.",
                [item.SPEAKER_SYSTEM]),
            Zone(
                "Club Room",
                "You are in the 'Club Room'. On the wall is a bulletin board with a few posters attached. A table in the center of the room is scarcely covered in cards. It seems as if a game was recently played in here.\n\nTo the 'North' is the 'Casino Floor'.\nTo the 'West' is the 'Storage Room'.",
                "You notice an illustration of a figure in a yellow mask on one of the posters. You recognize this as one of the local mob outfits. They like dressing up. They seem to use it as some sort of a scare tactic.",
                []),
            Zone(
                "Green Room",
                "You are in the 'Green Room'. A few couches line the walls. In the center of the room is a coffee table with some empty glasses on it.\n\nTo the 'East' is the 'Parking Lot'.\nTo the 'West' is 'Backstage'.",
                "You wonder how often this room gets cleaned. Compared to the rest of the casino it is pretty cozy. You notice a security camera on the ceiling in the corner.",
                [item.KEYCARD]),
            Zone(
                "Hallway",
                "You are in a 'Hallway'.\n\nTo the north is the 'Storage Room' and the 'Main Office'.\nTo the 'West' is the 'Loading Dock'.",
                "The corridor is fairly barren.", []),
            Zone(
                "Hallway",
                "You are in a 'Hallway'.\n\nTo the 'East' is the 'Alley'.\nTo the west is the 'Private Room' and the 'Monitoring Room'.",
                "The corridor is fairly barren.", []),
            Zone(
                "Hallway",
                "You are in a 'Hallway'.\n\nTo the 'North' is the 'Theater'.\nTo the 'South' is the 'Casino Floor'.\nTo the 'East' is the 'High Roller Room'.",
                "The corridor is fairly barren.", []),
            Zone(
                "High Roller Room",
                "You are in the 'High Roller Room'. Surprisingly there are no players. The room has five card tables and three slot machines. Plastic plants fill the empty space.\n\nTo the 'North' is a 'Washroom'.\nTo the 'West' is a 'Hallway'.",
                "The carpet around the 'Washroom' entrance is stained. An out of order sign hangs from the 'Washroom' door. This casino is so filthy and void of people that they must be doing criminal activity of some kind. How else could they stay open?",
                []),
            Zone(
                "Janitorial Closet",
                "You are in the 'Janitorial Closet'. The closet is small and cramped. The smell of bleach pierces your nose.\n\nTo the 'North' is the 'Casino Floor'.",
                "So far the closet is the cleanest room in the casino. Although, it is cluttered with random cleaning supplies.",
                [item.WASHROOM_KEY]),
            Zone(
                "Kitchen",
                "You are in the 'Kitchen'. The chef is nowhere to be found. Dirty dishes are piled in the sink. How come the casino restaurant is closed on a Friday night?\n\nTo the 'North' is the 'Restaurant'.\nTo the 'South' is the 'Staff Room'.",
                "The floor is wet and slippery. A opaque window above the sink allows a glimpse into the outside world. You see a road far in the distance. Headlights of passing cars dissapear as they enter a tunnel. You notice a security camera on the ceiling in the corner.",
                []),
            Zone(
                "Loading Dock",
                "You are in the 'Loading Dock'. A few trucks are parked inside. Cardboard boxes fill the room. A small lightbulb is hanging from the ceiling.\n\nTo the west is the 'Storage Room' and a 'Hallway'.",
                "For such a rundown casino you are surprised they even have a 'Loading Dock'. What could they possibly need it for?",
                []),
            Zone(
                "Lobby",
                "You are in the 'Lobby'. The room reeks of cigarette smoke. You see a 'Woman' shrouded in fake plastic plants sitting at the front desk. She watches as you enter.\n\nTo the 'North' is the 'Staff Room'.\nTo the 'East' is the 'Casino Floor'.",
                "The 'Woman' has bags under her eyes. You would too if you worked in a place like this. She takes a drag from her cigarette.",
                []),
            Zone(
                "Main Office",
                "You are in the 'Main Office'. The manager's desk is in the center. It is decorated with various trinkets. A stack of papers is placed neatly on the corner of the desk.\n\nTo the 'North' is the 'Monitoring Room'.\nTo the 'South' is a 'Hallway'.",
                "The manager seems to keep himself busy.",
                [item.ROLODEX, item.LOCKER_KEY]),
            Zone(
                "Monitoring Room",
                "You are in the 'Monitoring Room'. The wall is covered in computer screens. Each screen is displaying a camera feed from a location in the casino.\n\nTo the south is the 'Accounting Office' and the 'Main Office'.\nTo the 'East' is a 'Hallway'.\nTo the 'West' is the 'Casino Floor'.",
                "You recognize some of the rooms on the screens. You can see feeds from the 'Private Room', the 'Casino Floor', the 'Kitchen' and the 'Green Room'.",
                []),
            Zone(
                "Parking Lot",
                "You are in the 'Parking Lot'. There are only a few cars. Most of them are old and rusted. You notice one exceptionally clean car parked in the corner.\n\nTo the 'South' is the 'Alley'.\nTo the 'West' is the 'Green Room'.",
                "A rat is gnawing on a slice of pizza in the corner.", []),
            Zone(
                "Private Room",
                "You are in the 'Private Room'. Compared to the rest of the casino this room is exceptionally fancy. A box of cigars is lying on the card table at the center of the room. The walls are covered in a dark green wallpaper.",
                "A yellow mask is lying on the card table. You notice a security camera on the ceiling in the corner.",
                []),
            Zone(
                "Restaurant",
                "You are in the 'Restaurant'. The room is filled with round dinner tables covered in checkered tablecloth. The north wall is covered in windows. You can see the ocean from here.\n\nTo the south is the 'Kitchen' and the 'Casino Floor'.",
                "You faintly hear the sounds of waves in distance. The room has a calming atmosphere.",
                []),
            Zone(
                "Staff Room",
                "You are in the 'Staff Room'. A small table is at the center of the room. The west wall is covered in yellow lockers. A few dirty uniforms are hanging on a coatrack in the corner.\n\nTo the 'North' is the 'Kitchen'.\nTo the 'South' is the 'Lobby'.\nTo the 'East' is the 'Casino Floor'.",
                "For a seemingly empty casino you are surprised at the number of staff lockers.",
                [item.STAFF_LIST, item.LOCKER]),
            Zone(
                "Storage Room",
                "You are in the 'Storage Room'. The room is cluttered with boxes. You barely make your way around without squeezing through a tight gap. There are cobwebs in the corners.\n\nTo the 'North' is the 'Casino Floor'.\nTo the 'South' is a 'Hallway'.\nTo the 'East' is the 'Club Room'.\nTo the 'West' is the 'Loading Dock'.",
                "A few decommissioned slot machines are lying against the wall.",
                []),
            Zone(
                "Theater",
                "You are in the 'Theater'. The room is large and echoey. If the casino was less rundown you could imagine some good shows being performed here.\n\nTo the 'North' is 'Backstage'.\nTo the 'South' is a 'Hallway'.",
                "You see an old projector hanging from the ceiling at the back. At one point this place must've shown movies.",
                []),
            Zone(
                "Vault",
                "You are in the 'Vault'. Piles of cash and gold bars fill the room. You are tempted to take some but you must remember why you're here. Your mission is almost over.\n\nTo the 'North' is the 'Accounting Office'.",
                "There is so much money you can't imagine how one could even spend it all. You better do your business and leave before someone catches you.",
                []),
            Zone(
                "Washroom",
                "You are in a 'Washroom'. Nothing is out of the ordinary. It's clear that the room isn't cleaned very often.\n\nTo the 'West' is the 'Casino Floor'.",
                "Nothing to see really.", []),
            Zone(
                "Washroom",
                "You are in a 'Washroom'. The floor is relatively dry but slippery under one of the stalls. You hear the sound of trickling water. A toilet is overflowing in one of the stalls.\n\nTo the 'South' is the 'High Roller Room'.",
                "This is the 'Washroom' where the 'Informant' stashed your package.",
                [
                    item.SCANNER, item.TRACKING_DEVICE, item.LASER_TOOL,
                    item.SIGNAL_SCRAMBLER
                ])
        ]

        self.zones[ACCOUNTING_OFFICE].connections = {
            MONITORING_ROOM:
            NORTH + [self.zones[MONITORING_ROOM].destination_keyword],
            VAULT:
            SOUTH + [self.zones[VAULT].destination_keyword]
        }
        self.zones[ALLEY].connections = {
            HALLWAY_B: WEST + [self.zones[HALLWAY_B].destination_keyword],
            PARKING_LOT: NORTH + [self.zones[PARKING_LOT].destination_keyword]
        }
        self.zones[BACKSTAGE].connections = {
            GREEN_ROOM: EAST + [self.zones[GREEN_ROOM].destination_keyword],
            THEATER: SOUTH + [self.zones[THEATER].destination_keyword]
        }
        self.zones[CASINO_FLOOR].connections = {
            CLUB_ROOM: [self.zones[CLUB_ROOM].destination_keyword],
            HALLWAY_C: [self.zones[HALLWAY_C].destination_keyword],
            JANITORIAL_CLOSET:
            [self.zones[JANITORIAL_CLOSET].destination_keyword],
            LOBBY: [self.zones[LOBBY].destination_keyword],
            MONITORING_ROOM: [self.zones[MONITORING_ROOM].destination_keyword],
            PRIVATE_ROOM: [self.zones[PRIVATE_ROOM].destination_keyword],
            RESTAURANT: [self.zones[RESTAURANT].destination_keyword],
            STAFF_ROOM: [self.zones[STAFF_ROOM].destination_keyword],
            STORAGE_ROOM: [self.zones[STORAGE_ROOM].destination_keyword],
            WASHROOM_A: [self.zones[WASHROOM_A].destination_keyword]
        }
        self.zones[CLUB_ROOM].connections = {
            CASINO_FLOOR:
            NORTH + [self.zones[CASINO_FLOOR].destination_keyword],
            STORAGE_ROOM:
            WEST + [self.zones[STORAGE_ROOM].destination_keyword]
        }
        self.zones[GREEN_ROOM].connections = {
            BACKSTAGE: WEST + [self.zones[BACKSTAGE].destination_keyword],
            PARKING_LOT: EAST + [self.zones[PARKING_LOT].destination_keyword]
        }
        self.zones[HALLWAY_A].connections = {
            LOADING_DOCK:
            WEST + [self.zones[LOADING_DOCK].destination_keyword],
            MAIN_OFFICE: [self.zones[MAIN_OFFICE].destination_keyword],
            STORAGE_ROOM: [self.zones[STORAGE_ROOM].destination_keyword]
        }
        self.zones[HALLWAY_B].connections = {
            ALLEY: EAST + [self.zones[ALLEY].destination_keyword],
            MONITORING_ROOM: [self.zones[MONITORING_ROOM].destination_keyword],
            PRIVATE_ROOM: [self.zones[PRIVATE_ROOM].destination_keyword]
        }
        self.zones[HALLWAY_C].connections = {
            CASINO_FLOOR:
            SOUTH + [self.zones[CASINO_FLOOR].destination_keyword],
            HIGH_ROLLER_ROOM:
            EAST + [self.zones[HIGH_ROLLER_ROOM].destination_keyword],
            THEATER:
            NORTH + [self.zones[THEATER].destination_keyword]
        }
        self.zones[HIGH_ROLLER_ROOM].connections = {
            HALLWAY_C: WEST + [self.zones[HALLWAY_C].destination_keyword],
            WASHROOM_B: NORTH + [self.zones[WASHROOM_B].destination_keyword]
        }
        self.zones[JANITORIAL_CLOSET].connections = {
            CASINO_FLOOR:
            NORTH + [self.zones[CASINO_FLOOR].destination_keyword]
        }
        self.zones[KITCHEN].connections = {
            RESTAURANT: NORTH + [self.zones[RESTAURANT].destination_keyword],
            STAFF_ROOM: SOUTH + [self.zones[STAFF_ROOM].destination_keyword]
        }
        self.zones[LOADING_DOCK].connections = {
            HALLWAY_A: [self.zones[HALLWAY_A].destination_keyword],
            STORAGE_ROOM: [self.zones[STORAGE_ROOM].destination_keyword]
        }
        self.zones[LOBBY].connections = {
            CASINO_FLOOR:
            EAST + [self.zones[CASINO_FLOOR].destination_keyword],
            STAFF_ROOM: NORTH + [self.zones[STAFF_ROOM].destination_keyword]
        }
        self.zones[MAIN_OFFICE].connections = {
            MONITORING_ROOM:
            NORTH + [self.zones[MONITORING_ROOM].destination_keyword],
            HALLWAY_A:
            SOUTH + [self.zones[HALLWAY_B].destination_keyword]
        }
        self.zones[MONITORING_ROOM].connections = {
            ACCOUNTING_OFFICE:
            [self.zones[ACCOUNTING_OFFICE].destination_keyword],
            CASINO_FLOOR:
            WEST + [self.zones[CASINO_FLOOR].destination_keyword],
            HALLWAY_B: EAST + [self.zones[HALLWAY_B].destination_keyword],
            MAIN_OFFICE: [self.zones[MAIN_OFFICE].destination_keyword]
        }
        self.zones[PARKING_LOT].connections = {
            ALLEY: SOUTH + [self.zones[ALLEY].destination_keyword],
            GREEN_ROOM: WEST + [self.zones[GREEN_ROOM].destination_keyword]
        }
        self.zones[PRIVATE_ROOM].connections = {
            CASINO_FLOOR:
            WEST + [self.zones[CASINO_FLOOR].destination_keyword],
            HALLWAY_B: EAST + [self.zones[HALLWAY_B].destination_keyword]
        }
        self.zones[RESTAURANT].connections = {
            CASINO_FLOOR: [self.zones[CASINO_FLOOR].destination_keyword],
            KITCHEN: [self.zones[KITCHEN].destination_keyword]
        }
        self.zones[STAFF_ROOM].connections = {
            CASINO_FLOOR:
            EAST + [self.zones[CASINO_FLOOR].destination_keyword],
            KITCHEN: NORTH + [self.zones[KITCHEN].destination_keyword],
            LOBBY: SOUTH + [self.zones[LOBBY].destination_keyword]
        }
        self.zones[STORAGE_ROOM].connections = {
            CASINO_FLOOR:
            NORTH + [self.zones[CASINO_FLOOR].destination_keyword],
            CLUB_ROOM: EAST + [self.zones[CLUB_ROOM].destination_keyword],
            HALLWAY_A: SOUTH + [self.zones[HALLWAY_A].destination_keyword],
            LOADING_DOCK:
            WEST + [self.zones[LOADING_DOCK].destination_keyword]
        }
        self.zones[THEATER].connections = {
            BACKSTAGE: NORTH + [self.zones[BACKSTAGE].destination_keyword],
            HALLWAY_C: SOUTH + [self.zones[HALLWAY_C].destination_keyword]
        }
        self.zones[VAULT].connections = {
            ACCOUNTING_OFFICE:
            NORTH + [self.zones[ACCOUNTING_OFFICE].destination_keyword]
        }
        self.zones[WASHROOM_A].connections = {
            CASINO_FLOOR:
            WEST + [self.zones[CASINO_FLOOR].destination_keyword]
        }
        self.zones[WASHROOM_B].connections = {
            HIGH_ROLLER_ROOM:
            SOUTH + [self.zones[HIGH_ROLLER_ROOM].destination_keyword]
        }