1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- ##############
- # Barriere : #
- ##############
- def barriere_symetrie_verticale(plateau, barriere) :
- sym = barriere.copie()
- sym.x = plateau.lg - 2 - sym.x
- return sym
- def barriere_symetrie_horizontale(plateau, barriere) :
- sym = barriere.copie()
- sym.y = plateau.ht - 2 - sym.y
- return sym
- ##########
- # Coup : #
- ##########
- def coup_symetrie_verticale(plateau, coup) :
- sym = coup.copie()
-
- if sym.type == "M" :
- (x,y) = sym.case
- sym.case = (x, plateau.lg - 1 - y)
- else :
- sym.barriere = barriere_symetrie_verticale(plateau, sym.barriere)
- return sym
-
- def coup_symetrie_horizontale(plateau, coup) :
- sym = coup.copie()
-
- if sym.type == "M" :
- (x,y) = sym.case
- sym.case = (x, plateau.ht - 1 - y)
- else :
- sym.barriere = barriere_symetrie_horizontale(plateau, sym.barriere)
- return sym
-
- #############
- # Plateau : #
- #############
- def plateau_symetrie_verticale(plateau) :
- sym = plateau.copie_complete()
- for i in range(2) :
- sym.pions[i][0] = sym.lg - 1 - sym.pions[i][0]
- for b in sym.liste_barrieres :
- b.x = sym.lg - 2 - b.x
- return sym
- def plateau_symetrie_horizontale(plateau) :
- sym = plateau.copie_complete()
- (sym.barrieres_restantes[1], sym.barrieres_restantes[0]) = (sym.barrieres_restantes[0], sym.barrieres_restantes[1])
- sym.tour = 1 - sym.tour
- for num in (0,1) :
- sym.barrieres_restantes[num] = plateau.barrieres_restantes[1 - num]
- sym.pions[num][0] = plateau.pions[1 - num][0]
- sym.pions[num][1] = sym.ht - 1 - plateau.pions[1 - num][1]
- for b in sym.liste_barrieres :
- b.y = sym.ht - 2 - b.y
- return sym
|