Пример #1
0
def draw (gp, display) :
    #draw the goal and score
    Goal.draw(display)
    ScoreBoard.drawScore(gp.score, display)
    #create the soccer team and ball nodes if first draw or just draw else
    if gp.playersNodes is None:
        gp.setPlayers(SoccerPlayer.drawTeam(display))
    else:
        for player in gp.playersNodes:
            player.draw(display)
    if gp.ballNode is None:
        gp.setBall(Ball.Ball())
        gp.ballNode.draw(display)
    else:
        gp.ballNode.draw(display)
Пример #2
0
    def events(self):
        keys = pygame.key.get_pressed()
        for e in pygame.event.get():
            if e.type == pygame.QUIT:
                pygame.quit()
                exit()
            if e.type == pygame.KEYDOWN:
                if e.key == pygame.K_w:
                    self.player.jump()
            if e.type == pygame.KEYUP:
                if e.key == pygame.K_w:
                    self.player.jump_cut()

        if (len(self.goals) == 0
                or (pygame.time.get_ticks() - self.time) / 1000 > 10):
            self.time = pygame.time.get_ticks()
            Goal(self, random.choice(self.positions))

        if (pygame.time.get_ticks() - self.timeTimer) / 1000 > .5:
            self.timeTimer = pygame.time.get_ticks()
            self.timer -= .5

        if (self.timer < 0):
            self.gameOver = True

        self.player.events()
Пример #3
0
def organizer():
    return_error = lambda local_error: render_template('organizer.html',
                                                       goals=goals.goal_list,
                                                       needs=needs.goal_list,
                                                       error=local_error)
    update_organizer = lambda: render_template(
        'organizer.html', needs=needs.goal_list, goals=goals.goal_list)
    if request.method == 'POST':
        if not ('goal_name' in request.form and 'goal_cost' in request.form
                and 'goal_priority' in request.form):
            return return_error(
                'Enter your goal, cost, and how important it is to you!')
        else:
            session['goal_name'] = request.form['goal_name']
            session['goal_cost'] = request.form['goal_cost']
            session['goal_priority'] = request.form['goal_priority']
            #Adds New Goal to Goals
            goals.append(
                gl.Goal(int(request.form['goal_cost']),
                        -1,
                        -1,
                        request.form['goal_name'],
                        int(request.form['goal_priority']),
                        i=None))
            #Updates Values that need to be updated
            goals.set_indices()
            goals.update()
            return update_organizer()
    return render_template('organizer.html')
Пример #4
0
    def __init__(self):
        SceneBase.__init__(self)
        playerimage = pygame.transform.scale(pygame.image.load("Images/player.png"), (30, 30))
        # creates the Player character in the location 20, 20
        self.player = Player.Player(30, 30, playerimage)

        blueParticle = pygame.image.load("Images/particle_blue.png")
        redParticle = pygame.image.load("Images/particle_red.png")
        # Defines the starting positions of the first two Particles for level 1 of the game
        self.particle1 = Particle.Particle(100, 100, False, None, redParticle, False)
        self.particle2 = Particle.Particle(100, 200, True, self.particle1, blueParticle, False)  # Particle 2 is entangled to Particle one

        # Defines the position for the first goal for level 1 of the game
        self.goal = Goal.Goal(400, 400)

        # NOTE: Negative numbers in wall declarations ruin collision detection
        self.leftWall = Wall.Wall(0, 0, 20, 600)
        self.rightWall = Wall.Wall(780, 0, 20, 600)
        self.topWall = Wall.Wall(0, 0, 800, 20)
        self.bottomWall = Wall.Wall(0, 580, 800, 20)
        self.door = Door.Door(760, 300, 20, 100)
        self.walls=[self.leftWall,self.rightWall,self.bottomWall,self.topWall]

        # Defines the objects that the Player character cannot pass through
        self.entities = [self.player,self.particle1, self.particle2, self.leftWall, self.rightWall, self.topWall, self.bottomWall]
        self.particles=[self.particle1,self.particle2]
        self.startTime=int(round(time.time()))
        pygame.mixer.music.load('A Strange Charm.wav')
        pygame.mixer.music.play(-1)
Пример #5
0
    def __init__(self, configuration):

        super().__init__()

        # There is only one agent in this setting
        self.agent_id = 0

        # Dialogue statistics
        self.dialogue_episode = 0
        self.dialogue_turn = 0
        self.num_successful_dialogues = 0
        self.num_task_success = 0
        self.cumulative_rewards = 0
        self.total_dialogue_turns = 0

        self.minibatch_length = 50
        self.train_interval = 10
        self.num_batches_per_epoch = 10

        self.SAVE_LOG = True

        # The dialogue will terminate after MAX_TURNS (this agent will issue
        # a bye() dialogue act.
        self.MAX_TURNS = 15

        self.dialogue_turn = -1
        self.dialogue_manager = None
        self.user_model = None

        self.agent_goal = None
        self.goal_generator = None

        self.prev_turnstate = TurnState()
        self.curr_state = None

        self.recorder = DialogueEpisodeRecorder()

        # TODO: Handle this properly - get reward function type from config
        self.reward_func = SlotFillingReward()

        self.ontology, self.database = build_domain_settings(
            configuration["DIALOGUE"])
        self.user_simulator = AgendaBasedUS(
            goal_generator=Goal.GoalGenerator(self.ontology, self.database),
            error_model=ErrorModel(
                self.ontology,
                slot_confuse_prob=0.0,
                op_confuse_prob=0.0,
                value_confuse_prob=0.0,
            ),
        )

        self.dialogue_manager = DialogueManager.DialogueManager(
            configuration,
            self.ontology,
            self.database,
            self.agent_id,
            "system",
            configuration["AGENT_0"]["DM"]["policy"],
        )
Пример #6
0
def getGoal(goal_msg):
    """
    Create and get list of Goal obj \n
    Args:
        goal_msg: msg of goal
    Return: list of goal and positions
        goal_list: list of Goal obj 
        target_pos: positions of goals
    """
    goal_list = []
    target_pos = []
    for g in goal_msg.goal:
        grasp_points = []
        id = g.id
        center = PoseMsgToMatrix(g.center)
        #tmp_c = np.array([g.center.position.x, g.center.position.y, g.center.position.z])
        tmp_c = np.array([
            g.grasping_points[0].pose.position.x,
            g.grasping_points[0].pose.position.y,
            g.grasping_points[0].pose.position.z
        ])
        target_pos.append(tmp_c)
        for grasp in g.grasping_points:
            grasp_points.append(grasp)
        goal = Goal.Goal(id, center, grasp_points)
        goal_list.append(goal)

    return goal_list, target_pos
def makeGoals():
    goal = Goal(1, 15)
    goal.params['numRuns'] = 3
    goal.params['totalDuration'] = 60
    goals_list.append(goal)

    goal = Goal(2, 20)
    goal.params['runAvgSpeed'] = 10
    goal.params['totalDistance'] = 30
    goals_list.append(goal)

    goal = Goal(3, 30)
    goal.params['totalDistance'] = 60
    goal.params['runMinSpeed'] = 8
    goals_list.append(goal)
Пример #8
0
def createNewGoal(self, wherex, wherey, screenCoordinates=1):
    self.fromClass = None
    self.toClass = None
    # try the global constraints...
    res = self.ASGroot.preCondition(ASG.CREATE)
    if res:
        self.constraintViolation(res)
        self.mode = self.IDLEMODE
        return

    new_semantic_obj = Goal(self)
    res = new_semantic_obj.preCondition(ASGNode.CREATE)
    if res: return self.constraintViolation(res)
    new_semantic_obj.preAction(ASGNode.CREATE)

    ne = len(self.ASGroot.listNodes["Goal"])
    if new_semantic_obj.keyword_:
        new_semantic_obj.keyword_.setValue(
            new_semantic_obj.keyword_.toString() + str(ne))
    if screenCoordinates:
        new_obj = graph_Goal(self.UMLmodel.canvasx(wherex),
                             self.UMLmodel.canvasy(wherey), new_semantic_obj)
    else:  # already in canvas coordinates
        new_obj = graph_Goal(wherex, wherey, new_semantic_obj)
    new_obj.DrawObject(self.UMLmodel, self.editGGLabel)
    self.UMLmodel.addtag_withtag("Goal", new_obj.tag)
    new_semantic_obj.graphObject_ = new_obj
    self.ASGroot.addNode(new_semantic_obj)
    res = self.ASGroot.postCondition(ASG.CREATE)
    if res:
        self.constraintViolation(res)
        self.mode = self.IDLEMODE
        return

    res = new_semantic_obj.postCondition(ASGNode.CREATE)
    if res:
        self.constraintViolation(res)
        self.mode = self.IDLEMODE
        return
    new_semantic_obj.postAction(ASGNode.CREATE)

    self.mode = self.IDLEMODE
    if self.editGGLabel:
        self.statusbar.event(StatusBar.TRANSFORMATION, StatusBar.CREATE)
    else:
        self.statusbar.event(StatusBar.MODEL, StatusBar.CREATE)
    return new_semantic_obj
Пример #9
0
    def __init__(self, player, clock):
        SceneBase.__init__(self)
        # creates the Player character in the location 20, 20
        self.player = player
        player.x = 30
        player.y = 30

        # Defines the starting positions of the first two Particles for level 3 of the game
        self.particle1 = Particle.Particle(90, 360, False, None, greenParticle,
                                           False)
        self.particle2 = Particle.Particle(
            90, 80, True, self.particle1, greenParticle,
            False)  # Particle 2 is entangled to Particle one

        # Defines the position for the first goal for level 3 of the game
        self.goal = Goal.Goal(720, 530)
        self.door = Door.Door(760, 100, 20, 100)
        # NOTE: Negative numbers in wall declarations ruin collision detection
        self.leftWall = Wall.Wall(0, 0, 20, 600)
        self.rightWall = Wall.Wall(780, 0, 20, 600)
        self.topWall = Wall.Wall(0, 0, 800, 20)
        self.bottomWall = Wall.Wall(0, 580, 800, 20)

        self.centerWallObstacle = Wall.Wall(20, 290, 780, 30)
        self.lowerWallObstacle = Wall.Wall(20, 390, 280, 20)
        self.middleWallObstacle = Wall.Wall(380, 300, 20, 180)
        self.rightWallObstacleOne = Wall.Wall(500, 450, 20, 130)
        self.rightWallObstacleTwo = Wall.Wall(580, 360, 200, 20)
        self.walls = [
            self.leftWall, self.rightWall, self.bottomWall, self.topWall,
            self.centerWallObstacle, self.lowerWallObstacle,
            self.middleWallObstacle, self.rightWallObstacleOne,
            self.rightWallObstacleTwo
        ]

        # Defines the objects that the Player character cannot pass through
        self.entities = [
            self.player, self.particle1, self.particle2, self.leftWall,
            self.rightWall, self.topWall, self.bottomWall,
            self.centerWallObstacle, self.lowerWallObstacle,
            self.middleWallObstacle, self.rightWallObstacleOne,
            self.rightWallObstacleTwo
        ]
        self.particles = [self.particle1, self.particle2]
        self.startTime = clock
Пример #10
0
def collisionCheck (pm, gp): 
    #break if players not set yet
    if gp.playersNodes is None:
        return
    #check the node rects for collision    
    for player in gp.playersNodes :
        if player.collidesWithBall(gp.ballNode, Ball.radius):
        #    print("game lost")
            endLevel(False, pm, gp)
    #check if player scored
    if Goal.collidesWithBall(gp.ballNode, Ball.radius):
        print("game won")
        endLevel(True, pm, gp)
    else: #check for user colliding with walls
        if gp.ballNode.position[1] < Ball.radius \
                or gp.ballNode.position[1] > GameProperties.size[1] - Ball.radius \
                or gp.ballNode.position[0] < Ball.radius \
                or gp.ballNode.position[0] > GameProperties.size[0] + Ball.radius:
                    endLevel(False, pm, gp)
Пример #11
0
    def create(self, platforms, buttons, spikes, goals, clones):
        # Adds clones that aren't part of the spawn point as platforms
        clone_list = pygame.sprite.Group()
        for platform in clones:
            block = Clone.Clone(platform[4], platform[5])
            block.rect.x = platform[2]
            block.rect.y = platform[3]
            clone_list.add(block)
        pygame.sprite.spritecollide(self.player, clone_list, True)
        for clone in clone_list:
            self.platform_list.add(clone)

        # Go through the array above and add platforms
        for platform in platforms:
            block = plat.Platform(platform[0], platform[1])
            block.rect.x = platform[2]
            block.rect.y = platform[3]
            self.platform_list.add(block)
            for button in buttons:
                if platform == button[1]:
                    but = bt.Button(self.player, clone_list, block, self)
                    but.rect.x = button[0][0]
                    but.rect.y = button[0][1]
                    self.button_list.add(but)

        for spike in spikes:
            block = sp.Spike(spike[2])
            block.rect.x = spike[0]
            block.rect.y = spike[1]
            self.spike_list.add(block)

        for goal in goals:
            block = gl.Goal(goal[0], goal[1])
            block.rect.x = goal[2]
            block.rect.y = goal[3]
            self.goal_list.add(block)
                              mPR, mPS)
                gpsData = GPS.readGPS()
                Motor.motor(mPL, mPR, 0.1, 1)
            print("Running Phase Finished")
            IM920.Send("P7F")

# ------------------- GoalDetection Phase ------------------- #
        if (phaseChk <= 8):
            Other.saveLog(phaseLog, "8", "GoalDetection Phase Started",
                          time.time() - t_start)
            print("Goal Detection Phase Started")
            IM920.Send("P8S")
            H_min = 200
            H_max = 10
            S_thd = 120
            goal = Goal.Togoal(photopath, H_min, H_max, S_thd)
            while goal[0] != 0:
                gpsdata = GPS.readGPS()
                goal = Goal.Togoal(photopath, H_min, H_max, S_thd)
                print("goal is", goal)
                Other.saveLog(goalDetectionLog,
                              time.time() - t_start, gpsData, goal)
                Other.saveLog(captureLog, time.time() - t_start, goal)
            print("Goal Detection Phase Finished")
            IM920.Send("P8F")

        print("Program Finished")
        IM920.Send("P10")
        Other.saveLog(phaseLog, "10", "Program Finished",
                      time.time() - t_start)
        close()
Пример #13
0
# Evergreen Variables
###########################################

game_state = STATE.END
game_timer = Timer(TIMER_TYPES.MATCH)

match_number = -1
alliances = {ALLIANCE_COLOR.GOLD: None, ALLIANCE_COLOR.BLUE: None}

###########################################
# Game Specific Variables
###########################################


goals = {
    GOAL.A : Goal(GOAL.A, CONSTANTS.GOAL_LOW_VALUE, CONSTANTS.GOAL_LOW_COST),
    GOAL.B : Goal(GOAL.B, CONSTANTS.GOAL_MED_VALUE, CONSTANTS.GOAL_MED_COST),
    GOAL.C : Goal(GOAL.C, CONSTANTS.GOAL_HIGH_VALUE, CONSTANTS.GOAL_HIGH_COST),
    GOAL.D : Goal(GOAL.D, CONSTANTS.GOAL_MED_VALUE, CONSTANTS.GOAL_MED_COST),
    GOAL.E : Goal(GOAL.E, CONSTANTS.GOAL_LOW_VALUE, CONSTANTS.GOAL_LOW_COST),
    GOAL.BLUE : Goal(GOAL.BLUE, CONSTANTS.GOAL_BASE_VALUE, 0),
    GOAL.GOLD : Goal(GOAL.GOLD, CONSTANTS.GOAL_BASE_VALUE, 0),
}

rfid_pool = None
curr_rfids = None
powerup_functions = [POWERUP_TYPES.ZERO_X,
                     POWERUP_TYPES.TWO_X,
                     POWERUP_TYPES.STEAL,
                     POWERUP_TYPES.ZERO_X,
                     POWERUP_TYPES.TWO_X,
    def __init__(self, parent):
        GGrule.__init__(self, 15)
        self.TimeDelay = ATOM3Integer(2)
        self.exactMatch = 1
        self.LHS = ASG_pns(parent)
        self.LHS.merge(ASG_omacs(parent))
        self.LHS.merge(ASG_GenericGraph(parent))

        self.obj1677 = product(parent)
        self.obj1677.preAction(self.LHS.CREATE)
        self.obj1677.isGraphObjectVisual = True

        if (hasattr(self.obj1677, '_setHierarchicalLink')):
            self.obj1677._setHierarchicalLink(False)

        # MaxFlow
        self.obj1677.MaxFlow.setNone()

        # price
        self.obj1677.price.setValue(0)

        # Name
        self.obj1677.Name.setValue('')
        self.obj1677.Name.setNone()

        # ReqFlow
        self.obj1677.ReqFlow.setNone()

        self.obj1677.GGLabel.setValue(5)
        self.obj1677.graphClass_ = graph_product
        if parent.genGraphics:
            new_obj = graph_product(280.0, 220.0, self.obj1677)
            new_obj.layConstraints = dict()  # Graphical Layout Constraints
            new_obj.layConstraints['scale'] = [1.0, 1.0]
        else:
            new_obj = None
        self.obj1677.graphObject_ = new_obj

        # Add node to the root: self.LHS
        self.LHS.addNode(self.obj1677)
        self.obj1677.postAction(self.LHS.CREATE)

        self.obj1678 = metarial(parent)
        self.obj1678.preAction(self.LHS.CREATE)
        self.obj1678.isGraphObjectVisual = True

        if (hasattr(self.obj1678, '_setHierarchicalLink')):
            self.obj1678._setHierarchicalLink(False)

        # MaxFlow
        self.obj1678.MaxFlow.setNone()

        # price
        self.obj1678.price.setValue(0)

        # Name
        self.obj1678.Name.setValue('')
        self.obj1678.Name.setNone()

        # ReqFlow
        self.obj1678.ReqFlow.setNone()

        self.obj1678.GGLabel.setValue(3)
        self.obj1678.graphClass_ = graph_metarial
        if parent.genGraphics:
            new_obj = graph_metarial(320.0, 40.0, self.obj1678)
            new_obj.layConstraints = dict()  # Graphical Layout Constraints
            new_obj.layConstraints['scale'] = [1.0, 1.0]
        else:
            new_obj = None
        self.obj1678.graphObject_ = new_obj

        # Add node to the root: self.LHS
        self.LHS.addNode(self.obj1678)
        self.obj1678.postAction(self.LHS.CREATE)

        self.obj1679 = Goal(parent)
        self.obj1679.preAction(self.LHS.CREATE)
        self.obj1679.isGraphObjectVisual = True

        if (hasattr(self.obj1679, '_setHierarchicalLink')):
            self.obj1679._setHierarchicalLink(False)

        # name
        self.obj1679.name.setValue('')
        self.obj1679.name.setNone()

        self.obj1679.GGLabel.setValue(2)
        self.obj1679.graphClass_ = graph_Goal
        if parent.genGraphics:
            new_obj = graph_Goal(180.0, 60.0, self.obj1679)
            new_obj.layConstraints = dict()  # Graphical Layout Constraints
            new_obj.layConstraints['scale'] = [1.0, 1.0]
        else:
            new_obj = None
        self.obj1679.graphObject_ = new_obj

        # Add node to the root: self.LHS
        self.LHS.addNode(self.obj1679)
        self.obj1679.postAction(self.LHS.CREATE)

        self.obj1680 = GenericGraphEdge(parent)
        self.obj1680.preAction(self.LHS.CREATE)
        self.obj1680.isGraphObjectVisual = True

        if (hasattr(self.obj1680, '_setHierarchicalLink')):
            self.obj1680._setHierarchicalLink(False)

        self.obj1680.GGLabel.setValue(4)
        self.obj1680.graphClass_ = graph_GenericGraphEdge
        if parent.genGraphics:
            new_obj = graph_GenericGraphEdge(264.5, 71.5, self.obj1680)
            new_obj.layConstraints = dict()  # Graphical Layout Constraints
        else:
            new_obj = None
        self.obj1680.graphObject_ = new_obj

        # Add node to the root: self.LHS
        self.LHS.addNode(self.obj1680)
        self.obj1680.postAction(self.LHS.CREATE)

        self.obj1679.out_connections_.append(self.obj1680)
        self.obj1680.in_connections_.append(self.obj1679)
        self.obj1679.graphObject_.pendingConnections.append(
            (self.obj1679.graphObject_.tag, self.obj1680.graphObject_.tag,
             [203.0, 61.0, 264.5, 71.5], 0, True))
        self.obj1680.out_connections_.append(self.obj1678)
        self.obj1678.in_connections_.append(self.obj1680)
        self.obj1680.graphObject_.pendingConnections.append(
            (self.obj1680.graphObject_.tag, self.obj1678.graphObject_.tag,
             [326.0, 82.0, 264.5, 71.5], 0, True))

        self.RHS = ASG_pns(parent)
        self.RHS.merge(ASG_omacs(parent))
        self.RHS.merge(ASG_GenericGraph(parent))

        self.obj1684 = product(parent)
        self.obj1684.preAction(self.RHS.CREATE)
        self.obj1684.isGraphObjectVisual = True

        if (hasattr(self.obj1684, '_setHierarchicalLink')):
            self.obj1684._setHierarchicalLink(False)

        # MaxFlow
        self.obj1684.MaxFlow.setNone()

        # price
        self.obj1684.price.setValue(0)

        # Name
        self.obj1684.Name.setValue('')
        self.obj1684.Name.setNone()

        # ReqFlow
        self.obj1684.ReqFlow.setNone()

        self.obj1684.GGLabel.setValue(5)
        self.obj1684.graphClass_ = graph_product
        if parent.genGraphics:
            new_obj = graph_product(280.0, 220.0, self.obj1684)
            new_obj.layConstraints = dict()  # Graphical Layout Constraints
            new_obj.layConstraints['scale'] = [1.0, 1.0]
        else:
            new_obj = None
        self.obj1684.graphObject_ = new_obj
        self.obj16840 = AttrCalc()
        self.obj16840.Copy = ATOM3Boolean()
        self.obj16840.Copy.setValue(('Copy from LHS', 1))
        self.obj16840.Copy.config = 0
        self.obj16840.Specify = ATOM3Constraint()
        self.obj16840.Specify.setValue(
            ('AttrSpecify', (['Python', 'OCL'], 0),
             (['PREcondition', 'POSTcondition'], 1), ([
                 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT',
                 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE'
             ], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), None))
        self.obj1684.GGset2Any['MaxFlow'] = self.obj16840
        self.obj16841 = AttrCalc()
        self.obj16841.Copy = ATOM3Boolean()
        self.obj16841.Copy.setValue(('Copy from LHS', 1))
        self.obj16841.Copy.config = 0
        self.obj16841.Specify = ATOM3Constraint()
        self.obj16841.Specify.setValue(
            ('AttrSpecify', (['Python', 'OCL'], 0),
             (['PREcondition', 'POSTcondition'], 1), ([
                 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT',
                 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE'
             ], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), None))
        self.obj1684.GGset2Any['Name'] = self.obj16841
        self.obj16842 = AttrCalc()
        self.obj16842.Copy = ATOM3Boolean()
        self.obj16842.Copy.setValue(('Copy from LHS', 1))
        self.obj16842.Copy.config = 0
        self.obj16842.Specify = ATOM3Constraint()
        self.obj16842.Specify.setValue(
            ('AttrSpecify', (['Python', 'OCL'], 0),
             (['PREcondition', 'POSTcondition'], 1), ([
                 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT',
                 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE'
             ], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), None))
        self.obj1684.GGset2Any['ReqFlow'] = self.obj16842

        # Add node to the root: self.RHS
        self.RHS.addNode(self.obj1684)
        self.obj1684.postAction(self.RHS.CREATE)

        self.obj1685 = metarial(parent)
        self.obj1685.preAction(self.RHS.CREATE)
        self.obj1685.isGraphObjectVisual = True

        if (hasattr(self.obj1685, '_setHierarchicalLink')):
            self.obj1685._setHierarchicalLink(False)

        # MaxFlow
        self.obj1685.MaxFlow.setNone()

        # price
        self.obj1685.price.setValue(0)

        # Name
        self.obj1685.Name.setValue('')
        self.obj1685.Name.setNone()

        # ReqFlow
        self.obj1685.ReqFlow.setNone()

        self.obj1685.GGLabel.setValue(3)
        self.obj1685.graphClass_ = graph_metarial
        if parent.genGraphics:
            new_obj = graph_metarial(320.0, 40.0, self.obj1685)
            new_obj.layConstraints = dict()  # Graphical Layout Constraints
            new_obj.layConstraints['scale'] = [1.0, 1.0]
        else:
            new_obj = None
        self.obj1685.graphObject_ = new_obj
        self.obj16850 = AttrCalc()
        self.obj16850.Copy = ATOM3Boolean()
        self.obj16850.Copy.setValue(('Copy from LHS', 1))
        self.obj16850.Copy.config = 0
        self.obj16850.Specify = ATOM3Constraint()
        self.obj16850.Specify.setValue(
            ('AttrSpecify', (['Python', 'OCL'], 0),
             (['PREcondition', 'POSTcondition'], 1), ([
                 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT',
                 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE'
             ], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), None))
        self.obj1685.GGset2Any['MaxFlow'] = self.obj16850
        self.obj16851 = AttrCalc()
        self.obj16851.Copy = ATOM3Boolean()
        self.obj16851.Copy.setValue(('Copy from LHS', 1))
        self.obj16851.Copy.config = 0
        self.obj16851.Specify = ATOM3Constraint()
        self.obj16851.Specify.setValue(
            ('AttrSpecify', (['Python', 'OCL'], 0),
             (['PREcondition', 'POSTcondition'], 1), ([
                 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT',
                 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE'
             ], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), None))
        self.obj1685.GGset2Any['Name'] = self.obj16851
        self.obj16852 = AttrCalc()
        self.obj16852.Copy = ATOM3Boolean()
        self.obj16852.Copy.setValue(('Copy from LHS', 1))
        self.obj16852.Copy.config = 0
        self.obj16852.Specify = ATOM3Constraint()
        self.obj16852.Specify.setValue(
            ('AttrSpecify', (['Python', 'OCL'], 0),
             (['PREcondition', 'POSTcondition'], 1), ([
                 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT',
                 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE'
             ], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), None))
        self.obj1685.GGset2Any['ReqFlow'] = self.obj16852

        # Add node to the root: self.RHS
        self.RHS.addNode(self.obj1685)
        self.obj1685.postAction(self.RHS.CREATE)

        self.obj1686 = operatingUnit(parent)
        self.obj1686.preAction(self.RHS.CREATE)
        self.obj1686.isGraphObjectVisual = True

        if (hasattr(self.obj1686, '_setHierarchicalLink')):
            self.obj1686._setHierarchicalLink(False)

        # OperCostProp
        self.obj1686.OperCostProp.setValue(1.0)

        # name
        self.obj1686.name.setValue('')
        self.obj1686.name.setNone()

        # OperCostFix
        self.obj1686.OperCostFix.setValue(2.0)

        self.obj1686.GGLabel.setValue(7)
        self.obj1686.graphClass_ = graph_operatingUnit
        if parent.genGraphics:
            new_obj = graph_operatingUnit(320.0, 140.0, self.obj1686)
            new_obj.layConstraints = dict()  # Graphical Layout Constraints
            new_obj.layConstraints['scale'] = [1.0, 1.0]
        else:
            new_obj = None
        self.obj1686.graphObject_ = new_obj
        self.obj16860 = AttrCalc()
        self.obj16860.Copy = ATOM3Boolean()
        self.obj16860.Copy.setValue(('Copy from LHS', 0))
        self.obj16860.Copy.config = 0
        self.obj16860.Specify = ATOM3Constraint()
        self.obj16860.Specify.setValue(
            ('AttrSpecify', (['Python', 'OCL'], 0),
             (['PREcondition', 'POSTcondition'], 1), ([
                 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT',
                 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE'
             ], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), None))
        self.obj1686.GGset2Any['OperCostProp'] = self.obj16860
        self.obj16861 = AttrCalc()
        self.obj16861.Copy = ATOM3Boolean()
        self.obj16861.Copy.setValue(('Copy from LHS', 0))
        self.obj16861.Copy.config = 0
        self.obj16861.Specify = ATOM3Constraint()
        self.obj16861.Specify.setValue(
            ('AttrSpecify', (['Python', 'OCL'], 0),
             (['PREcondition', 'POSTcondition'], 1), ([
                 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT',
                 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE'
             ], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]),
             'return self.getMatched(graphID, self.LHS.nodeWithLabel(2)).name.getValue()+\' OAF\'\n'
             ))
        self.obj1686.GGset2Any['name'] = self.obj16861
        self.obj16862 = AttrCalc()
        self.obj16862.Copy = ATOM3Boolean()
        self.obj16862.Copy.setValue(('Copy from LHS', 0))
        self.obj16862.Copy.config = 0
        self.obj16862.Specify = ATOM3Constraint()
        self.obj16862.Specify.setValue(
            ('AttrSpecify', (['Python', 'OCL'], 0),
             (['PREcondition', 'POSTcondition'], 1), ([
                 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT',
                 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE'
             ], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), None))
        self.obj1686.GGset2Any['OperCostFix'] = self.obj16862

        # Add node to the root: self.RHS
        self.RHS.addNode(self.obj1686)
        self.obj1686.postAction(self.RHS.CREATE)

        self.obj1687 = intoProduct(parent)
        self.obj1687.preAction(self.RHS.CREATE)
        self.obj1687.isGraphObjectVisual = True

        if (hasattr(self.obj1687, '_setHierarchicalLink')):
            self.obj1687._setHierarchicalLink(False)

        # rate
        self.obj1687.rate.setValue(1.0)

        self.obj1687.GGLabel.setValue(9)
        self.obj1687.graphClass_ = graph_intoProduct
        if parent.genGraphics:
            new_obj = graph_intoProduct(322.0, 179.0, self.obj1687)
            new_obj.layConstraints = dict()  # Graphical Layout Constraints
            new_obj.layConstraints['scale'] = [1.0, 1.0]
        else:
            new_obj = None
        self.obj1687.graphObject_ = new_obj
        self.obj16870 = AttrCalc()
        self.obj16870.Copy = ATOM3Boolean()
        self.obj16870.Copy.setValue(('Copy from LHS', 0))
        self.obj16870.Copy.config = 0
        self.obj16870.Specify = ATOM3Constraint()
        self.obj16870.Specify.setValue(
            ('AttrSpecify', (['Python', 'OCL'], 0),
             (['PREcondition', 'POSTcondition'], 1), ([
                 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT',
                 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE'
             ], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), None))
        self.obj1687.GGset2Any['rate'] = self.obj16870

        # Add node to the root: self.RHS
        self.RHS.addNode(self.obj1687)
        self.obj1687.postAction(self.RHS.CREATE)

        self.obj1688 = fromMaterial(parent)
        self.obj1688.preAction(self.RHS.CREATE)
        self.obj1688.isGraphObjectVisual = True

        if (hasattr(self.obj1688, '_setHierarchicalLink')):
            self.obj1688._setHierarchicalLink(False)

        # rate
        self.obj1688.rate.setValue(1.0)

        self.obj1688.GGLabel.setValue(8)
        self.obj1688.graphClass_ = graph_fromMaterial
        if parent.genGraphics:
            new_obj = graph_fromMaterial(342.0, 110.0, self.obj1688)
            new_obj.layConstraints = dict()  # Graphical Layout Constraints
            new_obj.layConstraints['scale'] = [1.0, 1.0]
        else:
            new_obj = None
        self.obj1688.graphObject_ = new_obj
        self.obj16880 = AttrCalc()
        self.obj16880.Copy = ATOM3Boolean()
        self.obj16880.Copy.setValue(('Copy from LHS', 0))
        self.obj16880.Copy.config = 0
        self.obj16880.Specify = ATOM3Constraint()
        self.obj16880.Specify.setValue(
            ('AttrSpecify', (['Python', 'OCL'], 0),
             (['PREcondition', 'POSTcondition'], 1), ([
                 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT',
                 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE'
             ], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), None))
        self.obj1688.GGset2Any['rate'] = self.obj16880

        # Add node to the root: self.RHS
        self.RHS.addNode(self.obj1688)
        self.obj1688.postAction(self.RHS.CREATE)

        self.obj1689 = Goal(parent)
        self.obj1689.preAction(self.RHS.CREATE)
        self.obj1689.isGraphObjectVisual = True

        if (hasattr(self.obj1689, '_setHierarchicalLink')):
            self.obj1689._setHierarchicalLink(False)

        # name
        self.obj1689.name.setValue('')
        self.obj1689.name.setNone()

        self.obj1689.GGLabel.setValue(2)
        self.obj1689.graphClass_ = graph_Goal
        if parent.genGraphics:
            new_obj = graph_Goal(180.0, 60.0, self.obj1689)
            new_obj.layConstraints = dict()  # Graphical Layout Constraints
            new_obj.layConstraints['scale'] = [1.0, 1.0]
        else:
            new_obj = None
        self.obj1689.graphObject_ = new_obj
        self.obj16890 = AttrCalc()
        self.obj16890.Copy = ATOM3Boolean()
        self.obj16890.Copy.setValue(('Copy from LHS', 1))
        self.obj16890.Copy.config = 0
        self.obj16890.Specify = ATOM3Constraint()
        self.obj16890.Specify.setValue(
            ('AttrSpecify', (['Python', 'OCL'], 0),
             (['PREcondition', 'POSTcondition'], 1), ([
                 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT',
                 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE'
             ], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), None))
        self.obj1689.GGset2Any['name'] = self.obj16890

        # Add node to the root: self.RHS
        self.RHS.addNode(self.obj1689)
        self.obj1689.postAction(self.RHS.CREATE)

        self.obj1690 = GenericGraphEdge(parent)
        self.obj1690.preAction(self.RHS.CREATE)
        self.obj1690.isGraphObjectVisual = True

        if (hasattr(self.obj1690, '_setHierarchicalLink')):
            self.obj1690._setHierarchicalLink(False)

        self.obj1690.GGLabel.setValue(4)
        self.obj1690.graphClass_ = graph_GenericGraphEdge
        if parent.genGraphics:
            new_obj = graph_GenericGraphEdge(264.5, 71.5, self.obj1690)
            new_obj.layConstraints = dict()  # Graphical Layout Constraints
        else:
            new_obj = None
        self.obj1690.graphObject_ = new_obj

        # Add node to the root: self.RHS
        self.RHS.addNode(self.obj1690)
        self.obj1690.postAction(self.RHS.CREATE)

        self.obj1685.out_connections_.append(self.obj1688)
        self.obj1688.in_connections_.append(self.obj1685)
        self.obj1685.graphObject_.pendingConnections.append(
            (self.obj1685.graphObject_.tag, self.obj1688.graphObject_.tag,
             [244.0, 89.0, 342.0, 110.0], 0, True))
        self.obj1686.out_connections_.append(self.obj1687)
        self.obj1687.in_connections_.append(self.obj1686)
        self.obj1686.graphObject_.pendingConnections.append(
            (self.obj1686.graphObject_.tag, self.obj1687.graphObject_.tag,
             [339.0, 158.0, 322.0, 179.0], 0, True))
        self.obj1687.out_connections_.append(self.obj1684)
        self.obj1684.in_connections_.append(self.obj1687)
        self.obj1687.graphObject_.pendingConnections.append(
            (self.obj1687.graphObject_.tag, self.obj1684.graphObject_.tag,
             [305.0, 220.0, 322.0, 179.0], 0, True))
        self.obj1688.out_connections_.append(self.obj1686)
        self.obj1686.in_connections_.append(self.obj1688)
        self.obj1688.graphObject_.pendingConnections.append(
            (self.obj1688.graphObject_.tag, self.obj1686.graphObject_.tag,
             [340.0, 151.0, 342.0, 110.0], 0, True))
        self.obj1689.out_connections_.append(self.obj1690)
        self.obj1690.in_connections_.append(self.obj1689)
        self.obj1689.graphObject_.pendingConnections.append(
            (self.obj1689.graphObject_.tag, self.obj1690.graphObject_.tag,
             [93.0, 61.0, 264.5, 71.5], 2, 0))
        self.obj1690.out_connections_.append(self.obj1685)
        self.obj1685.in_connections_.append(self.obj1690)
        self.obj1690.graphObject_.pendingConnections.append(
            (self.obj1690.graphObject_.tag, self.obj1685.graphObject_.tag,
             [226.0, 82.0, 264.5, 71.5], 2, 0))
Пример #15
0
    def __init__(self, parent):
        GGrule.__init__(self, 25)
        self.TimeDelay = ATOM3Integer(2)
        self.exactMatch = 1
        self.LHS = ASG_pns(parent)
        self.LHS.merge(ASG_omacs(parent))
        self.LHS.merge(ASG_GenericGraph(parent))

        self.obj1815 = metarial(parent)
        self.obj1815.preAction(self.LHS.CREATE)
        self.obj1815.isGraphObjectVisual = True

        if (hasattr(self.obj1815, '_setHierarchicalLink')):
            self.obj1815._setHierarchicalLink(False)

        # MaxFlow
        self.obj1815.MaxFlow.setNone()

        # price
        self.obj1815.price.setValue(0)

        # Name
        self.obj1815.Name.setValue('')
        self.obj1815.Name.setNone()

        # ReqFlow
        self.obj1815.ReqFlow.setNone()

        self.obj1815.GGLabel.setValue(1)
        self.obj1815.graphClass_ = graph_metarial
        if parent.genGraphics:
            new_obj = graph_metarial(280.0, 60.0, self.obj1815)
            new_obj.layConstraints = dict()  # Graphical Layout Constraints
            new_obj.layConstraints['scale'] = [1.0, 1.0]
        else:
            new_obj = None
        self.obj1815.graphObject_ = new_obj

        # Add node to the root: self.LHS
        self.LHS.addNode(self.obj1815)
        self.obj1815.postAction(self.LHS.CREATE)

        self.obj1816 = Goal(parent)
        self.obj1816.preAction(self.LHS.CREATE)
        self.obj1816.isGraphObjectVisual = True

        if (hasattr(self.obj1816, '_setHierarchicalLink')):
            self.obj1816._setHierarchicalLink(False)

        # name
        self.obj1816.name.setValue('')
        self.obj1816.name.setNone()

        self.obj1816.GGLabel.setValue(3)
        self.obj1816.graphClass_ = graph_Goal
        if parent.genGraphics:
            new_obj = graph_Goal(100.0, 60.0, self.obj1816)
            new_obj.layConstraints = dict()  # Graphical Layout Constraints
            new_obj.layConstraints['scale'] = [1.0, 1.0]
        else:
            new_obj = None
        self.obj1816.graphObject_ = new_obj

        # Add node to the root: self.LHS
        self.LHS.addNode(self.obj1816)
        self.obj1816.postAction(self.LHS.CREATE)

        self.obj1817 = GenericGraphEdge(parent)
        self.obj1817.preAction(self.LHS.CREATE)
        self.obj1817.isGraphObjectVisual = True

        if (hasattr(self.obj1817, '_setHierarchicalLink')):
            self.obj1817._setHierarchicalLink(False)

        self.obj1817.GGLabel.setValue(4)
        self.obj1817.graphClass_ = graph_GenericGraphEdge
        if parent.genGraphics:
            new_obj = graph_GenericGraphEdge(205.0, 106.0, self.obj1817)
            new_obj.layConstraints = dict()  # Graphical Layout Constraints
        else:
            new_obj = None
        self.obj1817.graphObject_ = new_obj

        # Add node to the root: self.LHS
        self.LHS.addNode(self.obj1817)
        self.obj1817.postAction(self.LHS.CREATE)

        self.obj1816.out_connections_.append(self.obj1817)
        self.obj1817.in_connections_.append(self.obj1816)
        self.obj1816.graphObject_.pendingConnections.append(
            (self.obj1816.graphObject_.tag, self.obj1817.graphObject_.tag,
             [124.0, 110.0, 205.0, 106.0], 0, True))
        self.obj1817.out_connections_.append(self.obj1815)
        self.obj1815.in_connections_.append(self.obj1817)
        self.obj1817.graphObject_.pendingConnections.append(
            (self.obj1817.graphObject_.tag, self.obj1815.graphObject_.tag,
             [286.0, 102.0, 205.0, 106.0], 0, True))

        self.RHS = ASG_pns(parent)

        self.obj1819 = metarial(parent)
        self.obj1819.preAction(self.RHS.CREATE)
        self.obj1819.isGraphObjectVisual = True

        if (hasattr(self.obj1819, '_setHierarchicalLink')):
            self.obj1819._setHierarchicalLink(False)

        # MaxFlow
        self.obj1819.MaxFlow.setNone()

        # price
        self.obj1819.price.setValue(0)

        # Name
        self.obj1819.Name.setValue('')
        self.obj1819.Name.setNone()

        # ReqFlow
        self.obj1819.ReqFlow.setNone()

        self.obj1819.GGLabel.setValue(1)
        self.obj1819.graphClass_ = graph_metarial
        if parent.genGraphics:
            new_obj = graph_metarial(180.0, 40.0, self.obj1819)
            new_obj.layConstraints = dict()  # Graphical Layout Constraints
            new_obj.layConstraints['scale'] = [1.0, 1.0]
        else:
            new_obj = None
        self.obj1819.graphObject_ = new_obj
        self.obj18190 = AttrCalc()
        self.obj18190.Copy = ATOM3Boolean()
        self.obj18190.Copy.setValue(('Copy from LHS', 1))
        self.obj18190.Copy.config = 0
        self.obj18190.Specify = ATOM3Constraint()
        self.obj18190.Specify.setValue(
            ('AttrSpecify', (['Python', 'OCL'], 0),
             (['PREcondition', 'POSTcondition'], 1), ([
                 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT',
                 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE'
             ], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), None))
        self.obj1819.GGset2Any['MaxFlow'] = self.obj18190
        self.obj18191 = AttrCalc()
        self.obj18191.Copy = ATOM3Boolean()
        self.obj18191.Copy.setValue(('Copy from LHS', 1))
        self.obj18191.Copy.config = 0
        self.obj18191.Specify = ATOM3Constraint()
        self.obj18191.Specify.setValue(
            ('AttrSpecify', (['Python', 'OCL'], 0),
             (['PREcondition', 'POSTcondition'], 1), ([
                 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT',
                 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE'
             ], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), None))
        self.obj1819.GGset2Any['Name'] = self.obj18191
        self.obj18192 = AttrCalc()
        self.obj18192.Copy = ATOM3Boolean()
        self.obj18192.Copy.setValue(('Copy from LHS', 1))
        self.obj18192.Copy.config = 0
        self.obj18192.Specify = ATOM3Constraint()
        self.obj18192.Specify.setValue(
            ('AttrSpecify', (['Python', 'OCL'], 0),
             (['PREcondition', 'POSTcondition'], 1), ([
                 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT',
                 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE'
             ], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), None))
        self.obj1819.GGset2Any['ReqFlow'] = self.obj18192

        # Add node to the root: self.RHS
        self.RHS.addNode(self.obj1819)
        self.obj1819.postAction(self.RHS.CREATE)
Пример #16
0
    def __init__(self, parent):
        GGrule.__init__(self, 11)
        self.TimeDelay = ATOM3Integer(2)
        self.exactMatch = 1
        self.LHS = ASG_pns(parent)
        self.LHS.merge(ASG_omacs(parent))

        self.obj1638 = Goal(parent)
        self.obj1638.preAction(self.LHS.CREATE)
        self.obj1638.isGraphObjectVisual = True

        if (hasattr(self.obj1638, '_setHierarchicalLink')):
            self.obj1638._setHierarchicalLink(False)

        # name
        self.obj1638.name.setValue('')
        self.obj1638.name.setNone()

        self.obj1638.GGLabel.setValue(1)
        self.obj1638.graphClass_ = graph_Goal
        if parent.genGraphics:
            new_obj = graph_Goal(80.0, 80.0, self.obj1638)
            new_obj.layConstraints = dict()  # Graphical Layout Constraints
            new_obj.layConstraints['scale'] = [1.0, 1.0]
        else:
            new_obj = None
        self.obj1638.graphObject_ = new_obj

        # Add node to the root: self.LHS
        self.LHS.addNode(self.obj1638)
        self.obj1638.postAction(self.LHS.CREATE)

        self.RHS = ASG_pns(parent)
        self.RHS.merge(ASG_omacs(parent))
        self.RHS.merge(ASG_GenericGraph(parent))

        self.obj1642 = metarial(parent)
        self.obj1642.preAction(self.RHS.CREATE)
        self.obj1642.isGraphObjectVisual = True

        if (hasattr(self.obj1642, '_setHierarchicalLink')):
            self.obj1642._setHierarchicalLink(False)

        # MaxFlow
        self.obj1642.MaxFlow.setValue(999999)

        # price
        self.obj1642.price.setValue(0)

        # Name
        self.obj1642.Name.setValue('')
        self.obj1642.Name.setNone()

        # ReqFlow
        self.obj1642.ReqFlow.setValue(0)

        self.obj1642.GGLabel.setValue(2)
        self.obj1642.graphClass_ = graph_metarial
        if parent.genGraphics:
            new_obj = graph_metarial(300.0, 60.0, self.obj1642)
            new_obj.layConstraints = dict()  # Graphical Layout Constraints
            new_obj.layConstraints['scale'] = [1.0, 1.0]
        else:
            new_obj = None
        self.obj1642.graphObject_ = new_obj
        self.obj16420 = AttrCalc()
        self.obj16420.Copy = ATOM3Boolean()
        self.obj16420.Copy.setValue(('Copy from LHS', 1))
        self.obj16420.Copy.config = 0
        self.obj16420.Specify = ATOM3Constraint()
        self.obj16420.Specify.setValue(
            ('AttrSpecify', (['Python', 'OCL'], 0),
             (['PREcondition', 'POSTcondition'], 1), ([
                 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT',
                 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE'
             ], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), None))
        self.obj1642.GGset2Any['MaxFlow'] = self.obj16420
        self.obj16421 = AttrCalc()
        self.obj16421.Copy = ATOM3Boolean()
        self.obj16421.Copy.setValue(('Copy from LHS', 0))
        self.obj16421.Copy.config = 0
        self.obj16421.Specify = ATOM3Constraint()
        self.obj16421.Specify.setValue(
            ('AttrSpecify', (['Python', 'OCL'], 0),
             (['PREcondition', 'POSTcondition'], 1), ([
                 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT',
                 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE'
             ], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]),
             'return self.getMatched(graphID, self.LHS.nodeWithLabel(1)).name.getValue()\n'
             ))
        self.obj1642.GGset2Any['Name'] = self.obj16421
        self.obj16422 = AttrCalc()
        self.obj16422.Copy = ATOM3Boolean()
        self.obj16422.Copy.setValue(('Copy from LHS', 1))
        self.obj16422.Copy.config = 0
        self.obj16422.Specify = ATOM3Constraint()
        self.obj16422.Specify.setValue(
            ('AttrSpecify', (['Python', 'OCL'], 0),
             (['PREcondition', 'POSTcondition'], 1), ([
                 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT',
                 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE'
             ], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), None))
        self.obj1642.GGset2Any['ReqFlow'] = self.obj16422

        # Add node to the root: self.RHS
        self.RHS.addNode(self.obj1642)
        self.obj1642.postAction(self.RHS.CREATE)

        self.obj1643 = Goal(parent)
        self.obj1643.preAction(self.RHS.CREATE)
        self.obj1643.isGraphObjectVisual = True

        if (hasattr(self.obj1643, '_setHierarchicalLink')):
            self.obj1643._setHierarchicalLink(False)

        # name
        self.obj1643.name.setValue('')
        self.obj1643.name.setNone()

        self.obj1643.GGLabel.setValue(1)
        self.obj1643.graphClass_ = graph_Goal
        if parent.genGraphics:
            new_obj = graph_Goal(80.0, 80.0, self.obj1643)
            new_obj.layConstraints = dict()  # Graphical Layout Constraints
            new_obj.layConstraints['scale'] = [1.0, 1.0]
        else:
            new_obj = None
        self.obj1643.graphObject_ = new_obj
        self.obj16430 = AttrCalc()
        self.obj16430.Copy = ATOM3Boolean()
        self.obj16430.Copy.setValue(('Copy from LHS', 1))
        self.obj16430.Copy.config = 0
        self.obj16430.Specify = ATOM3Constraint()
        self.obj16430.Specify.setValue(
            ('AttrSpecify', (['Python', 'OCL'], 0),
             (['PREcondition', 'POSTcondition'], 1), ([
                 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT',
                 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE'
             ], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), None))
        self.obj1643.GGset2Any['name'] = self.obj16430

        # Add node to the root: self.RHS
        self.RHS.addNode(self.obj1643)
        self.obj1643.postAction(self.RHS.CREATE)

        self.obj1644 = GenericGraphEdge(parent)
        self.obj1644.preAction(self.RHS.CREATE)
        self.obj1644.isGraphObjectVisual = True

        if (hasattr(self.obj1644, '_setHierarchicalLink')):
            self.obj1644._setHierarchicalLink(False)

        self.obj1644.GGLabel.setValue(4)
        self.obj1644.graphClass_ = graph_GenericGraphEdge
        if parent.genGraphics:
            new_obj = graph_GenericGraphEdge(209.5, 91.5, self.obj1644)
            new_obj.layConstraints = dict()  # Graphical Layout Constraints
        else:
            new_obj = None
        self.obj1644.graphObject_ = new_obj

        # Add node to the root: self.RHS
        self.RHS.addNode(self.obj1644)
        self.obj1644.postAction(self.RHS.CREATE)

        self.obj1643.out_connections_.append(self.obj1644)
        self.obj1644.in_connections_.append(self.obj1643)
        self.obj1643.graphObject_.pendingConnections.append(
            (self.obj1643.graphObject_.tag, self.obj1644.graphObject_.tag,
             [113.0, 81.0, 209.5, 91.5], 0, True))
        self.obj1644.out_connections_.append(self.obj1642)
        self.obj1642.in_connections_.append(self.obj1644)
        self.obj1644.graphObject_.pendingConnections.append(
            (self.obj1644.graphObject_.tag, self.obj1642.graphObject_.tag,
             [306.0, 102.0, 209.5, 91.5], 0, True))
Пример #17
0
def goal_from_object(object, manip):
  pose = object.GetTransform()
  robot = manip.GetRobot()
  env = robot.GetEnv()

  #generate TSRs for object
  if not 'bowl' in object.GetName():
    target_tsrs = GetTSRListForObject(object, manip)

  #turn TSR into poses
  num_poses_desired = 30
  max_num_poses_sample = 500

  target_poses = []
  target_iks = []
  num_sampled = 0
  while len(target_poses) < num_poses_desired and num_sampled < max_num_poses_sample:
    print 'name: ' + object.GetName() + ' currently has ' + str(len(target_poses)) + ' goal poses'
    if not 'bowl' in object.GetName():
      num_sample_this = int(math.ceil(num_poses_desired/len(target_tsrs)))
      num_sampled += num_sample_this
      target_poses_idenframe = SampleTSRList(target_tsrs, num_sample_this)
      target_poses_tocheck = [np.dot(object.GetTransform(), pose) for pose in target_poses_idenframe]
    else:
      num_sample_this = num_poses_desired
      num_sampled += num_sample_this
      target_poses_tocheck = get_bowl_poses(object, num_samples_pose=num_sample_this, ee_offset=0.15)
    for pose in target_poses_tocheck:
      #check if solution exists
#      ik_sols = manip.FindIKSolutions(pose, openravepy.IkFilterOptions.CheckEnvCollisions)
#      if len(ik_sols) > 0:

      
      #sample some random joint vals
      
#      lower, upper = robot.GetDOFLimits()
#      dof_vals_before = robot.GetActiveDOFValues()
#      dof_vals = [ np.random.uniform(lower[i], upper[i]) for i in range(6)]
#      robot.SetActiveDOFValues(dof_vals)
#      pose = manip.GetEndEffectorTransform()
#      robot.SetActiveDOFValues(dof_vals_before)

      ik_sol = manip.FindIKSolution(pose, openravepy.IkFilterOptions.CheckEnvCollisions)
      if ik_sol is not None:
        if ADD_MORE_IK_SOLS:
          #get bigger list of ik solutions
          ik_sols = manip.FindIKSolutions(pose, openravepy.IkFilterOptions.CheckEnvCollisions)
          if ik_sols is None:
            ik_sols = list()
          else:
            ik_sols = list(ik_sols)
          #add the solution we found before
          ik_sols.append(ik_sol)
        else:
          #if we don't want to add more, just use the one we found
          ik_sols = [ik_sol]
        #check env col
        target_poses.append(pose)
        target_iks.append(ik_sols)
#        with robot:
#          manip.SetDOFValues(ik_sol)
#          if not env.CheckCollision(robot):
#            target_poses.append(pose)
        if len(target_poses) >= num_poses_desired:
          break

  return Goal(pose, target_poses, target_iks)
Пример #18
0
   def __init__(self, parent):
      GGrule.__init__(self, 17)
      self.TimeDelay = ATOM3Integer(2)
      self.exactMatch = 1
      self.LHS = ASG_pns(parent)
      self.LHS.merge(ASG_omacs(parent))

      self.obj1696=CapableOf(parent)
      self.obj1696.preAction( self.LHS.CREATE )
      self.obj1696.isGraphObjectVisual = True

      if(hasattr(self.obj1696, '_setHierarchicalLink')):
        self.obj1696._setHierarchicalLink(False)

      # rate
      self.obj1696.rate.setNone()

      self.obj1696.GGLabel.setValue(4)
      self.obj1696.graphClass_= graph_CapableOf
      if parent.genGraphics:
         new_obj = graph_CapableOf(250.75,110.75,self.obj1696)
         new_obj.layConstraints = dict() # Graphical Layout Constraints 
      else: new_obj = None
      self.obj1696.graphObject_ = new_obj

      # Add node to the root: self.LHS
      self.LHS.addNode(self.obj1696)
      self.obj1696.postAction( self.LHS.CREATE )

      self.obj1697=Goal(parent)
      self.obj1697.preAction( self.LHS.CREATE )
      self.obj1697.isGraphObjectVisual = True

      if(hasattr(self.obj1697, '_setHierarchicalLink')):
        self.obj1697._setHierarchicalLink(False)

      # name
      self.obj1697.name.setValue('')
      self.obj1697.name.setNone()

      self.obj1697.GGLabel.setValue(3)
      self.obj1697.graphClass_= graph_Goal
      if parent.genGraphics:
         new_obj = graph_Goal(100.0,240.0,self.obj1697)
         new_obj.layConstraints = dict() # Graphical Layout Constraints 
         new_obj.layConstraints['scale'] = [1.0, 1.0]
      else: new_obj = None
      self.obj1697.graphObject_ = new_obj

      # Add node to the root: self.LHS
      self.LHS.addNode(self.obj1697)
      self.obj1697.postAction( self.LHS.CREATE )

      self.obj1698=Agent(parent)
      self.obj1698.preAction( self.LHS.CREATE )
      self.obj1698.isGraphObjectVisual = True

      if(hasattr(self.obj1698, '_setHierarchicalLink')):
        self.obj1698._setHierarchicalLink(False)

      # price
      self.obj1698.price.setNone()

      # name
      self.obj1698.name.setValue('')
      self.obj1698.name.setNone()

      self.obj1698.GGLabel.setValue(1)
      self.obj1698.graphClass_= graph_Agent
      if parent.genGraphics:
         new_obj = graph_Agent(80.0,40.0,self.obj1698)
         new_obj.layConstraints = dict() # Graphical Layout Constraints 
         new_obj.layConstraints['scale'] = [1.0, 1.0]
      else: new_obj = None
      self.obj1698.graphObject_ = new_obj

      # Add node to the root: self.LHS
      self.LHS.addNode(self.obj1698)
      self.obj1698.postAction( self.LHS.CREATE )

      self.obj1699=Role(parent)
      self.obj1699.preAction( self.LHS.CREATE )
      self.obj1699.isGraphObjectVisual = True

      if(hasattr(self.obj1699, '_setHierarchicalLink')):
        self.obj1699._setHierarchicalLink(False)

      # name
      self.obj1699.name.setValue('')
      self.obj1699.name.setNone()

      self.obj1699.GGLabel.setValue(2)
      self.obj1699.graphClass_= graph_Role
      if parent.genGraphics:
         new_obj = graph_Role(280.0,140.0,self.obj1699)
         new_obj.layConstraints = dict() # Graphical Layout Constraints 
         new_obj.layConstraints['scale'] = [1.0, 1.0]
      else: new_obj = None
      self.obj1699.graphObject_ = new_obj

      # Add node to the root: self.LHS
      self.LHS.addNode(self.obj1699)
      self.obj1699.postAction( self.LHS.CREATE )

      self.obj1700=achieve(parent)
      self.obj1700.preAction( self.LHS.CREATE )
      self.obj1700.isGraphObjectVisual = True

      if(hasattr(self.obj1700, '_setHierarchicalLink')):
        self.obj1700._setHierarchicalLink(False)

      # rate
      self.obj1700.rate.setNone()

      self.obj1700.GGLabel.setValue(5)
      self.obj1700.graphClass_= graph_achieve
      if parent.genGraphics:
         new_obj = graph_achieve(258.5,259.0,self.obj1700)
         new_obj.layConstraints = dict() # Graphical Layout Constraints 
         new_obj.layConstraints['scale'] = [1.0, 1.0]
      else: new_obj = None
      self.obj1700.graphObject_ = new_obj

      # Add node to the root: self.LHS
      self.LHS.addNode(self.obj1700)
      self.obj1700.postAction( self.LHS.CREATE )

      self.obj1696.out_connections_.append(self.obj1699)
      self.obj1699.in_connections_.append(self.obj1696)
      self.obj1696.graphObject_.pendingConnections.append((self.obj1696.graphObject_.tag, self.obj1699.graphObject_.tag, [304.0, 141.0, 300.5, 120.5, 250.75, 110.75], 2, True))
      self.obj1698.out_connections_.append(self.obj1696)
      self.obj1696.in_connections_.append(self.obj1698)
      self.obj1698.graphObject_.pendingConnections.append((self.obj1698.graphObject_.tag, self.obj1696.graphObject_.tag, [105.0, 102.0, 201.0, 101.0, 250.75, 110.75], 2, True))
      self.obj1699.out_connections_.append(self.obj1700)
      self.obj1700.in_connections_.append(self.obj1699)
      self.obj1699.graphObject_.pendingConnections.append((self.obj1699.graphObject_.tag, self.obj1700.graphObject_.tag, [304.0, 186.0, 303.5, 233.0, 258.5, 259.0], 2, True))
      self.obj1700.out_connections_.append(self.obj1697)
      self.obj1697.in_connections_.append(self.obj1700)
      self.obj1700.graphObject_.pendingConnections.append((self.obj1700.graphObject_.tag, self.obj1697.graphObject_.tag, [124.0, 290.0, 213.5, 285.0, 258.5, 259.0], 2, True))

      self.RHS = ASG_pns(parent)
      self.RHS.merge(ASG_omacs(parent))
      self.RHS.merge(ASG_GenericGraph(parent))

      self.obj1704=metarial(parent)
      self.obj1704.preAction( self.RHS.CREATE )
      self.obj1704.isGraphObjectVisual = True

      if(hasattr(self.obj1704, '_setHierarchicalLink')):
        self.obj1704._setHierarchicalLink(False)

      # MaxFlow
      self.obj1704.MaxFlow.setValue(999999)

      # price
      self.obj1704.price.setValue(0)

      # Name
      self.obj1704.Name.setValue('')
      self.obj1704.Name.setNone()

      # ReqFlow
      self.obj1704.ReqFlow.setValue(0)

      self.obj1704.GGLabel.setValue(8)
      self.obj1704.graphClass_= graph_metarial
      if parent.genGraphics:
         new_obj = graph_metarial(400.0,80.0,self.obj1704)
         new_obj.layConstraints = dict() # Graphical Layout Constraints 
         new_obj.layConstraints['scale'] = [1.0, 1.0]
      else: new_obj = None
      self.obj1704.graphObject_ = new_obj
      self.obj17040= AttrCalc()
      self.obj17040.Copy=ATOM3Boolean()
      self.obj17040.Copy.setValue(('Copy from LHS', 1))
      self.obj17040.Copy.config = 0
      self.obj17040.Specify=ATOM3Constraint()
      self.obj17040.Specify.setValue(('AttrSpecify', (['Python', 'OCL'], 0), (['PREcondition', 'POSTcondition'], 1), (['EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT', 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE'], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), None))
      self.obj1704.GGset2Any['MaxFlow']= self.obj17040
      self.obj17041= AttrCalc()
      self.obj17041.Copy=ATOM3Boolean()
      self.obj17041.Copy.setValue(('Copy from LHS', 0))
      self.obj17041.Copy.config = 0
      self.obj17041.Specify=ATOM3Constraint()
      self.obj17041.Specify.setValue(('AttrSpecify', (['Python', 'OCL'], 0), (['PREcondition', 'POSTcondition'], 1), (['EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT', 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE'], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), 'return self.getMatched(graphID, self.LHS.nodeWithLabel(1)).name.getValue()+\' \'+ self.getMatched(graphID, self.LHS.nodeWithLabel(2)).name.getValue()+\' \'+ self.getMatched(graphID, self.LHS.nodeWithLabel(3)).name.getValue()\n\n'))
      self.obj1704.GGset2Any['Name']= self.obj17041
      self.obj17042= AttrCalc()
      self.obj17042.Copy=ATOM3Boolean()
      self.obj17042.Copy.setValue(('Copy from LHS', 1))
      self.obj17042.Copy.config = 0
      self.obj17042.Specify=ATOM3Constraint()
      self.obj17042.Specify.setValue(('AttrSpecify', (['Python', 'OCL'], 0), (['PREcondition', 'POSTcondition'], 1), (['EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT', 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE'], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), None))
      self.obj1704.GGset2Any['ReqFlow']= self.obj17042

      # Add node to the root: self.RHS
      self.RHS.addNode(self.obj1704)
      self.obj1704.postAction( self.RHS.CREATE )

      self.obj1705=operatingUnit(parent)
      self.obj1705.preAction( self.RHS.CREATE )
      self.obj1705.isGraphObjectVisual = True

      if(hasattr(self.obj1705, '_setHierarchicalLink')):
        self.obj1705._setHierarchicalLink(False)

      # OperCostProp
      self.obj1705.OperCostProp.setValue(0.0)

      # name
      self.obj1705.name.setValue('')
      self.obj1705.name.setNone()

      # OperCostFix
      self.obj1705.OperCostFix.setValue(0.0)

      self.obj1705.GGLabel.setValue(7)
      self.obj1705.graphClass_= graph_operatingUnit
      if parent.genGraphics:
         new_obj = graph_operatingUnit(400.0,240.0,self.obj1705)
         new_obj.layConstraints = dict() # Graphical Layout Constraints 
         new_obj.layConstraints['scale'] = [1.0, 1.0]
      else: new_obj = None
      self.obj1705.graphObject_ = new_obj
      self.obj17050= AttrCalc()
      self.obj17050.Copy=ATOM3Boolean()
      self.obj17050.Copy.setValue(('Copy from LHS', 0))
      self.obj17050.Copy.config = 0
      self.obj17050.Specify=ATOM3Constraint()
      self.obj17050.Specify.setValue(('AttrSpecify', (['Python', 'OCL'], 0), (['PREcondition', 'POSTcondition'], 1), (['EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT', 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE'], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), 'return self.getMatched(graphID, self.LHS.nodeWithLabel(5)).rate.getValue()\n'))
      self.obj1705.GGset2Any['OperCostProp']= self.obj17050
      self.obj17051= AttrCalc()
      self.obj17051.Copy=ATOM3Boolean()
      self.obj17051.Copy.setValue(('Copy from LHS', 0))
      self.obj17051.Copy.config = 0
      self.obj17051.Specify=ATOM3Constraint()
      self.obj17051.Specify.setValue(('AttrSpecify', (['Python', 'OCL'], 0), (['PREcondition', 'POSTcondition'], 1), (['EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT', 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE'], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), 'return self.getMatched(graphID, self.LHS.nodeWithLabel(1)).name.getValue()+\' \'+ self.getMatched(graphID, self.LHS.nodeWithLabel(2)).name.getValue()+\' \'+ self.getMatched(graphID, self.LHS.nodeWithLabel(3)).name.getValue()\n\n\n\n\n\n\n'))
      self.obj1705.GGset2Any['name']= self.obj17051
      self.obj17052= AttrCalc()
      self.obj17052.Copy=ATOM3Boolean()
      self.obj17052.Copy.setValue(('Copy from LHS', 0))
      self.obj17052.Copy.config = 0
      self.obj17052.Specify=ATOM3Constraint()
      self.obj17052.Specify.setValue(('AttrSpecify', (['Python', 'OCL'], 0), (['PREcondition', 'POSTcondition'], 1), (['EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT', 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE'], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), 'return 2.0\n'))
      self.obj1705.GGset2Any['OperCostFix']= self.obj17052

      # Add node to the root: self.RHS
      self.RHS.addNode(self.obj1705)
      self.obj1705.postAction( self.RHS.CREATE )

      self.obj1706=fromMaterial(parent)
      self.obj1706.preAction( self.RHS.CREATE )
      self.obj1706.isGraphObjectVisual = True

      if(hasattr(self.obj1706, '_setHierarchicalLink')):
        self.obj1706._setHierarchicalLink(False)

      # rate
      self.obj1706.rate.setValue(1.0)

      self.obj1706.GGLabel.setValue(9)
      self.obj1706.graphClass_= graph_fromMaterial
      if parent.genGraphics:
         new_obj = graph_fromMaterial(422.0,190.0,self.obj1706)
         new_obj.layConstraints = dict() # Graphical Layout Constraints 
         new_obj.layConstraints['scale'] = [1.0, 1.0]
      else: new_obj = None
      self.obj1706.graphObject_ = new_obj
      self.obj17060= AttrCalc()
      self.obj17060.Copy=ATOM3Boolean()
      self.obj17060.Copy.setValue(('Copy from LHS', 0))
      self.obj17060.Copy.config = 0
      self.obj17060.Specify=ATOM3Constraint()
      self.obj17060.Specify.setValue(('AttrSpecify', (['Python', 'OCL'], 0), (['PREcondition', 'POSTcondition'], 1), (['EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT', 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE'], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), None))
      self.obj1706.GGset2Any['rate']= self.obj17060

      # Add node to the root: self.RHS
      self.RHS.addNode(self.obj1706)
      self.obj1706.postAction( self.RHS.CREATE )

      self.obj1707=CapableOf(parent)
      self.obj1707.preAction( self.RHS.CREATE )
      self.obj1707.isGraphObjectVisual = True

      if(hasattr(self.obj1707, '_setHierarchicalLink')):
        self.obj1707._setHierarchicalLink(False)

      # rate
      self.obj1707.rate.setNone()

      self.obj1707.GGLabel.setValue(4)
      self.obj1707.graphClass_= graph_CapableOf
      if parent.genGraphics:
         new_obj = graph_CapableOf(250.75,110.75,self.obj1707)
         new_obj.layConstraints = dict() # Graphical Layout Constraints 
      else: new_obj = None
      self.obj1707.graphObject_ = new_obj
      self.obj17070= AttrCalc()
      self.obj17070.Copy=ATOM3Boolean()
      self.obj17070.Copy.setValue(('Copy from LHS', 1))
      self.obj17070.Copy.config = 0
      self.obj17070.Specify=ATOM3Constraint()
      self.obj17070.Specify.setValue(('AttrSpecify', (['Python', 'OCL'], 0), (['PREcondition', 'POSTcondition'], 1), (['EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT', 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE'], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), None))
      self.obj1707.GGset2Any['rate']= self.obj17070

      # Add node to the root: self.RHS
      self.RHS.addNode(self.obj1707)
      self.obj1707.postAction( self.RHS.CREATE )

      self.obj1708=Goal(parent)
      self.obj1708.preAction( self.RHS.CREATE )
      self.obj1708.isGraphObjectVisual = True

      if(hasattr(self.obj1708, '_setHierarchicalLink')):
        self.obj1708._setHierarchicalLink(False)

      # name
      self.obj1708.name.setValue('')
      self.obj1708.name.setNone()

      self.obj1708.GGLabel.setValue(3)
      self.obj1708.graphClass_= graph_Goal
      if parent.genGraphics:
         new_obj = graph_Goal(100.0,240.0,self.obj1708)
         new_obj.layConstraints = dict() # Graphical Layout Constraints 
         new_obj.layConstraints['scale'] = [1.0, 1.0]
      else: new_obj = None
      self.obj1708.graphObject_ = new_obj
      self.obj17080= AttrCalc()
      self.obj17080.Copy=ATOM3Boolean()
      self.obj17080.Copy.setValue(('Copy from LHS', 1))
      self.obj17080.Copy.config = 0
      self.obj17080.Specify=ATOM3Constraint()
      self.obj17080.Specify.setValue(('AttrSpecify', (['Python', 'OCL'], 0), (['PREcondition', 'POSTcondition'], 1), (['EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT', 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE'], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), None))
      self.obj1708.GGset2Any['name']= self.obj17080

      # Add node to the root: self.RHS
      self.RHS.addNode(self.obj1708)
      self.obj1708.postAction( self.RHS.CREATE )

      self.obj1709=Agent(parent)
      self.obj1709.preAction( self.RHS.CREATE )
      self.obj1709.isGraphObjectVisual = True

      if(hasattr(self.obj1709, '_setHierarchicalLink')):
        self.obj1709._setHierarchicalLink(False)

      # price
      self.obj1709.price.setNone()

      # name
      self.obj1709.name.setValue('')
      self.obj1709.name.setNone()

      self.obj1709.GGLabel.setValue(1)
      self.obj1709.graphClass_= graph_Agent
      if parent.genGraphics:
         new_obj = graph_Agent(80.0,40.0,self.obj1709)
         new_obj.layConstraints = dict() # Graphical Layout Constraints 
         new_obj.layConstraints['scale'] = [1.0, 1.0]
      else: new_obj = None
      self.obj1709.graphObject_ = new_obj
      self.obj17090= AttrCalc()
      self.obj17090.Copy=ATOM3Boolean()
      self.obj17090.Copy.setValue(('Copy from LHS', 1))
      self.obj17090.Copy.config = 0
      self.obj17090.Specify=ATOM3Constraint()
      self.obj17090.Specify.setValue(('AttrSpecify', (['Python', 'OCL'], 0), (['PREcondition', 'POSTcondition'], 1), (['EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT', 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE'], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), None))
      self.obj1709.GGset2Any['price']= self.obj17090
      self.obj17091= AttrCalc()
      self.obj17091.Copy=ATOM3Boolean()
      self.obj17091.Copy.setValue(('Copy from LHS', 1))
      self.obj17091.Copy.config = 0
      self.obj17091.Specify=ATOM3Constraint()
      self.obj17091.Specify.setValue(('AttrSpecify', (['Python', 'OCL'], 0), (['PREcondition', 'POSTcondition'], 1), (['EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT', 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE'], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), None))
      self.obj1709.GGset2Any['name']= self.obj17091

      # Add node to the root: self.RHS
      self.RHS.addNode(self.obj1709)
      self.obj1709.postAction( self.RHS.CREATE )

      self.obj1710=Role(parent)
      self.obj1710.preAction( self.RHS.CREATE )
      self.obj1710.isGraphObjectVisual = True

      if(hasattr(self.obj1710, '_setHierarchicalLink')):
        self.obj1710._setHierarchicalLink(False)

      # name
      self.obj1710.name.setValue('')
      self.obj1710.name.setNone()

      self.obj1710.GGLabel.setValue(2)
      self.obj1710.graphClass_= graph_Role
      if parent.genGraphics:
         new_obj = graph_Role(280.0,140.0,self.obj1710)
         new_obj.layConstraints = dict() # Graphical Layout Constraints 
         new_obj.layConstraints['scale'] = [1.0, 1.0]
      else: new_obj = None
      self.obj1710.graphObject_ = new_obj
      self.obj17100= AttrCalc()
      self.obj17100.Copy=ATOM3Boolean()
      self.obj17100.Copy.setValue(('Copy from LHS', 1))
      self.obj17100.Copy.config = 0
      self.obj17100.Specify=ATOM3Constraint()
      self.obj17100.Specify.setValue(('AttrSpecify', (['Python', 'OCL'], 0), (['PREcondition', 'POSTcondition'], 1), (['EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT', 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE'], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), None))
      self.obj1710.GGset2Any['name']= self.obj17100

      # Add node to the root: self.RHS
      self.RHS.addNode(self.obj1710)
      self.obj1710.postAction( self.RHS.CREATE )

      self.obj1711=achieve(parent)
      self.obj1711.preAction( self.RHS.CREATE )
      self.obj1711.isGraphObjectVisual = True

      if(hasattr(self.obj1711, '_setHierarchicalLink')):
        self.obj1711._setHierarchicalLink(False)

      # rate
      self.obj1711.rate.setNone()

      self.obj1711.GGLabel.setValue(5)
      self.obj1711.graphClass_= graph_achieve
      if parent.genGraphics:
         new_obj = graph_achieve(258.5,259.0,self.obj1711)
         new_obj.layConstraints = dict() # Graphical Layout Constraints 
         new_obj.layConstraints['scale'] = [1.0, 1.0]
      else: new_obj = None
      self.obj1711.graphObject_ = new_obj
      self.obj17110= AttrCalc()
      self.obj17110.Copy=ATOM3Boolean()
      self.obj17110.Copy.setValue(('Copy from LHS', 1))
      self.obj17110.Copy.config = 0
      self.obj17110.Specify=ATOM3Constraint()
      self.obj17110.Specify.setValue(('AttrSpecify', (['Python', 'OCL'], 0), (['PREcondition', 'POSTcondition'], 1), (['EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT', 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE'], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), None))
      self.obj1711.GGset2Any['rate']= self.obj17110

      # Add node to the root: self.RHS
      self.RHS.addNode(self.obj1711)
      self.obj1711.postAction( self.RHS.CREATE )

      self.obj1712=GenericGraphEdge(parent)
      self.obj1712.preAction( self.RHS.CREATE )
      self.obj1712.isGraphObjectVisual = True

      if(hasattr(self.obj1712, '_setHierarchicalLink')):
        self.obj1712._setHierarchicalLink(False)

      self.obj1712.GGLabel.setValue(10)
      self.obj1712.graphClass_= graph_GenericGraphEdge
      if parent.genGraphics:
         new_obj = graph_GenericGraphEdge(358.5,131.0,self.obj1712)
         new_obj.layConstraints = dict() # Graphical Layout Constraints 
      else: new_obj = None
      self.obj1712.graphObject_ = new_obj

      # Add node to the root: self.RHS
      self.RHS.addNode(self.obj1712)
      self.obj1712.postAction( self.RHS.CREATE )

      self.obj1704.out_connections_.append(self.obj1706)
      self.obj1706.in_connections_.append(self.obj1704)
      self.obj1704.graphObject_.pendingConnections.append((self.obj1704.graphObject_.tag, self.obj1706.graphObject_.tag, [424.0, 129.0, 422.0, 190.0], 0, True))
      self.obj1706.out_connections_.append(self.obj1705)
      self.obj1705.in_connections_.append(self.obj1706)
      self.obj1706.graphObject_.pendingConnections.append((self.obj1706.graphObject_.tag, self.obj1705.graphObject_.tag, [420.0, 251.0, 422.0, 190.0], 0, True))
      self.obj1707.out_connections_.append(self.obj1710)
      self.obj1710.in_connections_.append(self.obj1707)
      self.obj1707.graphObject_.pendingConnections.append((self.obj1707.graphObject_.tag, self.obj1710.graphObject_.tag, [311.0, 140.0, 250.75, 110.75], 2, 0))
      self.obj1709.out_connections_.append(self.obj1707)
      self.obj1707.in_connections_.append(self.obj1709)
      self.obj1709.graphObject_.pendingConnections.append((self.obj1709.graphObject_.tag, self.obj1707.graphObject_.tag, [117.0, 102.0, 250.75, 110.75], 2, 0))
      self.obj1710.out_connections_.append(self.obj1711)
      self.obj1711.in_connections_.append(self.obj1710)
      self.obj1710.graphObject_.pendingConnections.append((self.obj1710.graphObject_.tag, self.obj1711.graphObject_.tag, [311.0, 185.0, 258.5, 259.0], 2, 0))
      self.obj1710.out_connections_.append(self.obj1712)
      self.obj1712.in_connections_.append(self.obj1710)
      self.obj1710.graphObject_.pendingConnections.append((self.obj1710.graphObject_.tag, self.obj1712.graphObject_.tag, [311.0, 140.0, 358.5, 131.0], 0, True))
      self.obj1711.out_connections_.append(self.obj1708)
      self.obj1708.in_connections_.append(self.obj1711)
      self.obj1711.graphObject_.pendingConnections.append((self.obj1711.graphObject_.tag, self.obj1708.graphObject_.tag, [134.0, 290.0, 258.5, 259.0], 2, 0))
      self.obj1712.out_connections_.append(self.obj1704)
      self.obj1704.in_connections_.append(self.obj1712)
      self.obj1712.graphObject_.pendingConnections.append((self.obj1712.graphObject_.tag, self.obj1704.graphObject_.tag, [406.0, 122.0, 358.5, 131.0], 0, True))
Пример #19
0
	def add_goal(self, x, y, width, height, player_id):
		self.goals.append(Goal(x, y, width, height, self.players[player_id]))
    def loadLevel(self, levelFile):
        f = open("Resources/levels/" + levelFile, 'r')
        lines = f.readlines()
        f.close()
        """
        print lines
        print "________________________"
        
        for line in lines:
            print line
        print "________________________"
        """
        newlines = []
        for line in lines:
            newline = ""
            for c in line:
                if c != '\n':
                    newline += c
            newlines += [newline]

        lines = newlines

        for line in lines:
            print line
        print "________________________"

        for y, line in enumerate(lines):
            for x, c in enumerate(line):
                if c == '#':
                    self.walls += [
                        Wall("wall.png", [
                            x * self.tileSize + self.tileSize / 2,
                            y * self.tileSize + self.tileSize / 2
                        ], self.tileSize)
                    ]
                if c == "@":
                    self.player = Player([
                        x * self.tileSize + self.tileSize / 2,
                        y * self.tileSize + self.tileSize / 2
                    ], self.tileSize)

                if c == ".":
                    self.enemies += [
                        Enemy([
                            x * self.tileSize + self.tileSize / 2,
                            y * self.tileSize + self.tileSize / 2
                        ], self.tileSize)
                    ]

                if c == "$":
                    self.goal = Goal([
                        x * self.tileSize + self.tileSize / 2,
                        y * self.tileSize + self.tileSize / 2
                    ], self.tileSize)

                if c in "x":
                    self.enemies += [
                        Enemy(1, [
                            x * self.tileSize + self.tileSize / 2,
                            y * self.tileSize + self.tileSize / 2
                        ], self.tileSize)
                    ]

                if c in "y":
                    self.enemies += [
                        ShootingEnemy(1, [
                            x * self.tileSize + self.tileSize / 2,
                            y * self.tileSize + self.tileSize / 2
                        ], self.tileSize)
                    ]
Пример #21
0
playerimage=pygame.transform.scale(playerimage,(30,30))
os.environ['SDL_VIDEO_CENTERED'] = '1'  #centers the application window in the middle of the screen on startup
pygame.init()

#initialize the screen to size 800 x 600
gameDisplay = pygame.display.set_mode((1000, 1000))

#creates the Player character in the location 20, 20
player = Player.Player(30, 30,playerimage)

#Defines the starting positions of the first two Particles for level 1 of the game
particle1 = Particle.Particle(100, 100, False, None,redParticle,False)
particle2 = Particle.Particle(100, 200, True, particle1,blueParticle,False) #Particle 2 is entangled to Particle one

#Defines the position for the first goal for level 1 of the game
goal = Goal.Goal(400, 400)
door=Door.Door(760,300,20,100)

#NOTE: Negative numbers in wall declarations ruin collision detection
leftWall = Wall.Wall(0, 0, 20, 600)
rightWall = Wall.Wall(780, 0, 20, 600)
topWall = Wall.Wall(0, 0, 800, 20)
bottomWall = Wall.Wall(0, 580, 800, 20)
walls=[topWall,bottomWall,rightWall,leftWall]



#Defines the objects that the Player character cannot pass through

entities = [player,particle1, particle2, leftWall, rightWall, topWall, bottomWall]
particles=[particle1,particle2]
Пример #22
0
    def __init__(self, parent):
        GGrule.__init__(self, 19)
        self.TimeDelay = ATOM3Integer(2)
        self.exactMatch = 1
        self.LHS = ASG_pns(parent)
        self.LHS.merge(ASG_omacs(parent))
        self.LHS.merge(ASG_GenericGraph(parent))

        self.obj1719 = metarial(parent)
        self.obj1719.preAction(self.LHS.CREATE)
        self.obj1719.isGraphObjectVisual = True

        if (hasattr(self.obj1719, '_setHierarchicalLink')):
            self.obj1719._setHierarchicalLink(False)

        # MaxFlow
        self.obj1719.MaxFlow.setNone()

        # price
        self.obj1719.price.setValue(0)

        # Name
        self.obj1719.Name.setValue('')
        self.obj1719.Name.setNone()

        # ReqFlow
        self.obj1719.ReqFlow.setNone()

        self.obj1719.GGLabel.setValue(4)
        self.obj1719.graphClass_ = graph_metarial
        if parent.genGraphics:
            new_obj = graph_metarial(240.0, 20.0, self.obj1719)
            new_obj.layConstraints = dict()  # Graphical Layout Constraints
            new_obj.layConstraints['scale'] = [1.0, 1.0]
        else:
            new_obj = None
        self.obj1719.graphObject_ = new_obj

        # Add node to the root: self.LHS
        self.LHS.addNode(self.obj1719)
        self.obj1719.postAction(self.LHS.CREATE)

        self.obj1720 = metarial(parent)
        self.obj1720.preAction(self.LHS.CREATE)
        self.obj1720.isGraphObjectVisual = True

        if (hasattr(self.obj1720, '_setHierarchicalLink')):
            self.obj1720._setHierarchicalLink(False)

        # MaxFlow
        self.obj1720.MaxFlow.setNone()

        # price
        self.obj1720.price.setValue(0)

        # Name
        self.obj1720.Name.setValue('')
        self.obj1720.Name.setNone()

        # ReqFlow
        self.obj1720.ReqFlow.setNone()

        self.obj1720.GGLabel.setValue(6)
        self.obj1720.graphClass_ = graph_metarial
        if parent.genGraphics:
            new_obj = graph_metarial(240.0, 240.0, self.obj1720)
            new_obj.layConstraints = dict()  # Graphical Layout Constraints
            new_obj.layConstraints['scale'] = [1.0, 1.0]
        else:
            new_obj = None
        self.obj1720.graphObject_ = new_obj

        # Add node to the root: self.LHS
        self.LHS.addNode(self.obj1720)
        self.obj1720.postAction(self.LHS.CREATE)

        self.obj1721 = operatingUnit(parent)
        self.obj1721.preAction(self.LHS.CREATE)
        self.obj1721.isGraphObjectVisual = True

        if (hasattr(self.obj1721, '_setHierarchicalLink')):
            self.obj1721._setHierarchicalLink(False)

        # OperCostProp
        self.obj1721.OperCostProp.setNone()

        # name
        self.obj1721.name.setValue('')
        self.obj1721.name.setNone()

        # OperCostFix
        self.obj1721.OperCostFix.setNone()

        self.obj1721.GGLabel.setValue(5)
        self.obj1721.graphClass_ = graph_operatingUnit
        if parent.genGraphics:
            new_obj = graph_operatingUnit(240.0, 140.0, self.obj1721)
            new_obj.layConstraints = dict()  # Graphical Layout Constraints
            new_obj.layConstraints['scale'] = [1.0, 1.0]
        else:
            new_obj = None
        self.obj1721.graphObject_ = new_obj

        # Add node to the root: self.LHS
        self.LHS.addNode(self.obj1721)
        self.obj1721.postAction(self.LHS.CREATE)

        self.obj1722 = fromMaterial(parent)
        self.obj1722.preAction(self.LHS.CREATE)
        self.obj1722.isGraphObjectVisual = True

        if (hasattr(self.obj1722, '_setHierarchicalLink')):
            self.obj1722._setHierarchicalLink(False)

        # rate
        self.obj1722.rate.setNone()

        self.obj1722.GGLabel.setValue(8)
        self.obj1722.graphClass_ = graph_fromMaterial
        if parent.genGraphics:
            new_obj = graph_fromMaterial(265.0, 100.0, self.obj1722)
            new_obj.layConstraints = dict()  # Graphical Layout Constraints
            new_obj.layConstraints['scale'] = [1.0, 1.0]
        else:
            new_obj = None
        self.obj1722.graphObject_ = new_obj

        # Add node to the root: self.LHS
        self.LHS.addNode(self.obj1722)
        self.obj1722.postAction(self.LHS.CREATE)

        self.obj1723 = Goal(parent)
        self.obj1723.preAction(self.LHS.CREATE)
        self.obj1723.isGraphObjectVisual = True

        if (hasattr(self.obj1723, '_setHierarchicalLink')):
            self.obj1723._setHierarchicalLink(False)

        # name
        self.obj1723.name.setValue('')
        self.obj1723.name.setNone()

        self.obj1723.GGLabel.setValue(2)
        self.obj1723.graphClass_ = graph_Goal
        if parent.genGraphics:
            new_obj = graph_Goal(60.0, 220.0, self.obj1723)
            new_obj.layConstraints = dict()  # Graphical Layout Constraints
            new_obj.layConstraints['scale'] = [1.0, 1.0]
        else:
            new_obj = None
        self.obj1723.graphObject_ = new_obj

        # Add node to the root: self.LHS
        self.LHS.addNode(self.obj1723)
        self.obj1723.postAction(self.LHS.CREATE)

        self.obj1724 = Role(parent)
        self.obj1724.preAction(self.LHS.CREATE)
        self.obj1724.isGraphObjectVisual = True

        if (hasattr(self.obj1724, '_setHierarchicalLink')):
            self.obj1724._setHierarchicalLink(False)

        # name
        self.obj1724.name.setValue('')
        self.obj1724.name.setNone()

        self.obj1724.GGLabel.setValue(1)
        self.obj1724.graphClass_ = graph_Role
        if parent.genGraphics:
            new_obj = graph_Role(60.0, 40.0, self.obj1724)
            new_obj.layConstraints = dict()  # Graphical Layout Constraints
            new_obj.layConstraints['scale'] = [1.0, 1.0]
        else:
            new_obj = None
        self.obj1724.graphObject_ = new_obj

        # Add node to the root: self.LHS
        self.LHS.addNode(self.obj1724)
        self.obj1724.postAction(self.LHS.CREATE)

        self.obj1725 = achieve(parent)
        self.obj1725.preAction(self.LHS.CREATE)
        self.obj1725.isGraphObjectVisual = True

        if (hasattr(self.obj1725, '_setHierarchicalLink')):
            self.obj1725._setHierarchicalLink(False)

        # rate
        self.obj1725.rate.setNone()

        self.obj1725.GGLabel.setValue(3)
        self.obj1725.graphClass_ = graph_achieve
        if parent.genGraphics:
            new_obj = graph_achieve(97.5, 137.5, self.obj1725)
            new_obj.layConstraints = dict()  # Graphical Layout Constraints
            new_obj.layConstraints['scale'] = [1.0, 1.0]
        else:
            new_obj = None
        self.obj1725.graphObject_ = new_obj

        # Add node to the root: self.LHS
        self.LHS.addNode(self.obj1725)
        self.obj1725.postAction(self.LHS.CREATE)

        self.obj1726 = GenericGraphEdge(parent)
        self.obj1726.preAction(self.LHS.CREATE)
        self.obj1726.isGraphObjectVisual = True

        if (hasattr(self.obj1726, '_setHierarchicalLink')):
            self.obj1726._setHierarchicalLink(False)

        self.obj1726.GGLabel.setValue(7)
        self.obj1726.graphClass_ = graph_GenericGraphEdge
        if parent.genGraphics:
            new_obj = graph_GenericGraphEdge(215.0, 41.5, self.obj1726)
            new_obj.layConstraints = dict()  # Graphical Layout Constraints
        else:
            new_obj = None
        self.obj1726.graphObject_ = new_obj

        # Add node to the root: self.LHS
        self.LHS.addNode(self.obj1726)
        self.obj1726.postAction(self.LHS.CREATE)

        self.obj1727 = GenericGraphEdge(parent)
        self.obj1727.preAction(self.LHS.CREATE)
        self.obj1727.isGraphObjectVisual = True

        if (hasattr(self.obj1727, '_setHierarchicalLink')):
            self.obj1727._setHierarchicalLink(False)

        self.obj1727.GGLabel.setValue(9)
        self.obj1727.graphClass_ = graph_GenericGraphEdge
        if parent.genGraphics:
            new_obj = graph_GenericGraphEdge(185.0, 276.0, self.obj1727)
            new_obj.layConstraints = dict()  # Graphical Layout Constraints
        else:
            new_obj = None
        self.obj1727.graphObject_ = new_obj

        # Add node to the root: self.LHS
        self.LHS.addNode(self.obj1727)
        self.obj1727.postAction(self.LHS.CREATE)

        self.obj1719.out_connections_.append(self.obj1722)
        self.obj1722.in_connections_.append(self.obj1719)
        self.obj1719.graphObject_.pendingConnections.append(
            (self.obj1719.graphObject_.tag, self.obj1722.graphObject_.tag,
             [264.0, 69.0, 265.0, 100.0], 0, True))
        self.obj1722.out_connections_.append(self.obj1721)
        self.obj1721.in_connections_.append(self.obj1722)
        self.obj1722.graphObject_.pendingConnections.append(
            (self.obj1722.graphObject_.tag, self.obj1721.graphObject_.tag,
             [260.0, 151.0, 352.0, 90.0], 0, True))
        self.obj1723.out_connections_.append(self.obj1727)
        self.obj1727.in_connections_.append(self.obj1723)
        self.obj1723.graphObject_.pendingConnections.append(
            (self.obj1723.graphObject_.tag, self.obj1727.graphObject_.tag,
             [84.0, 270.0, 185.0, 276.0], 0, True))
        self.obj1724.out_connections_.append(self.obj1725)
        self.obj1725.in_connections_.append(self.obj1724)
        self.obj1724.graphObject_.pendingConnections.append(
            (self.obj1724.graphObject_.tag, self.obj1725.graphObject_.tag,
             [84.0, 86.0, 97.5, 137.5], 0, True))
        self.obj1724.out_connections_.append(self.obj1726)
        self.obj1726.in_connections_.append(self.obj1724)
        self.obj1724.graphObject_.pendingConnections.append(
            (self.obj1724.graphObject_.tag, self.obj1726.graphObject_.tag,
             [84.0, 41.0, 215.0, 41.5], 0, True))
        self.obj1725.out_connections_.append(self.obj1723)
        self.obj1723.in_connections_.append(self.obj1725)
        self.obj1725.graphObject_.pendingConnections.append(
            (self.obj1725.graphObject_.tag, self.obj1723.graphObject_.tag,
             [83.0, 221.0, 93.5, 143.5], 0, True))
        self.obj1726.out_connections_.append(self.obj1719)
        self.obj1719.in_connections_.append(self.obj1726)
        self.obj1726.graphObject_.pendingConnections.append(
            (self.obj1726.graphObject_.tag, self.obj1719.graphObject_.tag,
             [246.0, 62.0, 215.0, 41.5], 0, True))
        self.obj1727.out_connections_.append(self.obj1720)
        self.obj1720.in_connections_.append(self.obj1727)
        self.obj1727.graphObject_.pendingConnections.append(
            (self.obj1727.graphObject_.tag, self.obj1720.graphObject_.tag,
             [246.0, 282.0, 185.0, 276.0], 0, True))

        self.RHS = ASG_pns(parent)
        self.RHS.merge(ASG_omacs(parent))
        self.RHS.merge(ASG_GenericGraph(parent))

        self.obj1731 = metarial(parent)
        self.obj1731.preAction(self.RHS.CREATE)
        self.obj1731.isGraphObjectVisual = True

        if (hasattr(self.obj1731, '_setHierarchicalLink')):
            self.obj1731._setHierarchicalLink(False)

        # MaxFlow
        self.obj1731.MaxFlow.setNone()

        # price
        self.obj1731.price.setValue(0)

        # Name
        self.obj1731.Name.setValue('')
        self.obj1731.Name.setNone()

        # ReqFlow
        self.obj1731.ReqFlow.setNone()

        self.obj1731.GGLabel.setValue(4)
        self.obj1731.graphClass_ = graph_metarial
        if parent.genGraphics:
            new_obj = graph_metarial(280.0, 20.0, self.obj1731)
            new_obj.layConstraints = dict()  # Graphical Layout Constraints
            new_obj.layConstraints['scale'] = [1.0, 1.0]
        else:
            new_obj = None
        self.obj1731.graphObject_ = new_obj
        self.obj17310 = AttrCalc()
        self.obj17310.Copy = ATOM3Boolean()
        self.obj17310.Copy.setValue(('Copy from LHS', 1))
        self.obj17310.Copy.config = 0
        self.obj17310.Specify = ATOM3Constraint()
        self.obj17310.Specify.setValue(
            ('AttrSpecify', (['Python', 'OCL'], 0),
             (['PREcondition', 'POSTcondition'], 1), ([
                 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT',
                 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE'
             ], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), None))
        self.obj1731.GGset2Any['MaxFlow'] = self.obj17310
        self.obj17311 = AttrCalc()
        self.obj17311.Copy = ATOM3Boolean()
        self.obj17311.Copy.setValue(('Copy from LHS', 1))
        self.obj17311.Copy.config = 0
        self.obj17311.Specify = ATOM3Constraint()
        self.obj17311.Specify.setValue(
            ('AttrSpecify', (['Python', 'OCL'], 0),
             (['PREcondition', 'POSTcondition'], 1), ([
                 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT',
                 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE'
             ], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), None))
        self.obj1731.GGset2Any['Name'] = self.obj17311
        self.obj17312 = AttrCalc()
        self.obj17312.Copy = ATOM3Boolean()
        self.obj17312.Copy.setValue(('Copy from LHS', 1))
        self.obj17312.Copy.config = 0
        self.obj17312.Specify = ATOM3Constraint()
        self.obj17312.Specify.setValue(
            ('AttrSpecify', (['Python', 'OCL'], 0),
             (['PREcondition', 'POSTcondition'], 1), ([
                 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT',
                 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE'
             ], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), None))
        self.obj1731.GGset2Any['ReqFlow'] = self.obj17312

        # Add node to the root: self.RHS
        self.RHS.addNode(self.obj1731)
        self.obj1731.postAction(self.RHS.CREATE)

        self.obj1732 = metarial(parent)
        self.obj1732.preAction(self.RHS.CREATE)
        self.obj1732.isGraphObjectVisual = True

        if (hasattr(self.obj1732, '_setHierarchicalLink')):
            self.obj1732._setHierarchicalLink(False)

        # MaxFlow
        self.obj1732.MaxFlow.setNone()

        # price
        self.obj1732.price.setValue(0)

        # Name
        self.obj1732.Name.setValue('')
        self.obj1732.Name.setNone()

        # ReqFlow
        self.obj1732.ReqFlow.setNone()

        self.obj1732.GGLabel.setValue(6)
        self.obj1732.graphClass_ = graph_metarial
        if parent.genGraphics:
            new_obj = graph_metarial(280.0, 240.0, self.obj1732)
            new_obj.layConstraints = dict()  # Graphical Layout Constraints
            new_obj.layConstraints['scale'] = [1.0, 1.0]
        else:
            new_obj = None
        self.obj1732.graphObject_ = new_obj
        self.obj17320 = AttrCalc()
        self.obj17320.Copy = ATOM3Boolean()
        self.obj17320.Copy.setValue(('Copy from LHS', 1))
        self.obj17320.Copy.config = 0
        self.obj17320.Specify = ATOM3Constraint()
        self.obj17320.Specify.setValue(
            ('AttrSpecify', (['Python', 'OCL'], 0),
             (['PREcondition', 'POSTcondition'], 1), ([
                 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT',
                 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE'
             ], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), None))
        self.obj1732.GGset2Any['MaxFlow'] = self.obj17320
        self.obj17321 = AttrCalc()
        self.obj17321.Copy = ATOM3Boolean()
        self.obj17321.Copy.setValue(('Copy from LHS', 1))
        self.obj17321.Copy.config = 0
        self.obj17321.Specify = ATOM3Constraint()
        self.obj17321.Specify.setValue(
            ('AttrSpecify', (['Python', 'OCL'], 0),
             (['PREcondition', 'POSTcondition'], 1), ([
                 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT',
                 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE'
             ], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), None))
        self.obj1732.GGset2Any['Name'] = self.obj17321
        self.obj17322 = AttrCalc()
        self.obj17322.Copy = ATOM3Boolean()
        self.obj17322.Copy.setValue(('Copy from LHS', 1))
        self.obj17322.Copy.config = 0
        self.obj17322.Specify = ATOM3Constraint()
        self.obj17322.Specify.setValue(
            ('AttrSpecify', (['Python', 'OCL'], 0),
             (['PREcondition', 'POSTcondition'], 1), ([
                 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT',
                 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE'
             ], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), None))
        self.obj1732.GGset2Any['ReqFlow'] = self.obj17322

        # Add node to the root: self.RHS
        self.RHS.addNode(self.obj1732)
        self.obj1732.postAction(self.RHS.CREATE)

        self.obj1733 = operatingUnit(parent)
        self.obj1733.preAction(self.RHS.CREATE)
        self.obj1733.isGraphObjectVisual = True

        if (hasattr(self.obj1733, '_setHierarchicalLink')):
            self.obj1733._setHierarchicalLink(False)

        # OperCostProp
        self.obj1733.OperCostProp.setNone()

        # name
        self.obj1733.name.setValue('')
        self.obj1733.name.setNone()

        # OperCostFix
        self.obj1733.OperCostFix.setNone()

        self.obj1733.GGLabel.setValue(5)
        self.obj1733.graphClass_ = graph_operatingUnit
        if parent.genGraphics:
            new_obj = graph_operatingUnit(280.0, 140.0, self.obj1733)
            new_obj.layConstraints = dict()  # Graphical Layout Constraints
            new_obj.layConstraints['scale'] = [1.0, 1.0]
        else:
            new_obj = None
        self.obj1733.graphObject_ = new_obj
        self.obj17330 = AttrCalc()
        self.obj17330.Copy = ATOM3Boolean()
        self.obj17330.Copy.setValue(('Copy from LHS', 1))
        self.obj17330.Copy.config = 0
        self.obj17330.Specify = ATOM3Constraint()
        self.obj17330.Specify.setValue(
            ('AttrSpecify', (['Python', 'OCL'], 0),
             (['PREcondition', 'POSTcondition'], 1), ([
                 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT',
                 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE'
             ], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), None))
        self.obj1733.GGset2Any['OperCostProp'] = self.obj17330
        self.obj17331 = AttrCalc()
        self.obj17331.Copy = ATOM3Boolean()
        self.obj17331.Copy.setValue(('Copy from LHS', 1))
        self.obj17331.Copy.config = 0
        self.obj17331.Specify = ATOM3Constraint()
        self.obj17331.Specify.setValue(
            ('AttrSpecify', (['Python', 'OCL'], 0),
             (['PREcondition', 'POSTcondition'], 1), ([
                 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT',
                 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE'
             ], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), None))
        self.obj1733.GGset2Any['name'] = self.obj17331
        self.obj17332 = AttrCalc()
        self.obj17332.Copy = ATOM3Boolean()
        self.obj17332.Copy.setValue(('Copy from LHS', 1))
        self.obj17332.Copy.config = 0
        self.obj17332.Specify = ATOM3Constraint()
        self.obj17332.Specify.setValue(
            ('AttrSpecify', (['Python', 'OCL'], 0),
             (['PREcondition', 'POSTcondition'], 1), ([
                 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT',
                 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE'
             ], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), None))
        self.obj1733.GGset2Any['OperCostFix'] = self.obj17332

        # Add node to the root: self.RHS
        self.RHS.addNode(self.obj1733)
        self.obj1733.postAction(self.RHS.CREATE)

        self.obj1734 = intoMaterial(parent)
        self.obj1734.preAction(self.RHS.CREATE)
        self.obj1734.isGraphObjectVisual = True

        if (hasattr(self.obj1734, '_setHierarchicalLink')):
            self.obj1734._setHierarchicalLink(False)

        # rate
        self.obj1734.rate.setValue(0.0)

        self.obj1734.GGLabel.setValue(10)
        self.obj1734.graphClass_ = graph_intoMaterial
        if parent.genGraphics:
            new_obj = graph_intoMaterial(315.25, 202.5, self.obj1734)
            new_obj.layConstraints = dict()  # Graphical Layout Constraints
            new_obj.layConstraints['scale'] = [1.0, 1.0]
        else:
            new_obj = None
        self.obj1734.graphObject_ = new_obj
        self.obj17340 = AttrCalc()
        self.obj17340.Copy = ATOM3Boolean()
        self.obj17340.Copy.setValue(('Copy from LHS', 0))
        self.obj17340.Copy.config = 0
        self.obj17340.Specify = ATOM3Constraint()
        self.obj17340.Specify.setValue(
            ('AttrSpecify', (['Python', 'OCL'], 0),
             (['PREcondition', 'POSTcondition'], 1), ([
                 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT',
                 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE'
             ], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]),
             'return self.getMatched(graphID, self.LHS.nodeWithLabel(3)).rate.getValue()\n\n\n\n\n\n\n\n\n\n'
             ))
        self.obj1734.GGset2Any['rate'] = self.obj17340

        # Add node to the root: self.RHS
        self.RHS.addNode(self.obj1734)
        self.obj1734.postAction(self.RHS.CREATE)

        self.obj1735 = fromMaterial(parent)
        self.obj1735.preAction(self.RHS.CREATE)
        self.obj1735.isGraphObjectVisual = True

        if (hasattr(self.obj1735, '_setHierarchicalLink')):
            self.obj1735._setHierarchicalLink(False)

        # rate
        self.obj1735.rate.setNone()

        self.obj1735.GGLabel.setValue(8)
        self.obj1735.graphClass_ = graph_fromMaterial
        if parent.genGraphics:
            new_obj = graph_fromMaterial(323.0, 83.0, self.obj1735)
            new_obj.layConstraints = dict()  # Graphical Layout Constraints
            new_obj.layConstraints['scale'] = [1.0, 1.0]
        else:
            new_obj = None
        self.obj1735.graphObject_ = new_obj
        self.obj17350 = AttrCalc()
        self.obj17350.Copy = ATOM3Boolean()
        self.obj17350.Copy.setValue(('Copy from LHS', 1))
        self.obj17350.Copy.config = 0
        self.obj17350.Specify = ATOM3Constraint()
        self.obj17350.Specify.setValue(
            ('AttrSpecify', (['Python', 'OCL'], 0),
             (['PREcondition', 'POSTcondition'], 1), ([
                 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT',
                 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE'
             ], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), None))
        self.obj1735.GGset2Any['rate'] = self.obj17350

        # Add node to the root: self.RHS
        self.RHS.addNode(self.obj1735)
        self.obj1735.postAction(self.RHS.CREATE)

        self.obj1736 = Goal(parent)
        self.obj1736.preAction(self.RHS.CREATE)
        self.obj1736.isGraphObjectVisual = True

        if (hasattr(self.obj1736, '_setHierarchicalLink')):
            self.obj1736._setHierarchicalLink(False)

        # name
        self.obj1736.name.setValue('')
        self.obj1736.name.setNone()

        self.obj1736.GGLabel.setValue(2)
        self.obj1736.graphClass_ = graph_Goal
        if parent.genGraphics:
            new_obj = graph_Goal(60.0, 220.0, self.obj1736)
            new_obj.layConstraints = dict()  # Graphical Layout Constraints
            new_obj.layConstraints['scale'] = [1.0, 1.0]
        else:
            new_obj = None
        self.obj1736.graphObject_ = new_obj
        self.obj17360 = AttrCalc()
        self.obj17360.Copy = ATOM3Boolean()
        self.obj17360.Copy.setValue(('Copy from LHS', 1))
        self.obj17360.Copy.config = 0
        self.obj17360.Specify = ATOM3Constraint()
        self.obj17360.Specify.setValue(
            ('AttrSpecify', (['Python', 'OCL'], 0),
             (['PREcondition', 'POSTcondition'], 1), ([
                 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT',
                 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE'
             ], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), None))
        self.obj1736.GGset2Any['name'] = self.obj17360

        # Add node to the root: self.RHS
        self.RHS.addNode(self.obj1736)
        self.obj1736.postAction(self.RHS.CREATE)

        self.obj1737 = Role(parent)
        self.obj1737.preAction(self.RHS.CREATE)
        self.obj1737.isGraphObjectVisual = True

        if (hasattr(self.obj1737, '_setHierarchicalLink')):
            self.obj1737._setHierarchicalLink(False)

        # name
        self.obj1737.name.setValue('')
        self.obj1737.name.setNone()

        self.obj1737.GGLabel.setValue(1)
        self.obj1737.graphClass_ = graph_Role
        if parent.genGraphics:
            new_obj = graph_Role(60.0, 40.0, self.obj1737)
            new_obj.layConstraints = dict()  # Graphical Layout Constraints
            new_obj.layConstraints['scale'] = [1.0, 1.0]
        else:
            new_obj = None
        self.obj1737.graphObject_ = new_obj
        self.obj17370 = AttrCalc()
        self.obj17370.Copy = ATOM3Boolean()
        self.obj17370.Copy.setValue(('Copy from LHS', 1))
        self.obj17370.Copy.config = 0
        self.obj17370.Specify = ATOM3Constraint()
        self.obj17370.Specify.setValue(
            ('AttrSpecify', (['Python', 'OCL'], 0),
             (['PREcondition', 'POSTcondition'], 1), ([
                 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT',
                 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE'
             ], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), None))
        self.obj1737.GGset2Any['name'] = self.obj17370

        # Add node to the root: self.RHS
        self.RHS.addNode(self.obj1737)
        self.obj1737.postAction(self.RHS.CREATE)

        self.obj1738 = achieve(parent)
        self.obj1738.preAction(self.RHS.CREATE)
        self.obj1738.isGraphObjectVisual = True

        if (hasattr(self.obj1738, '_setHierarchicalLink')):
            self.obj1738._setHierarchicalLink(False)

        # rate
        self.obj1738.rate.setNone()

        self.obj1738.GGLabel.setValue(3)
        self.obj1738.graphClass_ = graph_achieve
        if parent.genGraphics:
            new_obj = graph_achieve(93.5, 143.5, self.obj1738)
            new_obj.layConstraints = dict()  # Graphical Layout Constraints
            new_obj.layConstraints['scale'] = [1.0, 1.0]
        else:
            new_obj = None
        self.obj1738.graphObject_ = new_obj
        self.obj17380 = AttrCalc()
        self.obj17380.Copy = ATOM3Boolean()
        self.obj17380.Copy.setValue(('Copy from LHS', 1))
        self.obj17380.Copy.config = 0
        self.obj17380.Specify = ATOM3Constraint()
        self.obj17380.Specify.setValue(
            ('AttrSpecify', (['Python', 'OCL'], 0),
             (['PREcondition', 'POSTcondition'], 1), ([
                 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT',
                 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE'
             ], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), None))
        self.obj1738.GGset2Any['rate'] = self.obj17380

        # Add node to the root: self.RHS
        self.RHS.addNode(self.obj1738)
        self.obj1738.postAction(self.RHS.CREATE)

        self.obj1739 = GenericGraphEdge(parent)
        self.obj1739.preAction(self.RHS.CREATE)
        self.obj1739.isGraphObjectVisual = True

        if (hasattr(self.obj1739, '_setHierarchicalLink')):
            self.obj1739._setHierarchicalLink(False)

        self.obj1739.GGLabel.setValue(7)
        self.obj1739.graphClass_ = graph_GenericGraphEdge
        if parent.genGraphics:
            new_obj = graph_GenericGraphEdge(215.0, 41.5, self.obj1739)
            new_obj.layConstraints = dict()  # Graphical Layout Constraints
        else:
            new_obj = None
        self.obj1739.graphObject_ = new_obj

        # Add node to the root: self.RHS
        self.RHS.addNode(self.obj1739)
        self.obj1739.postAction(self.RHS.CREATE)

        self.obj1740 = GenericGraphEdge(parent)
        self.obj1740.preAction(self.RHS.CREATE)
        self.obj1740.isGraphObjectVisual = True

        if (hasattr(self.obj1740, '_setHierarchicalLink')):
            self.obj1740._setHierarchicalLink(False)

        self.obj1740.GGLabel.setValue(9)
        self.obj1740.graphClass_ = graph_GenericGraphEdge
        if parent.genGraphics:
            new_obj = graph_GenericGraphEdge(185.0, 276.0, self.obj1740)
            new_obj.layConstraints = dict()  # Graphical Layout Constraints
        else:
            new_obj = None
        self.obj1740.graphObject_ = new_obj

        # Add node to the root: self.RHS
        self.RHS.addNode(self.obj1740)
        self.obj1740.postAction(self.RHS.CREATE)

        self.obj1731.out_connections_.append(self.obj1735)
        self.obj1735.in_connections_.append(self.obj1731)
        self.obj1731.graphObject_.pendingConnections.append(
            (self.obj1731.graphObject_.tag, self.obj1735.graphObject_.tag,
             [284.0, 69.0, 323.0, 83.0], 2, 0))
        self.obj1733.out_connections_.append(self.obj1734)
        self.obj1734.in_connections_.append(self.obj1733)
        self.obj1733.graphObject_.pendingConnections.append(
            (self.obj1733.graphObject_.tag, self.obj1734.graphObject_.tag,
             [333.0, 148.0, 332.0, 167.0, 371.25, 179.5], 2, True))
        self.obj1734.out_connections_.append(self.obj1732)
        self.obj1732.in_connections_.append(self.obj1734)
        self.obj1734.graphObject_.pendingConnections.append(
            (self.obj1734.graphObject_.tag, self.obj1732.graphObject_.tag,
             [326.0, 250.0, 354.5, 215.0, 371.25, 179.5], 2, True))
        self.obj1735.out_connections_.append(self.obj1733)
        self.obj1733.in_connections_.append(self.obj1735)
        self.obj1735.graphObject_.pendingConnections.append(
            (self.obj1735.graphObject_.tag, self.obj1733.graphObject_.tag,
             [333.0, 148.0, 352.0, 90.0], 2, 0))
        self.obj1736.out_connections_.append(self.obj1740)
        self.obj1740.in_connections_.append(self.obj1736)
        self.obj1736.graphObject_.pendingConnections.append(
            (self.obj1736.graphObject_.tag, self.obj1740.graphObject_.tag,
             [94.0, 270.0, 185.0, 276.0], 2, 0))
        self.obj1737.out_connections_.append(self.obj1738)
        self.obj1738.in_connections_.append(self.obj1737)
        self.obj1737.graphObject_.pendingConnections.append(
            (self.obj1737.graphObject_.tag, self.obj1738.graphObject_.tag,
             [91.0, 85.0, 93.5, 143.5], 2, 0))
        self.obj1737.out_connections_.append(self.obj1739)
        self.obj1739.in_connections_.append(self.obj1737)
        self.obj1737.graphObject_.pendingConnections.append(
            (self.obj1737.graphObject_.tag, self.obj1739.graphObject_.tag,
             [91.0, 40.0, 215.0, 41.5], 2, 0))
        self.obj1738.out_connections_.append(self.obj1736)
        self.obj1736.in_connections_.append(self.obj1738)
        self.obj1738.graphObject_.pendingConnections.append(
            (self.obj1738.graphObject_.tag, self.obj1736.graphObject_.tag,
             [93.0, 221.0, 93.5, 143.5], 2, 0))
        self.obj1739.out_connections_.append(self.obj1731)
        self.obj1731.in_connections_.append(self.obj1739)
        self.obj1739.graphObject_.pendingConnections.append(
            (self.obj1739.graphObject_.tag, self.obj1731.graphObject_.tag,
             [266.0, 62.0, 215.0, 41.5], 2, 0))
        self.obj1740.out_connections_.append(self.obj1732)
        self.obj1732.in_connections_.append(self.obj1740)
        self.obj1740.graphObject_.pendingConnections.append(
            (self.obj1740.graphObject_.tag, self.obj1732.graphObject_.tag,
             [286.0, 282.0, 185.0, 276.0], 2, 0))
Пример #23
0
    def __init__(self, parent):
        GGrule.__init__(self, 6)
        self.TimeDelay = ATOM3Integer(2)
        self.exactMatch = 1
        self.LHS = ASG_omacs(parent)

        self.obj1596 = Role(parent)
        self.obj1596.preAction(self.LHS.CREATE)
        self.obj1596.isGraphObjectVisual = True

        if (hasattr(self.obj1596, '_setHierarchicalLink')):
            self.obj1596._setHierarchicalLink(False)

        # name
        self.obj1596.name.setValue('')
        self.obj1596.name.setNone()

        self.obj1596.GGLabel.setValue(2)
        self.obj1596.graphClass_ = graph_Role
        if parent.genGraphics:
            new_obj = graph_Role(40.0, 40.0, self.obj1596)
            new_obj.layConstraints = dict()  # Graphical Layout Constraints
            new_obj.layConstraints['scale'] = [1.0, 1.0]
        else:
            new_obj = None
        self.obj1596.graphObject_ = new_obj

        # Add node to the root: self.LHS
        self.LHS.addNode(self.obj1596)
        self.obj1596.postAction(self.LHS.CREATE)

        self.obj1597 = Goal(parent)
        self.obj1597.preAction(self.LHS.CREATE)
        self.obj1597.isGraphObjectVisual = True

        if (hasattr(self.obj1597, '_setHierarchicalLink')):
            self.obj1597._setHierarchicalLink(False)

        # name
        self.obj1597.name.setValue('')
        self.obj1597.name.setNone()

        self.obj1597.GGLabel.setValue(1)
        self.obj1597.graphClass_ = graph_Goal
        if parent.genGraphics:
            new_obj = graph_Goal(300.0, 160.0, self.obj1597)
            new_obj.layConstraints = dict()  # Graphical Layout Constraints
            new_obj.layConstraints['scale'] = [1.0, 1.0]
        else:
            new_obj = None
        self.obj1597.graphObject_ = new_obj

        # Add node to the root: self.LHS
        self.LHS.addNode(self.obj1597)
        self.obj1597.postAction(self.LHS.CREATE)

        self.obj1598 = achieve(parent)
        self.obj1598.preAction(self.LHS.CREATE)
        self.obj1598.isGraphObjectVisual = True

        if (hasattr(self.obj1598, '_setHierarchicalLink')):
            self.obj1598._setHierarchicalLink(False)

        # rate
        self.obj1598.rate.setNone()

        self.obj1598.GGLabel.setValue(3)
        self.obj1598.graphClass_ = graph_achieve
        if parent.genGraphics:
            new_obj = graph_achieve(171.25, 141.25, self.obj1598)
            new_obj.layConstraints = dict()  # Graphical Layout Constraints
            new_obj.layConstraints['scale'] = [1.0, 1.0]
        else:
            new_obj = None
        self.obj1598.graphObject_ = new_obj

        # Add node to the root: self.LHS
        self.LHS.addNode(self.obj1598)
        self.obj1598.postAction(self.LHS.CREATE)

        self.obj1596.out_connections_.append(self.obj1598)
        self.obj1598.in_connections_.append(self.obj1596)
        self.obj1596.graphObject_.pendingConnections.append(
            (self.obj1596.graphObject_.tag, self.obj1598.graphObject_.tag,
             [64.0, 86.0, 106.5, 122.5, 171.25, 141.25], 2, True))
        self.obj1598.out_connections_.append(self.obj1597)
        self.obj1597.in_connections_.append(self.obj1598)
        self.obj1598.graphObject_.pendingConnections.append(
            (self.obj1598.graphObject_.tag, self.obj1597.graphObject_.tag,
             [323.0, 161.0, 236.0, 160.0, 171.25, 141.25], 2, True))

        self.RHS = ASG_omacs(parent)

        self.obj1600 = Role(parent)
        self.obj1600.preAction(self.RHS.CREATE)
        self.obj1600.isGraphObjectVisual = True

        if (hasattr(self.obj1600, '_setHierarchicalLink')):
            self.obj1600._setHierarchicalLink(False)

        # name
        self.obj1600.name.setValue('')
        self.obj1600.name.setNone()

        self.obj1600.GGLabel.setValue(2)
        self.obj1600.graphClass_ = graph_Role
        if parent.genGraphics:
            new_obj = graph_Role(40.0, 40.0, self.obj1600)
            new_obj.layConstraints = dict()  # Graphical Layout Constraints
            new_obj.layConstraints['scale'] = [1.0, 1.0]
        else:
            new_obj = None
        self.obj1600.graphObject_ = new_obj
        self.obj16000 = AttrCalc()
        self.obj16000.Copy = ATOM3Boolean()
        self.obj16000.Copy.setValue(('Copy from LHS', 1))
        self.obj16000.Copy.config = 0
        self.obj16000.Specify = ATOM3Constraint()
        self.obj16000.Specify.setValue(
            ('AttrSpecify', (['Python', 'OCL'], 0),
             (['PREcondition', 'POSTcondition'], 1), ([
                 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT',
                 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE'
             ], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), None))
        self.obj1600.GGset2Any['name'] = self.obj16000

        # Add node to the root: self.RHS
        self.RHS.addNode(self.obj1600)
        self.obj1600.postAction(self.RHS.CREATE)

        self.obj1601 = Goal(parent)
        self.obj1601.preAction(self.RHS.CREATE)
        self.obj1601.isGraphObjectVisual = True

        if (hasattr(self.obj1601, '_setHierarchicalLink')):
            self.obj1601._setHierarchicalLink(False)

        # name
        self.obj1601.name.setValue('')
        self.obj1601.name.setNone()

        self.obj1601.GGLabel.setValue(1)
        self.obj1601.graphClass_ = graph_Goal
        if parent.genGraphics:
            new_obj = graph_Goal(300.0, 160.0, self.obj1601)
            new_obj.layConstraints = dict()  # Graphical Layout Constraints
            new_obj.layConstraints['scale'] = [1.0, 1.0]
        else:
            new_obj = None
        self.obj1601.graphObject_ = new_obj
        self.obj16010 = AttrCalc()
        self.obj16010.Copy = ATOM3Boolean()
        self.obj16010.Copy.setValue(('Copy from LHS', 1))
        self.obj16010.Copy.config = 0
        self.obj16010.Specify = ATOM3Constraint()
        self.obj16010.Specify.setValue(
            ('AttrSpecify', (['Python', 'OCL'], 0),
             (['PREcondition', 'POSTcondition'], 1), ([
                 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT',
                 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE'
             ], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), None))
        self.obj1601.GGset2Any['name'] = self.obj16010

        # Add node to the root: self.RHS
        self.RHS.addNode(self.obj1601)
        self.obj1601.postAction(self.RHS.CREATE)

        self.obj1602 = achieve(parent)
        self.obj1602.preAction(self.RHS.CREATE)
        self.obj1602.isGraphObjectVisual = True

        if (hasattr(self.obj1602, '_setHierarchicalLink')):
            self.obj1602._setHierarchicalLink(False)

        # rate
        self.obj1602.rate.setNone()

        self.obj1602.GGLabel.setValue(3)
        self.obj1602.graphClass_ = graph_achieve
        if parent.genGraphics:
            new_obj = graph_achieve(171.25, 141.25, self.obj1602)
            new_obj.layConstraints = dict()  # Graphical Layout Constraints
            new_obj.layConstraints['scale'] = [1.0, 1.0]
        else:
            new_obj = None
        self.obj1602.graphObject_ = new_obj
        self.obj16020 = AttrCalc()
        self.obj16020.Copy = ATOM3Boolean()
        self.obj16020.Copy.setValue(('Copy from LHS', 1))
        self.obj16020.Copy.config = 0
        self.obj16020.Specify = ATOM3Constraint()
        self.obj16020.Specify.setValue(
            ('AttrSpecify', (['Python', 'OCL'], 0),
             (['PREcondition', 'POSTcondition'], 1), ([
                 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT',
                 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE'
             ], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), None))
        self.obj1602.GGset2Any['rate'] = self.obj16020

        # Add node to the root: self.RHS
        self.RHS.addNode(self.obj1602)
        self.obj1602.postAction(self.RHS.CREATE)

        self.obj1600.out_connections_.append(self.obj1602)
        self.obj1602.in_connections_.append(self.obj1600)
        self.obj1600.graphObject_.pendingConnections.append(
            (self.obj1600.graphObject_.tag, self.obj1602.graphObject_.tag,
             [71.0, 85.0, 171.25, 141.25], 2, 0))
        self.obj1602.out_connections_.append(self.obj1601)
        self.obj1601.in_connections_.append(self.obj1602)
        self.obj1602.graphObject_.pendingConnections.append(
            (self.obj1602.graphObject_.tag, self.obj1601.graphObject_.tag,
             [333.0, 161.0, 171.25, 141.25], 2, 0))
Пример #24
0
from Goal import *
from Population import *
from Obstacle import *

goal = Goal()
all_sprites.add(goal)
population = Population()


def draw_text(surf, text, size, x, y):
    font = pygame.font.Font(font_name, size)
    text_surface = font.render(text, True, BLACK)
    text_rect = text_surface.get_rect()
    text_rect.midtop = (x, y)
    surf.blit(text_surface, text_rect)


def handle_obstacles():
    global lvl_up
    global obs_index
    if lvl_up and obs_index < len(obs_topleft_list):
        Obstacle(obs_topleft_list[obs_index])
        lvl_up = False
        obs_index += 1


def evolve():
    population.compute_total_fitness()
    if population.generation % 2 == 1:
        population.boost_fitness()
    else:
Пример #25
0
gameOver = False
# Boolean variable keeps the program running
keep_going = True

# Initialize left goal width, and left goalBaseBlock width
width1 = 200
# Initialize right goal width, and right goalBaseBlock width
width2 = 200

# Initialize the red paddle size
pSize1 = 45
# Initialize the blue paddle size
pSize2 = 45

# Create left goal (Draw out goal)
goal1 = Goal(1, 0, 295, width1)
# Create right goal (Draw out goal)
goal2 = Goal(0, 985, 295, width2)

# Create left goalBaseBlock (Used to detect if a goal is scored)
goalBaseBlock1 = GoalBaseBlock(1, 0, 295, width1)
# Create right goalBaseBlock (Used to detect if a goal is scored)
goalBaseBlock2 = GoalBaseBlock(0, 1029, 295, width2)

# Initialize left goalSideBlock width
sideBlockWidth1 = 150
# Initialize right goalSideBlock width
sideBlockWidth2 = 150

# Create left upper goalSideBlock (Draw side barrier for puck)
goalSideBlockLU = GoalSideBlock(0, 0, 145, sideBlockWidth1)
Пример #26
0
class RemoveGoal_GG_rule(GGrule):
    def __init__(self, parent):
        GGrule.__init__(self, 25)
        self.TimeDelay = ATOM3Integer(2)
        self.exactMatch = 1
        self.LHS = ASG_pns(parent)
        self.LHS.merge(ASG_omacs(parent))
        self.LHS.merge(ASG_GenericGraph(parent))

        self.obj1815 = metarial(parent)
        self.obj1815.preAction(self.LHS.CREATE)
        self.obj1815.isGraphObjectVisual = True

        if (hasattr(self.obj1815, '_setHierarchicalLink')):
            self.obj1815._setHierarchicalLink(False)

        # MaxFlow
        self.obj1815.MaxFlow.setNone()

        # price
        self.obj1815.price.setValue(0)

        # Name
        self.obj1815.Name.setValue('')
        self.obj1815.Name.setNone()

        # ReqFlow
        self.obj1815.ReqFlow.setNone()

        self.obj1815.GGLabel.setValue(1)
        self.obj1815.graphClass_ = graph_metarial
        if parent.genGraphics:
            new_obj = graph_metarial(280.0, 60.0, self.obj1815)
            new_obj.layConstraints = dict()  # Graphical Layout Constraints
            new_obj.layConstraints['scale'] = [1.0, 1.0]
        else:
            new_obj = None
        self.obj1815.graphObject_ = new_obj

        # Add node to the root: self.LHS
        self.LHS.addNode(self.obj1815)
        self.obj1815.postAction(self.LHS.CREATE)

        self.obj1816 = Goal(parent)
        self.obj1816.preAction(self.LHS.CREATE)
        self.obj1816.isGraphObjectVisual = True

        if (hasattr(self.obj1816, '_setHierarchicalLink')):
            self.obj1816._setHierarchicalLink(False)

        # name
        self.obj1816.name.setValue('')
        self.obj1816.name.setNone()

        self.obj1816.GGLabel.setValue(3)
        self.obj1816.graphClass_ = graph_Goal
        if parent.genGraphics:
            new_obj = graph_Goal(100.0, 60.0, self.obj1816)
            new_obj.layConstraints = dict()  # Graphical Layout Constraints
            new_obj.layConstraints['scale'] = [1.0, 1.0]
        else:
            new_obj = None
        self.obj1816.graphObject_ = new_obj

        # Add node to the root: self.LHS
        self.LHS.addNode(self.obj1816)
        self.obj1816.postAction(self.LHS.CREATE)

        self.obj1817 = GenericGraphEdge(parent)
        self.obj1817.preAction(self.LHS.CREATE)
        self.obj1817.isGraphObjectVisual = True

        if (hasattr(self.obj1817, '_setHierarchicalLink')):
            self.obj1817._setHierarchicalLink(False)

        self.obj1817.GGLabel.setValue(4)
        self.obj1817.graphClass_ = graph_GenericGraphEdge
        if parent.genGraphics:
            new_obj = graph_GenericGraphEdge(205.0, 106.0, self.obj1817)
            new_obj.layConstraints = dict()  # Graphical Layout Constraints
        else:
            new_obj = None
        self.obj1817.graphObject_ = new_obj

        # Add node to the root: self.LHS
        self.LHS.addNode(self.obj1817)
        self.obj1817.postAction(self.LHS.CREATE)

        self.obj1816.out_connections_.append(self.obj1817)
        self.obj1817.in_connections_.append(self.obj1816)
        self.obj1816.graphObject_.pendingConnections.append(
            (self.obj1816.graphObject_.tag, self.obj1817.graphObject_.tag,
             [124.0, 110.0, 205.0, 106.0], 0, True))
        self.obj1817.out_connections_.append(self.obj1815)
        self.obj1815.in_connections_.append(self.obj1817)
        self.obj1817.graphObject_.pendingConnections.append(
            (self.obj1817.graphObject_.tag, self.obj1815.graphObject_.tag,
             [286.0, 102.0, 205.0, 106.0], 0, True))

        self.RHS = ASG_pns(parent)

        self.obj1819 = metarial(parent)
        self.obj1819.preAction(self.RHS.CREATE)
        self.obj1819.isGraphObjectVisual = True

        if (hasattr(self.obj1819, '_setHierarchicalLink')):
            self.obj1819._setHierarchicalLink(False)

        # MaxFlow
        self.obj1819.MaxFlow.setNone()

        # price
        self.obj1819.price.setValue(0)

        # Name
        self.obj1819.Name.setValue('')
        self.obj1819.Name.setNone()

        # ReqFlow
        self.obj1819.ReqFlow.setNone()

        self.obj1819.GGLabel.setValue(1)
        self.obj1819.graphClass_ = graph_metarial
        if parent.genGraphics:
            new_obj = graph_metarial(180.0, 40.0, self.obj1819)
            new_obj.layConstraints = dict()  # Graphical Layout Constraints
            new_obj.layConstraints['scale'] = [1.0, 1.0]
        else:
            new_obj = None
        self.obj1819.graphObject_ = new_obj
        self.obj18190 = AttrCalc()
        self.obj18190.Copy = ATOM3Boolean()
        self.obj18190.Copy.setValue(('Copy from LHS', 1))
        self.obj18190.Copy.config = 0
        self.obj18190.Specify = ATOM3Constraint()
        self.obj18190.Specify.setValue(
            ('AttrSpecify', (['Python', 'OCL'], 0),
             (['PREcondition', 'POSTcondition'], 1), ([
                 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT',
                 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE'
             ], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), None))
        self.obj1819.GGset2Any['MaxFlow'] = self.obj18190
        self.obj18191 = AttrCalc()
        self.obj18191.Copy = ATOM3Boolean()
        self.obj18191.Copy.setValue(('Copy from LHS', 1))
        self.obj18191.Copy.config = 0
        self.obj18191.Specify = ATOM3Constraint()
        self.obj18191.Specify.setValue(
            ('AttrSpecify', (['Python', 'OCL'], 0),
             (['PREcondition', 'POSTcondition'], 1), ([
                 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT',
                 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE'
             ], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), None))
        self.obj1819.GGset2Any['Name'] = self.obj18191
        self.obj18192 = AttrCalc()
        self.obj18192.Copy = ATOM3Boolean()
        self.obj18192.Copy.setValue(('Copy from LHS', 1))
        self.obj18192.Copy.config = 0
        self.obj18192.Specify = ATOM3Constraint()
        self.obj18192.Specify.setValue(
            ('AttrSpecify', (['Python', 'OCL'], 0),
             (['PREcondition', 'POSTcondition'], 1), ([
                 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT',
                 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE'
             ], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), None))
        self.obj1819.GGset2Any['ReqFlow'] = self.obj18192

        # Add node to the root: self.RHS
        self.RHS.addNode(self.obj1819)
        self.obj1819.postAction(self.RHS.CREATE)

    def condition(self, graphID, isograph, atom3i):
        return self.graphRewritingSystem.finalStat > 20

    def action(self, graphID, isograph, atom3i):
        # If you want to apply this rule at most once on asingle host graph node,
        # then uncomment the next two lines. Change the default GG label (1) if needed.

        # Make sure to enable the CONDITION code as well
        # And to use the same label & unique name in the ACTION
        # WARNING: _uniqueName503 is not guaranteed to be unique (so change it, be safe!)

        #node = self.getMatched(graphID, self.LHS.nodeWithLabel(1))
        #node._uniqueName503 = True
        pass
Пример #27
0
                              mPR, mPS)
                gpsData = GPS.readGPS()
                Motor.motor(mPL, mPR, 0.1, 1)
            Motor.motor(0, 0, 1)
            print("Running Phase Finished")
            IM920.Send("P7F")

        # ------------------- GoalDetection Phase ------------------- #
        if (phaseChk <= 8):
            Other.saveLog(phaseLog, "8", "GoalDetection Phase Started",
                          time.time() - t_start)
            print("Goal Detection Phase Started")
            IM920.Send("P8S")
            while goalFlug != 0 or goalBuf != 0:
                gpsdata = GPS.readGPS()
                goalFlug, goalArea, goalGAP, photoName = Goal.Togoal(
                    photopath, H_min, H_max, S_thd, mp_min, mp_max, mp_adj)
                goalBuf = goalFlug
                print("goal is", goalFlug)
                Other.saveLog(goalDetectionLog,
                              time.time() - t_start, gpsData, goalFlug,
                              goalArea, goalGAP, photoName)
                Other.saveLog(captureLog, time.time() - t_start, photoName)
            print("Goal Detection Phase Finished")
            IM920.Send("P8F")

        print("Program Finished")
        IM920.Send("P10")
        Other.saveLog(phaseLog, "10", "Program Finished",
                      time.time() - t_start)
        close()
    except KeyboardInterrupt:
    # Defining world dimensions
    xlim = 500
    ylim = 500
    world_size = (xlim, ylim)

    # Initializing blank canvas(OpenCV) with white color
    image = np.ones((world_size[1], world_size[0], 3), dtype=np.uint8) * 255

    # Defining agent and goal
    aPosx = 200
    aPosy = 50
    agent = Agent(Position(aPosx, aPosy), scan_radius=10, possible_moves=30)
    Matlab_agent_x = aPosx
    Matlab_agent_y = ylim - aPosy
    goal = Goal(Position(250, 450),
                sigma=math.sqrt(world_size[0]**2 + world_size[1]**2))

    # Defining obstacles in a list
    sigma_obstacles = 5
    obstacles = [
        Obstacle(Position(150, 180),
                 sigma=sigma_obstacles,
                 draw_radius=4 * sigma_obstacles),
        Obstacle(Position(150, 280),
                 sigma=sigma_obstacles,
                 draw_radius=4 * sigma_obstacles),
        Obstacle(Position(150, 380),
                 sigma=sigma_obstacles,
                 draw_radius=4 * sigma_obstacles),
        Obstacle(Position(250, 180),
                 sigma=sigma_obstacles,
Пример #29
0
    def loadLevel(self, levelNumber):       
        f = open("rsc/levels/level"+str(levelNumber)+".lvl", 'r')
        lines = f.readlines()
        f.close()
        
        """
        print lines
        print "________________________"
        
        for line in lines:
            print line
        print "________________________"
        """
        newlines = []
        for line in lines:
            newline = ""
            for c in line:
                if c != '\n':
                    newline += c
            newlines += [newline]
            
        lines = newlines
        
        for line in lines:
            print line
        print "________________________"
        
        for y,line in enumerate(lines):
            for x,c in enumerate(line):
                if c == '#':
                    Wall([x*self.tileSize + self.tileSize/2,
                         y*self.tileSize + self.tileSize/2],
                         self.tileSize)
                
                if c == 'G':
                    Ground([x*self.tileSize + self.tileSize/2,
                         y*self.tileSize + self.tileSize/2],
                         self.tileSize)
                         
                if c == 'P':
                    player = PlayerMeme(self.size, 7,
                                    [x*self.tileSize + self.tileSize/2,
                                     y*self.tileSize + self.tileSize/2])
                    Arm(player)
                
                if c == 'm':
                    Meme(self.size, 1, 
                        [random.randint(7, 10), random.randint(7, 10)],
                        [x*self.tileSize + self.tileSize/2,
                         y*self.tileSize + self.tileSize/2],
                        random.randint(20, 100))
				
                if c == 'Q':
                    Wall_5x5([x*self.tileSize + self.tileSize/2,
                        y*self.tileSize + self.tileSize/2],
                        self.tileSize)
                        
                if c == '1': 
                    GunPickup("health",
                           [x*self.tileSize + self.tileSize/2,
                            y*self.tileSize + self.tileSize/2],
                            self.tileSize)
                                
                if c == "$":
                    self.goal = Goal([x*self.tileSize + self.tileSize/2,
                                          y*self.tileSize + self.tileSize/2],
                                          self.tileSize)
                if c == '2': 
                    BossMeme(self.size,
                            [x*self.tileSize + self.tileSize/2,
                            y*self.tileSize + self.tileSize/2],
                            self.tileSize)
                if c == '3':
					EndFlag([x*self.tileSize + self.tileSize/2,
                                          y*self.tileSize + self.tileSize/2],
                                          self.tileSize)
Пример #30
0
from Player import *
from Scoreboard import *
pygame.init()

clock = pygame.time.Clock()

width = 1000
height = 700
size = width, height
screen = pygame.display.set_mode(size)
bgColor = r, g, b = 0, 128, 33
bgImage = pygame.image.load("Images/field/fieldfull.png")
bgRect = bgImage.get_rect()

ball = Ball(size, [40, 40])
rGoal = Goal("right", size)
lGoal = Goal("left", size)
p1 = Playerball("right", size, [70, 70])
p2 = Playerball("left", size, [70, 70])
rScore = Scoreboard([width / 2 + 50, 25], "right")
lScore = Scoreboard([width / 2 - 50, 25], "left")

mode = "menu"

while True:
    while mode == "menu":
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                sys.exit()
            if event.type == pygame.KEYDOWN:
                mode = "game"
Пример #31
0
def followork():
    welcome()
    s = sys.stdin.readline().strip()
    if s.startswith("-l"):
        for f in os.listdir("currentGoals/"):
            if f.endswith(".txt"):
                print (os.path.splitext(f)[0])
        print
        print "Which project would you like to choose?"
        s = sys.stdin.readline().strip()
    goal = Goal(s)
    actions()
    s1 = ""
    while s1 != "quit":
        s1 = sys.stdin.readline().strip()
        if s1 == "add":
            v = int(input())
            goal.add(v)
            print "Value added"
            print
        elif s1 == "addo":
            d, v = sys.stdin.readline().split()
            goal.add_otherDay(d, int(v))
            print "Value added"
            print
        elif s1 == "show":
            goal.statistics()
            goal.plot()
        elif s1 == "firstDay":
            d = sys.stdin.readline().strip()
            goal.set_firsday(d)
            print "Date set."
            print
Пример #32
0
    def checkForStimulation (self, gp):
        #check for stimulations
        #left wall
        if self.intersect (self.leftWall[0], self.leftWall[1], \
                self.startPoint, self.endPoint) is not None:
            self.currentColor = self.sensorStimulatedColor
            distance = self.distance(self.getIntersect(self.leftWall[0], self.leftWall[1],\
                self.startPoint, self.endPoint)[0])
            self.wallStimulations.append(distance)
        #right wall
        elif self.intersect (self.rightWall[0], self.rightWall[1], \
                self.startPoint, self.endPoint) is not None:
            self.currentColor = self.sensorStimulatedColor
            distance = self.distance(self.getIntersect(self.rightWall[0], self.rightWall[1],\
                self.startPoint, self.endPoint)[0])
            self.wallStimulations.append(distance)
        #upper wall
        elif self.intersect (self.upperWall[0], self.upperWall[1], \
                self.startPoint, self.endPoint) is not None:
            self.currentColor = self.sensorStimulatedColor
            distance = self.distance(self.getIntersect(self.upperWall[0], self.upperWall[1],\
                self.startPoint, self.endPoint)[0])
            self.wallStimulations.append(distance)
        else:
            self.currentColor = self.sensorNeutralColor
            self.wallStimulations.append(self.nonStimulated) #arbitrarily large num
        #any player stimulations
        encounteredPlayer = False #true if we encountered a player
        for player in gp.playersNodes:
            #the rect of the player
            playerRect = pygame.Rect (player.getRect())
            #bottom edge intersection
            if self.intersect (playerRect.bottomleft, playerRect.bottomright, \
                    self.startPoint, self.endPoint) is not None:
                self.currentColor = self.sensorStimulatedColor
                distance = self.distance(self.getIntersect(playerRect.bottomleft, playerRect.bottomright,\
                    self.startPoint, self.endPoint)[0])
                self.playerStimulations.append(distance)
                encounteredPlayer = True
            #left edge intersection
            elif self.intersect (playerRect.topleft, playerRect.bottomleft, \
                    self.startPoint, self.endPoint) is not None:
                self.currentColor = self.sensorStimulatedColor
                distance = self.distance(self.getIntersect(playerRect.topleft, playerRect.bottomleft,\
                    self.startPoint, self.endPoint)[0])
                self.playerStimulations.append(distance)
                encounteredPlayer = True
            #right edge intersection
            elif self.intersect (playerRect.bottomright, playerRect.topright, \
                    self.startPoint, self.endPoint) is not None:
                self.currentColor = self.sensorStimulatedColor
                distance = self.distance(self.getIntersect(playerRect.bottomright, playerRect.topright,\
                    self.startPoint, self.endPoint)[0])
                self.playerStimulations.append(distance)
                encounteredPlayer = True
        if not encounteredPlayer:
            self.playerStimulations.append(self.nonStimulated) #arbitrarily large

        #goal box stimulation
        gRect = Goal.asRect() #for easier reference
        #bottom boundary
        if self.intersect (gRect.bottomleft, gRect.bottomright, \
                self.startPoint, self.endPoint) is not None:
            self.currentColor = self.sensorStimulatedColor
            distance = self.distance(self.getIntersect(gRect.bottomleft, gRect.bottomright,\
                    self.startPoint, self.endPoint)[0])
            self.goalStimulations.append(distance)
        #left edge intersection
        elif self.intersect (gRect.topleft, gRect.bottomleft, \
                self.startPoint, self.endPoint) is not None:
            self.currentColor = self.sensorStimulatedColor
            distance = self.distance(self.getIntersect(gRect.topleft, gRect.bottomleft,\
                self.startPoint, self.endPoint)[0])
            self.goalStimulations.append(distance)
        #right edge intersection
        elif self.intersect (gRect.bottomright, gRect.topright, \
                self.startPoint, self.endPoint) is not None:
            self.currentColor = self.sensorStimulatedColor
            distance = self.distance(self.getIntersect(gRect.bottomright, gRect.topright,\
                self.startPoint, self.endPoint)[0])
            self.goalStimulations.append(distance)
        else:
            self.goalStimulations.append(self.nonStimulated) #arbitrarily large num
        
        #all the lists joined into one inputs
        return self.wallStimulations + self.playerStimulations + self.goalStimulations