Beispiel #1
0
def app():
    cfg = Configuration()
    cfg.parse()

    dummy = Dummy(cfg.fake_count, cfg.snapshots_path)
    dummy.generate()
    dummy.make_snapshot()
Beispiel #2
0
    def __init__(self, name, is_ai):
        self.name = name
        self.is_ai = is_ai
        self.life = 20
        self.position = None
        self.finisher = None
        self.ante_finisher = False
        self.discards = Discards(2)
        self.played_styles = []
        self.played_bases = []
        self.selection = None
        self.active = False
        self.modifiers = []
        self.refresh()

        if name == 'Training Dummy':
            self.character = Dummy()
            self.agent = DummyAgent()
            self.life = float('inf')
        else:
            self.character = character_by_name(name)
            if self.character is None:
                self.character = character_by_name('Simple Bob')

            if self.is_ai:
                self.agent = DummyAgent()
            else:
                self.agent = UserAgentCLI()
Beispiel #3
0
    def get(self):
        count = 100
        if self.request.get('count'):
            count = int(self.request.get('count'))

        for i in range(0, count):
            d = Dummy()
            d.put()
Beispiel #4
0
 def get_mouseposition(self):
     state_left = win32api.GetKeyState(0x01)
     if state_left == -127 or state_left == -128:
         xclick, yclick = win32api.GetCursorPos()
         dummy_pos = xclick, yclick
         d = Dummy(EXERCISE_WEAPON_HOTKEY, CHAR_NAME, dummy_pos)
         self.quit()
         d.main()
     else:
         self.after(10, self.get_mouseposition)
Beispiel #5
0
def main(file, locale):
    """
    Takes a source po file, reads it, and writes out a new po file
    in :param locale: containing a dummy translation.
    """
    if not os.path.exists(file):
        raise IOError('File does not exist: %s' % file)
    pofile = polib.pofile(file)
    converter = Dummy()
    converter.init_msgs(pofile.translated_entries())
    for msg in pofile:
        converter.convert_msg(msg)
    new_file = new_filename(file, locale)
    create_dir_if_necessary(new_file)
    pofile.save(new_file)
Beispiel #6
0
    def gameStart(self):
        self.dummy = Dummy()
        self.handCardList = self.dummy.getHandCardList()

        self.putCard = PutCard(self.handCardList)
        self.downCardList = self.putCard.getDownCardList()

        for i in range(4):
            downCardNum = str(self.downCardList[i])
            self.downCard[i].setText(downCardNum)

        for i in range(8):
            handCardNum = str(self.handCardList[i])
            self.handCard[i].setText(handCardNum)

        self.dummyDeck.setText('남은 카드 수\n\n'+ str(self.dummy.countDeck()))
Beispiel #7
0
def main(args):

    # Astar Module
    if args.model == "astar":
        model = Astar()
    # Reinforcement Learning module
    elif args.model == "rl":
        model = Rl()
    # Dummy test
    elif args.model == "dummy":
        model = Dummy()

    # Create an environment
    env = gym.make('voilier-v2').unwrapped
    state = env.reset()
    # TODO Get range from argument
    for step in range(0, 200, 1):
        action = model.step(state)
        state, _, _, _ = env.step(action)
        env.render()
Beispiel #8
0
def main(file, locale):
    """
    Takes a source po file, reads it, and writes out a new po file
    in :param locale: containing a dummy translation.
    """
    if not os.path.exists(file):
        raise IOError('File does not exist: %s' % file)
    pofile = polib.pofile(file)
    converter = Dummy()
    for msg in pofile:
        converter.convert_msg(msg)

    # If any message has a plural, then the file needs plural information.
    # Apply declaration for English pluralization rules so that ngettext will
    # do something reasonable.
    if any(m.msgid_plural for m in pofile):
        pofile.metadata['Plural-Forms'] = 'nplurals=2; plural=(n != 1);'

    new_file = new_filename(file, locale)
    create_dir_if_necessary(new_file)
    pofile.save(new_file)
Beispiel #9
0
def read_fam(famfile):

    """
    Read the fam file and create Dummy's for each person
    """

    individs = {}
    with open(famfile, 'r') as f:
        for lines in f:
            # extract line information
            line = lines.rstrip().split()
            famid = line[0]
            individ = line[1]
            father = line[2]
            mother = line[3]
            x = [father, mother]
            # sort so deterministic
            x.sort()

            # if no parents known, then it's a founder
            if father == "0" and mother == "0": founder = True
            else: founder = False

            # create dummy
            if individ not in individs:
                dummy = Dummy((x[0], x[1]), founder)
                individs[individ] = dummy

        # loop through dummies
        for dummies in individs:
            dummy = individs[dummies]
            if dummy.is_founder(): continue

            # add child to the mother and father Dummy's
            parents = dummy.get_parents()
            f = individs[parents[0]]
            m = individs[parents[1]]
            f.add_child(dummies)
            m.add_child(dummies)
    return individs
Beispiel #10
0
    def run(self):
        self.init()

        sm = SceneManager()

        sm.register_scene(DevicesWaiting(self.display, self.ee))

        # sm.go(SceneId.DEVICES_WAITING)
        sm.register_scene(Dummy(self.display))
        # sm.go(SceneId.DUMMY)

        sm.register_scene(Loading(self.display))
        sm.go(SceneId.LOADING)

        while (True):
            if Config.ENABLE_CLI:
                input_str = self.cli.read()
                if input_str == 'exit':
                    sm.destroy()
                    break
                self.handle_cli_command(input_str)

            time.sleep(0.01)
Beispiel #11
0
import os
import pulumi

from dummy import Dummy

config = pulumi.Config();

resource_count = config.require_int('resource_count')
resource_payload_bytes = config.require_int('resource_payload_bytes')

for i in range(0, resource_count):
    deadweight = '{:08}'.format(i) * int(resource_payload_bytes / 8)
    dummy = Dummy(f'dummy-{i}', deadweight=deadweight)
    if i == 0:
        pulumi.export('ResourcePayloadBytes', dummy.deadweight.apply(lambda s: len(s)))

pulumi.export('ResourceCount', resource_count)
Beispiel #12
0
# How to reload a class that was already imported

from importlib import reload
import dummy  # the module containing the desired class

from dummy import Dummy

d = Dummy("Adam")
d.sayHi()

# Now, suppose we change Dummy's sayHi function to "[name] says Hello"
# Then, we run
# >>> reload(dummy)
# Then Ctrl-Enter to rebuild everything
Beispiel #13
0
def test_repr():
    assert repr(Dummy()) == 'Dummy()'
Beispiel #14
0
'''
Created on Feb 21, 2018

@author: kosc93
'''
from __future__ import division

from amsldm import __version__
from amsldm import MeasurementSetup, Sweep
from amsldm import FieldFox, PNA, ZVA24
from time import sleep, time
from dummy import Dummy
import os

os.system('guvcview -j test.avi  -o mp3 -u h264 -y 30 -e &')
m = MeasurementSetup("test_setup")
m.add_instrument(ZVA24('192.168.2.159'))
m.add_sweep(Sweep(Dummy('A'), 0., 2., 5))

m.run()
Beispiel #15
0
from pokemon import Pokemon
from dummy import Dummy

bulb = Pokemon('Bulbasaur', 'Grass', 10, 10, 3, 2)
doug = Dummy('Doug', 69)

bulb.speak()

print(doug.health)
bulb.attack(doug)
print(doug.health)
Beispiel #16
0
def main(argv):
    inputfile = None
    visual = True
    agentproxy = False
    url = 'ws://localhost:8765'
    url = None
    StudentAgent = Agent1
    studentAgent_name = "Agent1"
    student_url = None
    OponentAgent = Agent1
    oponentAgent_name = "Agent2"
    oponent_url = None
    timeout = sys.maxsize
    try:
        opts, args = getopt.getopt(argv, "hm:s:o:pt:", [
            "help", "map=", "disable-video", "student-agent", "oponent-agent",
            "proxy", "timeout"
        ])
    except getopt.GetoptError as e:
        print(e)
        print(
            'start.py [-h/--help -m/--map <mapfile> --disable-video -p/--proxy -s/--student-agent AgentName,Name[,websocket] -o/--oponent-name AgentName,Name[,websocket] --timeout]'
        )
        sys.exit(2)
    for opt, arg in opts:
        if opt == '-h':
            print(
                'start.py [-h/--help -m/--map <mapfile> --disable-video -p/--proxy -s/--student-agent AgentName,Name[,websocket] -o/--oponent-name AgentName,Name[,websocket] --timeout]'
            )
            sys.exit()
        elif opt in ("-m", "--map"):
            inputfile = arg
        elif opt in ("-t", "--timeout"):
            timeout = int(arg)
        elif opt in ("--disable-video"):
            visual = False
        elif opt in ("-p", "--proxy"):
            agentproxy = True
        elif opt in ("-s", "--student-agent"):
            a = arg.split(',')
            classmodule = importlib.import_module(a[0].lower())
            classInst = getattr(classmodule, a[0])
            StudentAgent = classInst
            studentAgent_name = a[1]
            if len(a) > 2:
                student_url = a[2]
        elif opt in ("-o", "--oponent-agent"):
            a = arg.split(',')
            classmodule = importlib.import_module(a[0].lower())
            classInst = getattr(classmodule, a[0])
            OponentAgent = classInst
            oponentAgent_name = a[1]
            if len(a) > 2:
                oponent_url = a[2]

    if agentproxy:
        if student_url == None:
            print("Must specify --student-agent Agent,name,websocket")
            sys.exit(1)
        print("Connecting to {}".format(student_url))
        asyncio.get_event_loop().run_until_complete(
            proxy(student_url, StudentAgent, studentAgent_name))
    else:
        try:
            game = SnakeGame(hor=60,
                             ver=40,
                             tilesize=15,
                             fps=50,
                             visual=visual,
                             obstacles=15,
                             mapa=inputfile)
            print("Launching game <{}>".format(game.gameid))
            game.setPlayers([
                StudentAgent([game.playerPos()], name=studentAgent_name) if
                student_url == None else StudentAgent([game.playerPos()],
                                                      name=studentAgent_name,
                                                      url=student_url,
                                                      gameid=game.gameid),
                Dummy([game.playerPos()], name=oponentAgent_name) if
                oponent_url == None else OponentAgent([game.playerPos()],
                                                      name=oponentAgent_name,
                                                      url=oponent_url,
                                                      gameid=game.gameid),
            ])
        except Exception as e:
            print(e)
            sys.exit(1)

        game.start()