Beispiel #1
0
    def test_picle_ricks_with_morties(self):
        citadel = Citadel()
        rick = Rick(111)
        morty = Morty(111)
        rick.assign(morty)

        citadel.add_resident(rick)
        citadel.add_resident(morty)

        citadel.picle_ricks_with_morties()
        residents = citadel.get_all_residents()

        self.assertTrue(residents[0].is_pickle)
Beispiel #2
0
    def __init__(self):
        self.game_finished = False

        # The App
        self.app = App(self)

        # the Printer
        self.printer = self.app.init_printer(10)

        # the Player
        self.player = Player(self.printer)

        # the Ship
        the_window = Window(self.printer)
        self.ship = Ship(the_window, self.printer)

        # Planets and initialisation
        self.citadel = Citadel("Citadel", self.ship, self.printer, self)
        self.fireplanet = Fireplanet("Paxak", self.ship, self.printer, self)
        self.planets = [self.citadel, self.fireplanet]

        # Initial Values of Important Fields
        self.current_planet = self.citadel
        self.current_location = self.citadel.current_location
        #self.game_finished = False

        # Final initialisation now that enough exists
        the_window.initialise(self)
        self.citadel.land()

        # the Parser and helpers
        self.parser = Parser()

        self.directions = [
            "left", "right", "forwards", "forward", "ship", "spaceship", "out",
            "outside", "in", "inside", "back", "backwards", "citadel"
        ]
        noun_list = []
        for object in self.current_location.objects:
            noun_list.extend(object.noun_names)
        self.parser.nouns = noun_list + self.directions

        # the StateHolder
        self.stateholder = StateHolder(self)

        self.start_game()
Beispiel #3
0
    def test_it_can_ad_residents(self):
        citadel = Citadel()
        rick = Rick(111)
        morty = Morty(111)

        citadel.add_resident(rick)
        citadel.add_resident(morty)
        residents = citadel.get_all_residents()

        self.assertEqual(residents[0], rick)
        self.assertEqual(residents[1], morty)
Beispiel #4
0
class Core(object):
    def __init__(self):
        self.game_finished = False

        # The App
        self.app = App(self)

        # the Printer
        self.printer = self.app.init_printer(10)

        # the Player
        self.player = Player(self.printer)

        # the Ship
        the_window = Window(self.printer)
        self.ship = Ship(the_window, self.printer)

        # Planets and initialisation
        self.citadel = Citadel("Citadel", self.ship, self.printer, self)
        self.fireplanet = Fireplanet("Paxak", self.ship, self.printer, self)
        self.planets = [self.citadel, self.fireplanet]

        # Initial Values of Important Fields
        self.current_planet = self.citadel
        self.current_location = self.citadel.current_location
        #self.game_finished = False

        # Final initialisation now that enough exists
        the_window.initialise(self)
        self.citadel.land()

        # the Parser and helpers
        self.parser = Parser()

        self.directions = [
            "left", "right", "forwards", "forward", "ship", "spaceship", "out",
            "outside", "in", "inside", "back", "backwards", "citadel"
        ]
        noun_list = []
        for object in self.current_location.objects:
            noun_list.extend(object.noun_names)
        self.parser.nouns = noun_list + self.directions

        # the StateHolder
        self.stateholder = StateHolder(self)

        self.start_game()

    def start_game(self):
        self.app.mainloop()

    def get_instruction(self, command):
        # Parser.parse returns a verb (which is a function) and a noun on which it operates.
        ################################################
        # 		if command in ["l", "i", "e", "p", "k"]:
        # 			self.stateholder.debug(command)
        # 			return
        if "cheat" in command:
            self.stateholder.cheat(command)
            return True


################################################
        try:
            f, a = self.parser.parse(command)
            # The function (within StateHolder) is called below.
            bind_to_execute = f(self.stateholder, a)
            self.printer.pprint("\n")
            self.app.set_tags()
            if self.game_finished:
                bind_to_execute = False
            return bind_to_execute

    # If an exception is raised, print its message and move on
        except InvalidCommandError as e:
            self.printer.pprint(e.message + "\n")
            return True

    def get_sign_list(self):
        # File contains python code creating all_signs
        sign_file = open("HailTraveller/signs.txt")
        exec(sign_file.read())
        return all_signs
Beispiel #5
0
 def test_it_gets_all_residents(self):
     citadel = Citadel()
     residents = citadel.get_all_residents()
     self.assertEqual(residents, [])
import json
import pdb
from os import walk

import arrow
import pandas as pd

from building_depot import DataService
from citadel import Citadel
import config

citadel = Citadel(config.CITADEL_URL)
ion_dir = config.BASE_DIR + '/raw_data/ion_data'
data_dir = ion_dir + '/data'
base_url = config.CITADEL_URL

with open(ion_dir + '/metadata/ion_metadata.json', 'r') as fp:
    metadata_dict = json.load(fp)

filenames = []
for (dirpath, dirname, filename) in walk(data_dir):
    filenames.extend(filename)
    break

failed_point_list = list()
for filename in filenames:
    srcid = filename[:-4]
    filename = data_dir + '/' + filename
    if not 'csv' in filename:
        continue
    metadata = metadata_dict[srcid]
Beispiel #7
0
import requests
from copy import deepcopy
import time, random
import json
import pdb
from citadel import Citadel

import config

base_url = 'http://' + config.SERVER_NAME

citadel = Citadel(base_url)

test_point_metadata = {
        'name': 'example_point_8',
        'tags': { 
            'point_type':'temperature',
            'unit':'DEG_F',
            'source_reference': 'http://aaa.com',
            'license': 'gplv2'
            },
        'geometry':{
            'coordinates':[0,0],
            'type':'Point'
            }
        }


test_point_metadata_2 = deepcopy(test_point_metadata)
test_point_metadata_2['name'] = 'example_point_7'