Commit c34bb9e8 authored by Maxime DEBUREAU's avatar Maxime DEBUREAU
Browse files

Version 1.0 du programme, avec les premières fonctions

parent 81532470
import numpy as np
import time
# database plateau
# H = barriere en Haut, G gauche, D droite, B bas, on écrit tjrs dans l'ordre HGDB,
# Cas partculiers pour V = vide, K = Korner ("intouchable")
List_1A = [['HG', 'H', 'H', 'H', 'H', 'HD', 'HG', 'H'],
['G', 'V', 'V', 'V', 'V', 'V', 'V', 'V'],
['G', 'B', 'V', 'V', 'V', 'V', 'V', 'V'],
['GD', 'HG', 'V', 'V', 'V', 'V', 'V', 'V'],
['G', '', 'V', 'V', 'V', 'V', 'DB', 'G'],
['GB', 'V', 'B', 'V', 'V', 'V', 'H', 'V'],
['HG', 'V', 'HD', 'GB', 'V', 'V', 'V', 'B'],
['G', 'V', 'V', 'H', 'V', 'V', 'D', 'K']]
List_1B = [['HG', 'HD', 'HG', 'HB', 'H', 'H', 'H', 'H'],
['G', 'V', 'D', 'HG', 'V', 'V', 'V', 'V'],
['G', 'V', 'V', 'V', 'V', 'V', 'V', 'V'],
['G', 'V', 'V', 'V', 'V', 'V', 'DB', 'G'],
['GD', 'GB', 'V', 'V', 'V', 'V', 'H', 'V'],
['G', 'H', 'V', 'V', 'B', 'V', 'V', 'V'],
['GB', 'V', 'V', 'V', 'HD', 'G', 'V', 'B'],
['HG', 'V', 'V', 'V', 'V', 'V', 'D', 'K']]
List_2A = [['HG', 'H', 'HD', 'HG', 'H', 'H', 'H', 'H'],
['G', 'V', 'V', 'V', 'V', 'V', 'B', 'V'],
['G', 'V', 'V', 'V', 'V', 'DB', 'HG', 'V'],
['G', 'V', 'V', 'V', 'V', 'H', 'V', 'V'],
['G', 'V', 'V', 'V', 'V', 'V', 'V', 'V'],
['GD', 'GB', 'V', 'V', 'V', 'V', 'V', 'V'],
['GB', 'H', 'V', 'V', 'B', 'V', 'V', 'B'],
['HG', 'V', 'V', 'V', 'HD', 'G', 'D', 'K']]
List_2B = [['HG', 'H', 'H', 'H', 'H', 'HD', 'HG', 'H'],
['G', 'V', 'V', 'B', 'V', 'V', 'V', 'V'],
['G', 'V', 'D', 'HG', 'V', 'V', 'V', 'V'],
['GB', 'V', 'B', 'V', 'D', 'GB', 'V', 'V'],
['HG', 'V', 'HD', 'G', 'V', 'H', 'V', 'V'],
['GD', 'GB', 'V', 'V', 'V', 'V', 'V', 'V'],
['GB', 'H', 'V', 'V', 'B', 'V', 'V', 'B'],
['HG', 'V', 'V', 'V', 'HD', 'G', 'D', 'K']]
List_4A = [['HG', 'HD', 'HG', 'HB', 'H', 'H', 'H', 'H'],
['G', 'V', 'D', 'HG', 'V', 'V', 'V', 'V'],
['G', 'V', 'V', 'V', 'V', 'V', 'V', 'V'],
['G', 'V', 'V', 'V', 'V', 'V', 'DB', 'G'],
['GD', 'GB', 'V', 'V', 'V', 'V', 'H', 'V'],
['G', 'H', 'V', 'V', 'B', 'V', 'V', 'V'],
['GB', 'V', 'V', 'V', 'HD', 'G', 'V', 'B'],
['HG', 'V', 'V', 'V', 'V', 'V', 'D', 'K']]
List_P_Plat = [List_1A,List_1B,List_2A,List_2B,List_4A]
def quart_droit_p_plateau(p_plat):
p_plat = np.array(p_plat)
p_plat = np.rot90(p_plat, 3)
print("rotation", p_plat)
for i in range(8):
for j in range(8):
if p_plat[i][j] == 'G':
p_plat[i][j] = 'H'
elif p_plat[i][j] == 'H':
p_plat[i][j] = 'D'
elif p_plat[i][j] == 'D':
p_plat[i][j] = 'B'
elif p_plat[i][j] == 'B':
p_plat[i][j] = 'G'
elif p_plat[i][j] == 'HG':
p_plat[i][j] = 'HD'
elif p_plat[i][j] == 'HD':
p_plat[i][j] = 'DB'
elif p_plat[i][j] == 'DB':
p_plat[i][j] = 'GB'
elif p_plat[i][j] == 'GB':
p_plat[i][j] = 'HG'
elif p_plat[i][j] == 'HB':
p_plat[i][j] = 'GD'
elif p_plat[i][j] == 'GD':
p_plat[i][j] = 'HB'
print("iteration", p_plat)
print("rotation + transfo", p_plat)
return (p_plat)
def former_plateau (List_P_Plat):
l = np.random.sample(range(len(List_P_Plat),4))
print(l)
# List_formation_plateau = [List_P_Plat[l[0]],List_P_Plat[l[1]],List_P_Plat[l[2]],List_P_Plat[l[3]]]
# List_formation_plateau = np.random.sample(List_P_Plat,4)
np.random.shuffle(List_formation_plateau)
p_plat_1, p_plat_2, p_plat_3, p_plat_4 = List_formation_plateau[0], List_formation_plateau[1], List_formation_plateau[2], List_formation_plateau[3]
print(p_plat_1, p_plat_2, p_plat_3, p_plat_4)
p_plat_1 = np.array(p_plat_1)
p_plat_2 = quart_droit_p_plateau(p_plat_2)
p_plat_3 = quart_droit_p_plateau(quart_droit_p_plateau(p_plat_3))
p_plat_4 = quart_droit_p_plateau(quart_droit_p_plateau(quart_droit_p_plateau(p_plat_4)))
A = concatenate(p_plat_1,p_plat_2, axis = 1)
B = concatenate(p_plat_4,p_plat_3, axis = 1)
C = concatenate(A,B,axis=0)
print(C)
former_plateau(List_P_Plat)
#
# P_Plat_1B = np.array(List_1B)
# P_Plat_1B_R = quart_droit_p_plateau(P_Plat_1B)
# This is a sample Python script.
# Press Maj+F10 to execute it or replace it with your code.
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.
def print_hi(name):
# Use a breakpoint in the code line below to debug your script.
print(f'Hi, {name}') # Press Ctrl+F8 to toggle the breakpoint.
# Press the green button in the gutter to run the script.
if __name__ == '__main__':
print_hi('PyCharm')
# See PyCharm help at https://www.jetbrains.com/help/pycharm/
#Programme principal et son organisation générale
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment