コード例 #1
0
def getAllPotentialMatches(node, t2Nodes, lang, index1, rec=True):
    potentialMatches = []
    unmatchedNodes = []

    for node2 in t2Nodes:
        if not node2["matched"]:
            unmatchedNodes.append(node2)

    adlStrNodes = (node2 for node2 in t2Nodes
                   if additionalStructure(node2, lang))
    for adlStrNode in adlStrNodes:
        #print("adding children of", adlStrNode["tags"])
        if not "children" in adlStrNode: continue
        editChildren(adlStrNode)
        unmatchedChildren = (child for child in adlStrNode["children"]
                             if not child["matched"])
        unmatchedNodes += unmatchedChildren

    index2 = 0
    for node2 in unmatchedNodes:
        confidence = confidenceOfMatch(node, node2, node["parent"],
                                       node2["parent"], lang, rec, index1,
                                       index2)
        if not confidence == -1:
            potentialMatches.append(match.Match(node2, confidence))

        index2 += 1

    return potentialMatches
コード例 #2
0
def main(file1, file2, color, dispMin, dispMax):
    # load two images
    imgLeft = cv2.imread(file1)
    imgRight = cv2.imread(file2)

    # Default parameters
    K = -1
    lambda_ = -1
    lambda1 = -1
    lambda2 = -1
    params = match.Parameters(is_L2=True,
                              denominator=1,
                              edgeThresh=8,
                              lambda1=lambda1,
                              lambda2=lambda2,
                              K=K,
                              maxIter=4)

    # create match instance
    m = match.Match(imgLeft, imgRight, color)

    m.SetDispRange(dispMin, dispMax)
    m = match.fix_parameters(m, params, K, lambda_, lambda1, lambda2)
    m.kolmogorov_zabih()
    m.saveDisparity("./results/disparity1.jpg")
コード例 #3
0
ファイル: manager.py プロジェクト: MetalBlueberry/Halite-II
    def run_round(self, contestants, width, height, seed):
        m = match.Match(contestants, width, height, seed,
                        2 * len(contestants) * max_match_rounds(width, height),
                        self.keep_replays, self.keep_logs)
        print(m)
        try:
            m.run_match(self.halite_binary)
            print(m)
            self.save_players(contestants)
            self.db.update_player_ranks()
            self.db.add_match(m)
            self.show_ranks()
        except Exception as e:
            print("Exception in run_round:")
            print(e)

        try:
            s3 = boto3.resource('s3')

            object = s3.Object('halite2', m.replay_file)
            object.put(Body=open(m.replay_file, 'rb'))

            for key, filename in m.logs.items():
                object = s3.Object('halite2', filename)
                object.put(Body=open(filename, 'rb'))

        except Exception as e:
            print(m.logs)
            print("Exception uploading logs to s3")
            print(e)
コード例 #4
0
    def __init__(self):
        """Constructor Function

        Aqcuires and assembles all matches into match objects"""
        self.matches = []
        self.database_name = "scouting_system"
        self.db = database.Database("localhost", 27017)
        comp_matches = self.db.find_documents("scouting_system", "matches")
        for comp_match in comp_matches:
            self.matches.append(
                match.Match(
                    comp_match["team_number"],
                    comp_match["num_balls"],
                    comp_match["alliance_color"],
                    comp_match["match_num"],
                ))
        self.teams = []
        teams = self.db.find_documents("scouting_system", "teams", {})
        for comp_team in teams:
            self.teams.append(
                team.Team(
                    comp_team["team_number"],
                    comp_team["team_name"],
                    comp_team["rookie_year"],
                ))
コード例 #5
0
ファイル: sportsbet.py プロジェクト: matteosantama/odds-are
    def extract_match(self, tbody):
        day_month_year = tbody.find_previous_sibling(
            'tbody', class_='date expanded').text.split(' - ')[0].strip()
        time = tbody.find('td', class_='col_time').text.strip()
        date_string = day_month_year + ' ' + time
        # convert to datetime object and adjust timezone
        date = dt.strptime(date_string,
                           '%A, %b %d, %Y %I:%M %p') - timedelta(hours=1)

        away_data = tbody.find('tr', class_='firstline')
        home_data = tbody.find('tr', class_='otherline')

        home = home_data.find('td', class_='col_teamname').contents[0]
        away = away_data.find('td', class_='col_teamname').contents[0]

        # not ideal but will do for now
        if home.strip() == 'St. Louis Cardinals':
            home = 'Saint Louis Cardinals'
        if away.strip() == 'St. Louis Cardinals':
            away = 'Saint Louis Cardinals'

        hodds = home_data.find('td', class_='moneylineodds').string
        aodds = away_data.find('td', class_='moneylineodds').string

        hodds = (-sys.maxsize - 1) if hodds is None else hodds
        aodds = (-sys.maxsize - 1) if aodds is None else aodds

        site = 'sportsbetting.ag'
        m = match.Match(home, away, hodds, aodds, site, site, date)

        return m
コード例 #6
0
ファイル: xbet.py プロジェクト: matteosantama/odds-are
    def extract_match(self, html, sport):
        # get the day of the week and day number in the form 'Sep 09'
        parent = html.find_parent('div', class_='myb-sportbook__tab-pane')
        month = parent.find('h4',
                            class_='header-game').text.strip().split(' - ')[-1]
        time = html.find('span', class_='myb-sportbook__date').text.strip()
        # check if the game is in the following year
        yr = (dt.today().year +
              1) if (dt.today().year == 12
                     and month[:3] == 'Jan') else dt.today().year
        # construct date string in format 'Sep 09 2018 SUN4:25 PM' and adjust timezone
        date_string = '%s %d %s' % (month, yr, time)
        date = dt.strptime(date_string,
                           '%b %d %Y %a%I:%M %p') - timedelta(hours=1)

        # html parsing filters
        search_filter = {'data-wager-type': 'ml'}
        afilter = 'myb-sportbook__row-first-team'
        hfilter = 'myb-sportbook__row-second-team'

        hhtml = html.find('div', hfilter).find('button', attrs=search_filter)
        ahtml = html.find('div', afilter).find('button', attrs=search_filter)

        # lookup team in dictionary if sport is baseball
        home = self.teams[hhtml['data-team'].lower(
        )] if sport == 'baseball' else hhtml['data-team']
        away = self.teams[ahtml['data-team'].lower(
        )] if sport == 'baseball' else ahtml['data-team']

        site = 'xbet.ag'

        m = match.Match(home, away, hhtml['data-odds'], ahtml['data-odds'],
                        site, site, date)
        # return an individual match
        return m
コード例 #7
0
 def __init__(self):
     self.i = 0
     self.match = match.Match()
     self.bridge =cv_bridge.CvBridge()
     #cv2.namedWindow("window",1)
     #image_sub = rospy.Subscriber('arm_sensor/camera/image_raw', Image, self.image_callback)
     image_sub = rospy.Subscriber('front_center_camera/image_raw/compressed', CompressedImage, self.image_callback)
コード例 #8
0
ファイル: intertops.py プロジェクト: matteosantama/odds-are
    def extract_match(self, row):
        # *_tag is a variable that contains the three letter code and pitcher for each team
        away_tag = row.find('div', class_='ustop').text.strip()
        home_tag = row.find('div', class_='usbot').text.strip()

        # when odds are updated, the title attribute gets renamed 'data-original-title'
        aodds = row.find('div', {'title': away_tag})
        if aodds is None:
            aodds = row.find('div', {'data-original-title': away_tag})
        hodds = row.find('div', {'title': home_tag})
        if hodds is None:
            hodds = row.find('div', {'data-original-title': home_tag})

        try:
            aodds = aodds.text.strip()
            hodds = hodds.text.strip()
        except AttributeError:
            aodds = -sys.maxsize - 1
            hodds = -sys.maxsize - 1

        # convert team tags into universal team names
        home, away = self.get_team_names(home_tag, away_tag)

        date = self.parse_date(row)
        site = 'intertops.eu'
        m = match.Match(home, away, hodds, aodds, site, site, date)

        return m
コード例 #9
0
 def simMatch(self,home_team_name,away_team_name):
     home_team=self.teams[home_team_name]
     away_team=self.teams[away_team_name]
     match=m.Match(home_team,away_team)
     match.showResult()
     self.updateTable(match)
     pass
コード例 #10
0
def stereoMatching(R1, R2, mi, ma):
    """Compute disparity mapping between two rectified images, using Kolmogorov and Zabih's graph cuts stereo matching algorithm."""
    """
    We found that the quality of disparity map obtained by OpenCV StereoSGBM is depend
    strongly the choice of parameters. So we implement the method based on paper:
    Kolmogorov and zabih’sgraph cuts stereo matching algorithm, Pauline Tan Vladimir Kolmogorov, Pascal Monasse.
    It suffice to set a good disparity range [Min, Max].
    Attention: with this python version implementation, this method is very slow, so to quickly have a result,
    we force here the images used can't be larger than 200*200
    """
    K = -1
    lambda_ = -1
    lambda1 = -1
    lambda2 = -1
    params = match.Parameters(is_L2=True,
                              denominator=1,
                              edgeThresh=8,
                              lambda1=lambda1,
                              lambda2=lambda2,
                              K=K,
                              maxIter=4)
    # create match instance
    is_color = True if R1.shape[-1] == 3 else False
    m = match.Match(R1, R2, is_color)
    m.SetDispRange(mi, ma)
    m = match.fix_parameters(m, params, K, lambda_, lambda1, lambda2)
    disparity = m.kolmogorov_zabih()

    return disparity
コード例 #11
0
    def generate_match(self, m_no, comp_1, comp_2, r_no):
        if comp_1 != None:
            comp_1.matched = True

        if comp_2 != None:
            comp_2.matched = True
        return match.Match(m_no, comp_1, comp_2, r_no)
コード例 #12
0
    def __init__(self, config_file=None):
        self.config = get_config(config_file)
        self.match = match.Match(self, **self.config.get('match'))
        self.vision = vision.FiraVision()
        self.comm = comm.FiraComm()
        self.referee = comm.RefereeComm()

        self.use_referee = self.config.get('referee')

        self.start()
コード例 #13
0
ファイル: simulator.py プロジェクト: saveliyvasilev/301060
	def _build_instance_group_matches(self, group_name):
		ms = []
		for fixture_match in fd.group_pairs[group_name]:
			if fixture_match in self._known_group_pairs:
				known_match = next(km for km in self._group_matches if {km.team1, km.team2} == fixture_match)
				ms.append(match.Match.from_match(known_match))
			else:
				it = iter(fixture_match)
				ms.append(match.Match(next(it), next(it)))
		return ms
コード例 #14
0
ファイル: test_match.py プロジェクト: spena64/Project-S.U.M.O
def test_move_player_2():
    match_obj = match.Match()
    match_obj.add_player('0000', [400, 400], 0.25, 30, 1)
    match_obj.add_player('0001', [400, 400], 0.25, 30, 1)
    match_thread = threading.Thread(target=match_obj.run_game_loop, daemon=True)
    match_thread.start()
    match_obj.set_player_input('0000', -1, -1)
    time.sleep(0.05)
    assert match_obj.get_player_state('0000')["x"] < 400
    assert match_obj.get_player_state('0000')["y"] < 400
コード例 #15
0
 def addMatch(self,
              red1,
              red2,
              red3,
              blue1,
              blue2,
              blue3,
              redWinProbability=.5):
     self.matches.append(
         match.Match(red1, red2, red3, blue1, blue2, blue3,
                     redWinProbability))
コード例 #16
0
ファイル: manager.py プロジェクト: wizzup/Halite-III
 def run_round(self, contestants, width, height, seed):
     m = match.Match(contestants, width, height, seed, 2 * len(contestants) * max_match_rounds(width, height), self.keep_replays, self.keep_logs)
     print(m)
     try:
         m.run_match(self.halite_binary)
         print(m)
         self.save_players(contestants)
         self.db.update_player_ranks()
         self.db.add_match(m)
         self.show_ranks()
     except Exception as e:
         print("Exception in run_round:")
         print(e)
コード例 #17
0
    def _update_matches(self):
        """Updates matches in the match list

        Returns None"""
        self.matches = []
        comp_matches = self.db.find_documents("scouting_system", "matches")
        for comp_match in comp_matches:
            self.matches.append(
                match.Match(
                    comp_match["team_number"],
                    comp_match["num_balls"],
                    comp_match["alliance_color"],
                    comp_match["match_num"],
                ))
コード例 #18
0
class TestMatchResult(unittest.TestCase):
    """A set of unit tests to exercise the match.Match class. The MatchResult 
    class gets exercised a lot above, so we'll implement only a basic test
    of the members of the class.
    """
    med1 = ParsedMedication(TestFunctions.medString1, mappings)
    med2a = ParsedMedication(TestFunctions.medString2, mappings)
    med2b = ParsedMedication(TestFunctions.medString2, mappings)
    med3 = ParsedMedication(TestFunctions.medString3, mappings)
    rec_med = match.Match(med2a, med2b)
    basic_match_result = match.MatchResult([med1], [med3], [rec_med])
    test_objects = test_match_objects['TestMatchResult']

    def test_basic(self):
        "Basic test of MatchResult functionality."
        self.assertEqual(self.basic_match_result, self.test_objects['basic_match_result'])
コード例 #19
0
    def test(self):
        m = match.Match(GameMock)

        self.assertIsInstance(m.game, GameMock)

        player_info = m.join_player()
        self.assertEqual(player_info["player"], "A")
        self.assertEqual(player_info["id"], m.id.__str__())

        with self.assertRaises(Exception) as ar:
            m.join_player()
        self.assertEqual(ar.exception.message, "Can not join")

        with self.assertRaises(Exception) as ar:
            m.make_turn("00000000-0000-0000-0000-000000000000", "a", "b", "c")
        self.assertEqual(ar.exception.args,
                         ("You must join this match first", m.id))
コード例 #20
0
    def recordMatch(self, player1Name, player1Score, player2Name,
                    player2Score):
        game = match.Match()

        game.record_score(player1Name, player1Score)
        game.record_score(player2Name, player2Score)

        self.get_player_by_name(player1Name).add_match_to_history(game)
        self.get_player_by_name(player2Name).add_match_to_history(game)

        ranks = self.get_league_rankings(player1Name, player2Name)

        scores = game.get_match_results()
        updated_elo = ranking.apply_multiplayer_updates(scores, ranks)

        for name, newElo in updated_elo.items():
            self.update_elo(name, newElo)

        self.update_league_rankings()
コード例 #21
0
    def updates(self):
        """ Retrieve client's updates.

        ..note:: Updates also include matches and messages information.

        :rtype: dict

        """

        glbl.LOG.debug(
            ('retrieving user `{}` (self) updates ...').format(self.id))

        resp = requests.post(glbl.API_UPDATES_URL, headers=self._header)
        if resp.status_code == 200:
            retn = resp.json()
            retn['matches'] = [match.Match(i) for i in retn['matches']]
            return retn
        raise exceptions.TinderRetrievalException(
            ('could not retrieve user `{}` (self) updates from `{}`, {}'
             ).format(self.id, glbl.API_UPDATES_URL, resp.text))
コード例 #22
0
 def load_group_matches(cls):
     try:
         mdb_client = MongoClient('mongodb://localhost:27017/')
         db = mdb_client.worldcup18
         collection = db.group_matches
         qms = collection.find()
         ms = [
             match.Match(team1=q["team1"],
                         team2=q["team2"],
                         goals1=q["goals1"],
                         goals2=q["goals2"],
                         knockout=q["knockout"],
                         winner=q["winner"] if "winner" in q else None,
                         id=q["id"] if "id" in q else None) for q in qms
         ]
         mdb_client.close()
         return ms
     except Exception as e:
         logger.exception("Error loading group matches.")
         sys.exit()
コード例 #23
0
ファイル: gui.py プロジェクト: Wright4TheJob/PiKwonDo
    def __init__(self, pkd):
        """Create main window elements."""
        self.program_loaded = False
        super().__init__()
        self.main_process = pkd
        self.match = match.Match()
        self.time = 90
        self.penalty_bar_height = 50
        self.time_height = 100

        # GUI sizing parameters
        self.blue_penalty_text = ''
        self.red_penalty_text = ''
        self.height = None
        self.time_string = ''
        self.width = None
        self.centralwidget = None
        self.setup_ui(self)

        self.program_loaded = True
コード例 #24
0
ファイル: bookmaker.py プロジェクト: matteosantama/odds-are
    def extract_match(self, html):
        visitor_html = html.find('div', class_='vTeam')
        home_html = html.find('div', class_='hTeam')

        visitor = next(
            visitor_html.find('div', class_='team').h3.stripped_strings)
        vodds = visitor_html.find('div', class_='money').span.span
        if vodds is not None:
            vodds = int(vodds.text)
        else:
            vodds = -sys.maxsize - 1

        home = next(home_html.find('div', class_='team').h3.stripped_strings)
        hodds = home_html.find('div', class_='money').span.span
        if hodds is not None:
            hodds = int(hodds.text)
        else:
            hodds = -sys.maxsize - 1

        date = self.parse_date(html)
        site = 'bookmaker.eu'

        m = match.Match(home, visitor, hodds, vodds, site, site, date)
        return m
コード例 #25
0
def matchNodes(node1, node2, conf):
    #print("matching nodes", node1["tags"], "and", node2["tags"])
    node1["matched"] = True
    node2["matched"] = True
    node1["match"] = match.Match(node2, conf)
    node2["match"] = match.Match(node1, conf)
コード例 #26
0
ファイル: test_match.py プロジェクト: yantiantianlx/DFI4image
import argparse
import match



if __name__=='__main__':

  # configure by command-line arguments
  parser=argparse.ArgumentParser(description='Generate high resolution face transformations.',formatter_class=argparse.ArgumentDefaultsHelpFormatter)
  parser.add_argument('--method',type=str,default='facehair', help='older,younger,facehair,female,eyeglasses')
  parser.add_argument('--input',type=str,default='tests/1.jpg',help='input color image')
  parser.add_argument('--K',type=int,default=100,help='number of nearest neighbors')
  config=parser.parse_args()

  # load models
  mt=match.Match()

  # Set the free parameters
  K=config.K
  X=config.input

  # classifier scores
  XA=mt.predict_scores([X])[0]
  #print(XA)

  # positive and negative constraints
  fields = mt.fields
  gender = fields.index('Male')
  smile = fields.index('Smiling')
  if config.method=='older':
    cP=[(gender,XA[gender]>=0),(smile,XA[smile]>=0),(fields.index('Young'),True)]
コード例 #27
0
ファイル: test_match.py プロジェクト: nhsland/MedRec
class TestMatch(unittest.TestCase):
    """A set of unit tests to exercise the match.Match class.
    """
    medString1 = 'Mirapex 0.5 MG Tablet;TAKE 1 TABLET 3 TIMES DAILY.; Rx'
    medString1b = 'Mirapex 0.5 MG Tablet;TAKE 2 TABLETS 3 TIMES DAILY.; Rx'
    medString2 = 'Pramipexole 0.5 MG Tablet;TAKE 1 TABLET 3 TIMES DAILY.; Rx'
    medString2a = 'PRAMIPEXOLE 0.5 MG TABLET;take 1 tablet 3 times daily.; rx'
    medString2b = 'PRAMIPEXOLE 0.5 MG TABLET;take 2 tablets 3 times daily.; rx'
    med1 = ParsedMedication(medString1, mappings)
    med1b = ParsedMedication(medString1b, mappings)
    med2 = ParsedMedication(medString2, mappings)
    med2a = ParsedMedication(medString2a, mappings)
    med2b = ParsedMedication(medString2b, mappings)
    test_objects = None
    if test_match_objects:
        test_objects = test_match_objects['TestMatch']
    # Match objects used in testing below
    matched_by_string = match.Match(med1, med2, 0.5, "MATCH_STRING")
    matched_by_brand_name = match.Match(med1, med2, 0.8, "MATCH_BRAND_NAME")
    matched_by_ingredients = match.Match(med1, med2, 0.9, "MATCH_INGREDIENTS")
    matched_by_treatment = match.Match(med1, med2, 0.5,
                                       "MATCH_TREATMENT_INTENT")
    matched_unspecified = match.Match(med1, med2, 0.1)
    matched_potential1 = match.Match(med1, med2, 0.5)
    matched_identical1 = match.Match(med2a, med2, 0.5)
    matched_potential2 = match.Match(med2, med1, 0.5)
    matched_identical2 = match.Match(med2, med2a, 0.5)
    matched_potential3 = match.Match(med1, med2, 0.4)
    matched_identical3 = match.Match(med2a, med2, 0.4)
    matched_potential4 = match.Match(med1b, med2, 0.5)
    matched_potential4_rev = match.Match(med2, med1b, 0.5)
    matched_identical4 = match.Match(med2a, med2, 0.5)

    @unittest.skipUnless(test_objects, 'missing test_match data')
    def test_potential_match_eq1(self):
        "Test that a newly-instantiated potential match is equivalent to our baseline."
        self.assertEqual(self.matched_potential1,
                         self.test_objects['matched_potential'])

    @unittest.skipUnless(test_objects, 'missing test_match data')
    def test_potential_match_eq2(self):
        "Test that a newly-instantiated potential match with meds in reverse order is equivalent to our baseline."
        self.assertEqual(self.matched_potential2,
                         self.test_objects['matched_potential'])

    @unittest.skipUnless(test_objects, 'missing test_match data')
    def test_potential_match_ne1(self):
        "Test that a newly-instantiated potential match is not equivalent to our baseline (certainty differs)."
        self.assertNotEqual(self.matched_potential3,
                            self.test_objects['matched_potential'])

    @unittest.skipUnless(test_objects, 'missing test_match data')
    def test_potential_match_ne2(self):
        "Test that a newly-instantiated potential match is not equivalent to our baseline (dosage differs)."
        self.assertNotEqual(self.matched_potential4,
                            self.test_objects['matched_potential'])

    @unittest.skipUnless(test_objects, 'missing test_match data')
    def test_potential_match_ne3(self):
        "Test that a newly-instantiated potential match with meds in reverse order is not equivalent to our baseline."
        self.assertNotEqual(self.matched_potential4_rev,
                            self.test_objects['matched_potential'])

    @unittest.skipUnless(test_objects, 'missing test_match data')
    def test_identical_match_eq1(self):
        "Test that a newly-instantiated identical match is equivalent to our baseline."
        self.assertEqual(self.matched_identical1,
                         self.test_objects['matched_identical'])

    @unittest.skipUnless(test_objects, 'missing test_match data')
    def test_identical_match_eq2(self):
        "Test that a newly-instantiated identical match with meds in reverse order is equivalent to our baseline."
        self.assertEqual(self.matched_identical2,
                         self.test_objects['matched_identical'])

    @unittest.skipUnless(test_objects, 'missing test_match data')
    def test_by_string_dictionary(self):
        "Test that the dictionary from a by-string match is as we expect."
        self.assertEqual(
            rmIdsFromMatchDict(self.matched_by_string.as_dictionary()),
            rmIdsFromMatchDict(
                self.test_objects['matched_by_string'].as_dictionary()))

    @unittest.skipUnless(test_objects, 'missing test_match data')
    def test_by_brand_name_dictionary(self):
        "Test that the dictionary from a by-brand-name match is as we expect."
        self.assertEqual(
            rmIdsFromMatchDict(self.matched_by_brand_name.as_dictionary()),
            rmIdsFromMatchDict(
                self.test_objects['matched_by_brand_name'].as_dictionary()))

    @unittest.skipUnless(test_objects, 'missing test_match data')
    def test_by_ingredients_dictionary(self):
        "Test that the dictionary from a by-ingredients match is as we expect."
        self.assertEqual(
            rmIdsFromMatchDict(self.matched_by_ingredients.as_dictionary()),
            rmIdsFromMatchDict(
                self.test_objects['matched_by_ingredients'].as_dictionary()))

    @unittest.skipUnless(test_objects, 'missing test_match data')
    def test_by_treatment_dictionary(self):
        "Test that the dictionary from a by-treatment match is as we expect."
        self.assertEqual(
            rmIdsFromMatchDict(self.matched_by_treatment.as_dictionary()),
            rmIdsFromMatchDict(
                self.test_objects['matched_by_treatment'].as_dictionary()))

    @unittest.skipUnless(test_objects, 'missing test_match data')
    def test_unspecified_dictionary(self):
        "Test that a dictionary from a match by unspecified mechanism is as we expect."
        self.assertEqual(
            rmIdsFromMatchDict(self.matched_unspecified.as_dictionary()),
            rmIdsFromMatchDict(
                self.test_objects['matched_unspecified'].as_dictionary()))
コード例 #28
0
def store_worldcup():
    # A
    MatchLoader.store_group_match(match.Match("RUS", "KSA", 5, 0))
    MatchLoader.store_group_match(match.Match("EGY", "URU", 0, 1))
    MatchLoader.store_group_match(match.Match("RUS", "EGY", 3, 1))
    MatchLoader.store_group_match(match.Match("URU", "KSA", 1, 0))
    MatchLoader.store_group_match(match.Match("URU", "RUS", 3, 0))
    MatchLoader.store_group_match(match.Match("KSA", "EGY", 2, 1))
    # # B
    MatchLoader.store_group_match(match.Match("ESP", "POR", 3, 3))
    MatchLoader.store_group_match(match.Match("MAR", "IRN", 0, 1))
    MatchLoader.store_group_match(match.Match("MAR", "POR", 0, 1))
    MatchLoader.store_group_match(match.Match("IRN", "ESP", 0, 1))
    # MatchLoader.store_group_match(match.Match("IRN", "POR", 0, 0))
    # MatchLoader.store_group_match(match.Match("MAR", "ESP", 0, 0))
    # # C
    MatchLoader.store_group_match(match.Match("AUS", "FRA", 1, 2))
    MatchLoader.store_group_match(match.Match("PER", "DEN", 0, 1))
    MatchLoader.store_group_match(match.Match("PER", "FRA", 0, 1))
    MatchLoader.store_group_match(match.Match("AUS", "DEN", 1, 1))
    # MatchLoader.store_group_match(match.Match("FRA", "DEN", 0, 0))
    # MatchLoader.store_group_match(match.Match("AUS", "PER", 0, 1))
    # # D
    MatchLoader.store_group_match(match.Match("ICE", "ARG", 1, 1))
    MatchLoader.store_group_match(match.Match("NGA", "CRO", 0, 2))
    MatchLoader.store_group_match(match.Match("CRO", "ARG", 3, 0))
    MatchLoader.store_group_match(match.Match("ICE", "NGA", 0, 2))
    # MatchLoader.store_group_match(match.Match("NGA", "ARG", 0, 0))
    # MatchLoader.store_group_match(match.Match("ICE", "CRO", 0, 0))
    # # E
    MatchLoader.store_group_match(match.Match("SWI", "BRA", 1, 1))
    MatchLoader.store_group_match(match.Match("CRC", "SRB", 0, 1))
    MatchLoader.store_group_match(match.Match("BRA", "CRC", 2, 0))
    MatchLoader.store_group_match(match.Match("SWI", "SRB", 2, 1))
    # MatchLoader.store_group_match(match.Match("BRA", "SRB", 0, 0))
    # MatchLoader.store_group_match(match.Match("SWI", "CRC", 0, 0))
    # # F
    MatchLoader.store_group_match(match.Match("MEX", "GER", 1, 0))
    MatchLoader.store_group_match(match.Match("KOR", "SWE", 0, 1))
    MatchLoader.store_group_match(match.Match("SWE", "GER", 1, 2))
    MatchLoader.store_group_match(match.Match("KOR", "MEX", 1, 2))
    # MatchLoader.store_group_match(match.Match("KOR", "GER", 0, 0))
    # MatchLoader.store_group_match(match.Match("SWE", "MEX", 0, 0))
    # # G
    MatchLoader.store_group_match(match.Match("PAN", "BEL", 0, 3))
    MatchLoader.store_group_match(match.Match("ENG", "TUN", 2, 1))
    MatchLoader.store_group_match(match.Match("TUN", "BEL", 2, 5))
    MatchLoader.store_group_match(match.Match("ENG", "PAN", 6, 1))
    # MatchLoader.store_group_match(match.Match("ENG", "BEL", 2, 0))
    # MatchLoader.store_group_match(match.Match("PAN", "TUN", 0, 0))
    # # H
    MatchLoader.store_group_match(match.Match("POL", "SEN", 1, 2))
    MatchLoader.store_group_match(match.Match("COL", "JPN", 1, 2))
    MatchLoader.store_group_match(match.Match("COL", "POL", 3, 0))
    MatchLoader.store_group_match(match.Match("JPN", "SEN", 2, 2))
コード例 #29
0
ファイル: main.py プロジェクト: EevaDev/squares
        clock.tick(30)
        ## HANDLE EVENTS
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                pygame.quit()
                sys.exit(0)
            else:
                state = cur_screen.handle_event(event)

        ## UPDATE GAME
        state = cur_screen.update(state)

        # Change state/screen if necessary
        if old_state != state:
            if state == STATE_MENU:
                cur_screen = start_menu.StartMenu(screen)
            elif state == STATE_MOVES:
                cur_screen = match.Match(screen, MODE_MOVE)
            elif state == STATE_TIME:
                cur_screen = match.Match(screen, MODE_TIME)
            elif state == STATE_RESULT:
                score = cur_screen.get_score()
                cur_screen = start_menu.EndMenu(screen, score)
            elif state == STATE_EXIT:
                pygame.quit()
                sys.exit(0)
        old_state = state

        ## DRAW SCREEN
        cur_screen.draw()
コード例 #30
0
        grSim = psl.SSLgrSimClient('127.0.0.1', 20011)
        grSim.connect()
        sim = grSim
        print('Connexion au simulateur OK')
    else:
        print('Sans grSim')
        sim = None

#%%Création match
    '''parametre disp :
        -1 : aucun affichage
         0 : affichage dans la console des changements de postes
         1 : affichage dans un plot des status des robots
         2 : affichage dans un plot du terrain avec les robots et leur status'''

    match_test = match.Match('test', vision, sim, communication, disp=2)

    fig, ax, axbackground, text = affichage.init(match_test.disp)
    t_list = [time.time()]

    #%%Boucle
    while not quit:

        #test interruption crtl+C pour arrêter tous les robots
        try:

            if match_test.disp > 0:
                fig.canvas.restore_region(axbackground)

            #Lecture des commandes deouis la manette
            if manette: