Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
41d8036710
BIN
MPSI/obligatoire/TP_BDD/TP BDD.pdf
Normal file
BIN
MPSI/obligatoire/TP_BDD/TP BDD.pdf
Normal file
Binary file not shown.
22152
MPSI/obligatoire/TP_BDD/mondial-mysql.sql
Normal file
22152
MPSI/obligatoire/TP_BDD/mondial-mysql.sql
Normal file
File diff suppressed because it is too large
Load Diff
12
MPSI/obligatoire/TP_GoL/Pipfile
Normal file
12
MPSI/obligatoire/TP_GoL/Pipfile
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
[[source]]
|
||||||
|
name = "pypi"
|
||||||
|
url = "https://pypi.org/simple"
|
||||||
|
verify_ssl = true
|
||||||
|
|
||||||
|
[dev-packages]
|
||||||
|
|
||||||
|
[packages]
|
||||||
|
pygame = "*"
|
||||||
|
|
||||||
|
[requires]
|
||||||
|
python_version = "3.7"
|
53
MPSI/obligatoire/TP_GoL/Pipfile.lock
generated
Normal file
53
MPSI/obligatoire/TP_GoL/Pipfile.lock
generated
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
{
|
||||||
|
"_meta": {
|
||||||
|
"hash": {
|
||||||
|
"sha256": "e172a3e30534a9a0b74742497b40f2ab196a0890d1cb082eb481fb89e384456e"
|
||||||
|
},
|
||||||
|
"pipfile-spec": 6,
|
||||||
|
"requires": {
|
||||||
|
"python_version": "3.7"
|
||||||
|
},
|
||||||
|
"sources": [
|
||||||
|
{
|
||||||
|
"name": "pypi",
|
||||||
|
"url": "https://pypi.org/simple",
|
||||||
|
"verify_ssl": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"default": {
|
||||||
|
"pygame": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:0480fe82cd41a43e3eea497fa2c059c72ac54cb5d003d5aa2ed06a04541c384e",
|
||||||
|
"sha256:136a3b5711d9ec369a0407e4e08ffced3ba61aa41059e9280ffffa79c8614f65",
|
||||||
|
"sha256:2622b9dd95f445c887a36a57eade42c672598589f69a8052ccdb8eeeffa4dbb1",
|
||||||
|
"sha256:301c6428c0880ecd4a9e3951b80e539c33863b6ff356a443db1758de4f297957",
|
||||||
|
"sha256:396320aa29a925feed0b64639f77ce1418722ea7f536b4e4936083dd8d4c4535",
|
||||||
|
"sha256:398c42b605ecc514e62f68f1944a2d21e247938309f598de6cb0ad3c207324a8",
|
||||||
|
"sha256:4aaff572a273a32e70ec3593d213e59ab11c183a9916616562247930f17a5447",
|
||||||
|
"sha256:4e1065577f1b29111113be5deb2ea88553551a5e1cf33e0c08fa32768f285809",
|
||||||
|
"sha256:5f052dc2975a399aa1830c1f04c5f72856aa416bf3cd4b31375a058015a5c620",
|
||||||
|
"sha256:68ea43e51150316b9fb08e251209d4e2b4e76a340b5b6fc8cdf1a898c78f7e5b",
|
||||||
|
"sha256:698433a9fcefca0527244dc44dff9503eb26157494730b1cc80e6e4dbb246e92",
|
||||||
|
"sha256:6f714986f7987f10cb94f1be0753318e341a7ea6b12d66f37a4d5d6dd4695023",
|
||||||
|
"sha256:73cd9df328c7e72638dbcc1d18e7155225faed880a53db6bad90d1d7c0a71dfd",
|
||||||
|
"sha256:7876d1f29f66d3d7cac46479503891ee1ef409b0fbce54b0d74f3a6b33a46dba",
|
||||||
|
"sha256:854e87b8b2b76e3ed11d64985fcfdd7af919659503de99fc2b0a717b314c3cf0",
|
||||||
|
"sha256:8da13704ad45b7d5de8a8cca135a7f44c7fc6aa9f691abe7b0392468a34a8013",
|
||||||
|
"sha256:9ce22fb72298ea33dbb3a1c6c60a4a4e19d9698df6f3f5782eba4dada7b7736d",
|
||||||
|
"sha256:a37b6c59e7b8feadc51db5197052b86ceb6443f9fb2a6f7d6527620e707c558c",
|
||||||
|
"sha256:a6e8d2f99dbe1dfe72d0c019693c14d93c410f702d0b04ec9a81b36dacd55a23",
|
||||||
|
"sha256:a9ac862dd7159861f2c6443b0029089e1c0c4ec762a8074022914ec52fe4dfac",
|
||||||
|
"sha256:ae1bc3e78ed28f20878e7ca2c98663a6634e9c00d7746d39413fc18e907dc162",
|
||||||
|
"sha256:be7e70f91bd4eb35ae081062f16bf434619b3292358d9b061f8159ddc570c7f0",
|
||||||
|
"sha256:c895cf9c1b6d1cbba8cb8cc3f5427febcf8aa41a9333697741abeea1c537a350",
|
||||||
|
"sha256:e3e7e4a09dfd8b03663222d6bcadec9fef021404f4d9eecf56825342e039dfc1",
|
||||||
|
"sha256:f1f5714d2c23f6a64ef2ac4fcd36a2dd2689da85978d951a99a6ae5dfdf9bdbc",
|
||||||
|
"sha256:fa788f775680fc5d268ab00a2da29c9a22830032cfab732730298a2952cd87f3"
|
||||||
|
],
|
||||||
|
"index": "pypi",
|
||||||
|
"version": "==1.9.6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"develop": {}
|
||||||
|
}
|
26
MPSI/obligatoire/TP_GoL/README
Normal file
26
MPSI/obligatoire/TP_GoL/README
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
Le simulateur utilise pygame, pour l'installer :
|
||||||
|
pip install pygame
|
||||||
|
une fois fait, pour lancer le simulateur, executez le main.py en tant que script (Ca permet à Pyzo de lancer le script dans le bon dossier)
|
||||||
|
|
||||||
|
Comment l'utiliser :
|
||||||
|
|
||||||
|
Les touches :
|
||||||
|
PARTOUT :
|
||||||
|
ESPACE : Met en pause le jeu
|
||||||
|
C : Diminuer la fréquence de mise à jour des cellules
|
||||||
|
V : Augmenter la fréquence de mise à jour des cellules
|
||||||
|
Q : Quitter
|
||||||
|
Suppr : Effacer la grille
|
||||||
|
D : Activer le mode débogage (Affiche les compteurs des cellules à l'itération précédente)
|
||||||
|
M : Basculer en mode Clavier / Basculer en mode Souris
|
||||||
|
Mode Souris :
|
||||||
|
Clic gauche : Changer l'état de la cellule selectionnée (rester appuyé pour en changer plusieurs)
|
||||||
|
Clic droit / Clic molette (glisser) : Changer la zone visible de la grille
|
||||||
|
Molette vers le haut : Zoomer
|
||||||
|
Molette vers le bas : Dézoomer
|
||||||
|
Mode Clavier :
|
||||||
|
Touches directionnelles (Flèches) : Déplacer le pointeur (cadre jaune)
|
||||||
|
T : changer l'état de la cellule selectionnée
|
||||||
|
|
||||||
|
À propos :
|
||||||
|
La grille est infinie, et par défaut, le mode souris est activé. Le mode clavier est incomplet mais permet de faire des actions basique.
|
BIN
MPSI/obligatoire/TP_GoL/assets/alive_cell.png
Normal file
BIN
MPSI/obligatoire/TP_GoL/assets/alive_cell.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 756 B |
BIN
MPSI/obligatoire/TP_GoL/assets/alive_cell.xcf
Normal file
BIN
MPSI/obligatoire/TP_GoL/assets/alive_cell.xcf
Normal file
Binary file not shown.
BIN
MPSI/obligatoire/TP_GoL/assets/cell.xcf
Normal file
BIN
MPSI/obligatoire/TP_GoL/assets/cell.xcf
Normal file
Binary file not shown.
BIN
MPSI/obligatoire/TP_GoL/assets/dead_cell.png
Normal file
BIN
MPSI/obligatoire/TP_GoL/assets/dead_cell.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 753 B |
BIN
MPSI/obligatoire/TP_GoL/assets/dead_cell.xcf
Normal file
BIN
MPSI/obligatoire/TP_GoL/assets/dead_cell.xcf
Normal file
Binary file not shown.
BIN
MPSI/obligatoire/TP_GoL/assets/highlight.png
Normal file
BIN
MPSI/obligatoire/TP_GoL/assets/highlight.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 831 B |
BIN
MPSI/obligatoire/TP_GoL/assets/highlight.xcf
Normal file
BIN
MPSI/obligatoire/TP_GoL/assets/highlight.xcf
Normal file
Binary file not shown.
274
MPSI/obligatoire/TP_GoL/main.py
Normal file
274
MPSI/obligatoire/TP_GoL/main.py
Normal file
@ -0,0 +1,274 @@
|
|||||||
|
import pygame
|
||||||
|
import time
|
||||||
|
import sys
|
||||||
|
import random
|
||||||
|
"""
|
||||||
|
Game of Life Simulator
|
||||||
|
"""
|
||||||
|
|
||||||
|
#Partie Calculatoire
|
||||||
|
RULES = {"B":3, "O":3, "U":2}
|
||||||
|
NEIGHBOURS = [(i,j) for i in (-1,0,1) for j in (-1,0,1) if (i,j) != (0,0)]
|
||||||
|
|
||||||
|
def relative(offset, cell):
|
||||||
|
"""
|
||||||
|
Fonction permettant d'obtenir une coordonnée absolue à partir d'une origine(offset) et de coordonnées relative(cell).
|
||||||
|
"""
|
||||||
|
return tuple(cell[i] + offset[i] for i in range(len(cell)))
|
||||||
|
|
||||||
|
def difference(origin, cell):
|
||||||
|
"""
|
||||||
|
Fonction permettant d'obtenir les coordonnées de cell en fixant origin comme origine
|
||||||
|
"""
|
||||||
|
return tuple(cell[i] - origin[i] for i in range(len(cell)))
|
||||||
|
|
||||||
|
def scale(cell, factor):
|
||||||
|
return tuple(int(cell[i]*factor) for i in range(len(cell)))
|
||||||
|
class Grid:
|
||||||
|
"""
|
||||||
|
Classe gérant les calculs liés à l'évolution d'une grille infinie selon le Jeu de la vie
|
||||||
|
"""
|
||||||
|
def __init__(self):
|
||||||
|
self.alive_cells = set({(i, 0) for i in range(500)})
|
||||||
|
self.active_cells = dict()
|
||||||
|
self.old_cells = set()
|
||||||
|
|
||||||
|
def tick(self):
|
||||||
|
self.old_cells.clear()
|
||||||
|
self.old_cells.update(self.alive_cells)
|
||||||
|
self.active_cells.clear()
|
||||||
|
#On s'assure que les cellules vivantes soient considérés comme actives
|
||||||
|
for cell in self.alive_cells:
|
||||||
|
self.active_cells.update({cell:0})
|
||||||
|
#On met à jour les voisins des cellules vivantes, c'est à dire incrémenter leur compteur
|
||||||
|
for cell in self.alive_cells:
|
||||||
|
for neighbour in NEIGHBOURS:
|
||||||
|
self.incr_counter(relative(cell, neighbour))
|
||||||
|
#On applique les règles du jeu selon le compteur des cellules actives
|
||||||
|
for cell in self.active_cells:
|
||||||
|
if RULES["U"] <= self.active_cells[cell] <= RULES["O"]:
|
||||||
|
if self.active_cells[cell] == RULES["B"]:
|
||||||
|
self.alive_cells.add(cell)
|
||||||
|
else:
|
||||||
|
self.alive_cells.discard(cell)
|
||||||
|
|
||||||
|
|
||||||
|
def incr_counter(self, cell):
|
||||||
|
if cell in self.active_cells:
|
||||||
|
self.active_cells[cell] +=1
|
||||||
|
else:
|
||||||
|
self.active_cells.update({cell:1})
|
||||||
|
|
||||||
|
|
||||||
|
#Interface Graphique
|
||||||
|
|
||||||
|
pygame.init()
|
||||||
|
size = width, height = 1025,1025
|
||||||
|
screen = pygame.display.set_mode(size, flags=pygame.RESIZABLE)
|
||||||
|
DEBUG = False #Affichage de variables de débogage à l'écran
|
||||||
|
TICK_RATE = 10 #Fréquence de rafraîchissement du jeu
|
||||||
|
FRAME_RATE = 60 #Fréquence de rafraîchissement de l'interface
|
||||||
|
camera = [0, 0] #Permettant choisir quelle zone de la grille on visualise
|
||||||
|
true_camera = camera
|
||||||
|
MOUSE = True #Mode souris : On pointe avec les cellules avec la souris et pas les flèches directionnelles
|
||||||
|
grid = Grid() #On initialise une grille
|
||||||
|
#On charge les assets
|
||||||
|
source_assets = {
|
||||||
|
"alive_cell": pygame.image.load("assets/alive_cell.png"),
|
||||||
|
"dead_cell": pygame.image.load("assets/dead_cell.png"),
|
||||||
|
"highlight": pygame.image.load("assets/highlight.png")}
|
||||||
|
|
||||||
|
SCALE = .25 #Facteur de taille variable (zoom)
|
||||||
|
CELL_SIDE = int(source_assets["highlight"].get_rect().width * SCALE) #Mesure en pixel d'un côté d'une cellule
|
||||||
|
assets = {asset:pygame.transform.scale(source_assets[asset],(CELL_SIDE,CELL_SIDE)) for asset in source_assets}
|
||||||
|
font = pygame.font.SysFont(pygame.font.get_default_font(), CELL_SIDE)
|
||||||
|
class Unit(pygame.sprite.Sprite):
|
||||||
|
"""
|
||||||
|
Classe représentant une unité d'affichage (cellule)
|
||||||
|
Il est à noter que cette unité peut représenter différentes cellules en fonction de camera
|
||||||
|
"""
|
||||||
|
def __init__(self, offset):
|
||||||
|
super().__init__()
|
||||||
|
self.offset = offset
|
||||||
|
|
||||||
|
def draw(self, screen, camera, grid):
|
||||||
|
self.image = assets[("dead_cell","alive_cell")[relative(camera, self.offset) in grid.alive_cells]]
|
||||||
|
self.position = self.image.get_rect()
|
||||||
|
self.position.x = self.offset[0]*CELL_SIDE #On positionne la cellule sur l'écran
|
||||||
|
self.position.y = self.offset[1]*CELL_SIDE #On positionne la cellule sur l'écran
|
||||||
|
screen.blit(self.image, self.position) #On dessine la cellule
|
||||||
|
if DEBUG and relative(camera, self.offset) in grid.active_cells:
|
||||||
|
text = font.render(str(grid.active_cells[relative(camera, self.offset)]), False, (0,255,0))
|
||||||
|
posi = text.get_rect()
|
||||||
|
posi.center = self.position.center
|
||||||
|
screen.blit(text, posi)
|
||||||
|
|
||||||
|
class Pointer(pygame.sprite.Sprite):
|
||||||
|
"""
|
||||||
|
Classe représentant le pointeur de cellule sélectionnée (pour l'éditer)
|
||||||
|
"""
|
||||||
|
def __init__(self, pos):
|
||||||
|
super().__init__()
|
||||||
|
self.pos = pos
|
||||||
|
|
||||||
|
def draw(self, screen, camera, grid):
|
||||||
|
self.image = assets["highlight"]
|
||||||
|
self.position = self.image.get_rect()
|
||||||
|
self.position.x = self.pos[0]*CELL_SIDE #On positionne le pointeur sur l'écran
|
||||||
|
self.position.y = self.pos[1]*CELL_SIDE #On positionne le pointeur sur l'écran
|
||||||
|
screen.blit(self.image, self.position) #On dessine le pointeur
|
||||||
|
|
||||||
|
def draw_grid(screen, camera, grid, units):
|
||||||
|
for unit in units:
|
||||||
|
units[unit].draw(screen, camera, grid)
|
||||||
|
|
||||||
|
#Boucle principale
|
||||||
|
def get_units():
|
||||||
|
return {(i,j):Unit((i,j)) for i in range(width//(CELL_SIDE) +1) for j in range(height//(CELL_SIDE) +1)}
|
||||||
|
units = get_units() #Liste de cellules à afficher à l'écran
|
||||||
|
relatives = {unit:relative(camera, unit) for unit in units}
|
||||||
|
pointer = Pointer((0,0)) #Permettant de sélectionner une cellule précisément pour l'éditer
|
||||||
|
running = True
|
||||||
|
pause = True
|
||||||
|
last_tick = time.time()
|
||||||
|
last_frame = time.time()
|
||||||
|
KEYSDOWN = set()
|
||||||
|
MOUSEBUTTONSDOWN = set()
|
||||||
|
visited_cells = set()
|
||||||
|
drag_origin = (0,0) #Position du curseur à la préssion du bouton du milieu de la souris
|
||||||
|
last_pointer_move = time.time()
|
||||||
|
redraw = True
|
||||||
|
while running:
|
||||||
|
frame = (last_frame + 1/FRAME_RATE) - time.time() < 0
|
||||||
|
if frame:
|
||||||
|
for event in pygame.event.get():
|
||||||
|
if event.type == pygame.VIDEORESIZE:
|
||||||
|
size = width, height = event.size
|
||||||
|
screen =screen = pygame.display.set_mode(size,
|
||||||
|
flags=pygame.RESIZABLE)
|
||||||
|
units = get_units()
|
||||||
|
redraw = True
|
||||||
|
if event.type == pygame.QUIT:
|
||||||
|
sys.exit()
|
||||||
|
if event.type == pygame.KEYDOWN:
|
||||||
|
KEYSDOWN.add(event.key)
|
||||||
|
if event.key in [275,276,273,274] and not MOUSE: #Touches directionnelles pour déplacer le pointeur
|
||||||
|
new_pos = list(pointer.pos)
|
||||||
|
exec("new_pos" + ("[0]+","[0]-","[1]-","[1]+")[[275,276,273,274].index(event.key)] + "=1")
|
||||||
|
if pointer.pos in units: units[pointer.pos].draw(screen, camera, grid)
|
||||||
|
pointer.pos = tuple(new_pos)
|
||||||
|
last_pointer_move = time.time()
|
||||||
|
if event.key == 116 and not MOUSE: #T: Changer l'état d'une cellule
|
||||||
|
if relative(camera, pointer.pos) in grid.alive_cells:
|
||||||
|
grid.alive_cells.discard(relative(camera, pointer.pos))
|
||||||
|
else:
|
||||||
|
grid.alive_cells.add(relative(camera, pointer.pos))
|
||||||
|
visited_cells.add(relative(camera, pointer.pos))
|
||||||
|
if event.type == pygame.KEYUP:
|
||||||
|
print(event.key)
|
||||||
|
if event.key in KEYSDOWN:
|
||||||
|
if event.key == 32: #ESPACE : pause
|
||||||
|
pause = not pause
|
||||||
|
if event.key in (109,59): #M : Mode souris
|
||||||
|
MOUSE = not MOUSE
|
||||||
|
if event.key == 100: #D : Mode de déboggage
|
||||||
|
DEBUG = not DEBUG
|
||||||
|
if event.key in (113,97): #Q : Quitter
|
||||||
|
sys.exit()
|
||||||
|
if event.key == 127: #Suppr : Effacer la grille
|
||||||
|
grid.alive_cells.clear()
|
||||||
|
redraw = True
|
||||||
|
if event.key == 99: #C: Diminuer le TICK_RATE
|
||||||
|
TICK_RATE = TICK_RATE/2
|
||||||
|
if event.key == 118: #V : Augmenter le TICK_RATE
|
||||||
|
TICK_RATE = TICK_RATE*2
|
||||||
|
if event.key == 116 and not MOUSE: #T: Changer l'état d'une cellule
|
||||||
|
visited_cells.clear()
|
||||||
|
if event.key == 114 : #R : Remplir aléatoirement l'écran
|
||||||
|
redraw = True
|
||||||
|
for unit in units:
|
||||||
|
if random.randint(0,3) == 0:
|
||||||
|
grid.alive_cells.add(relatives[unit])
|
||||||
|
else:
|
||||||
|
grid.alive_cells.discard(relatives[unit])
|
||||||
|
KEYSDOWN.discard(event.key)
|
||||||
|
if event.type == pygame.MOUSEBUTTONDOWN:
|
||||||
|
if MOUSE:
|
||||||
|
if event.button in (2,3): #Bouton de la molette / Clic droit : Glisser
|
||||||
|
print(event.pos)
|
||||||
|
true_camera = camera
|
||||||
|
drag_origin = event.pos
|
||||||
|
if event.button == 1: #Clic gauche : Éditer la cellule selectionnée
|
||||||
|
if relative(camera, pointer.pos) in grid.alive_cells:
|
||||||
|
grid.alive_cells.discard(relative(camera, pointer.pos))
|
||||||
|
else:
|
||||||
|
grid.alive_cells.add(relative(camera, pointer.pos))
|
||||||
|
visited_cells.add(relative(camera, pointer.pos))
|
||||||
|
MOUSEBUTTONSDOWN.add(event.button)
|
||||||
|
if event.type == pygame.MOUSEBUTTONUP:
|
||||||
|
if event.button in (2,3):
|
||||||
|
camera = difference(scale(difference(drag_origin, event.pos), 1/CELL_SIDE), true_camera)
|
||||||
|
redraw = True
|
||||||
|
if event.button == 1:
|
||||||
|
visited_cells.clear()
|
||||||
|
if event.button == 4: #Molette vers le haut #Zoom
|
||||||
|
if CELL_SIDE*2 <= min(size):
|
||||||
|
SCALE *= 2 #Facteur de taille variable (zoom)
|
||||||
|
CELL_SIDE = int(source_assets["highlight"].get_rect().width * SCALE) #Mesure en pixel d'un côté d'une cellule
|
||||||
|
assets = {asset:pygame.transform.scale(source_assets[asset],(CELL_SIDE,CELL_SIDE)) for asset in source_assets}
|
||||||
|
units = get_units() #Liste de cellules à afficher à l'écran
|
||||||
|
font = pygame.font.SysFont(pygame.font.get_default_font(), CELL_SIDE)
|
||||||
|
redraw = True
|
||||||
|
if event.button == 5: #Molette vers le bas #"Dézoom"
|
||||||
|
if CELL_SIDE/2 >= 3:
|
||||||
|
SCALE *= 1/2 #Facteur de taille variable (zoom)
|
||||||
|
CELL_SIDE = int(source_assets["highlight"].get_rect().width * SCALE) #Mesure en pixel d'un côté d'une cellule
|
||||||
|
assets = {asset:pygame.transform.scale(source_assets[asset],(CELL_SIDE,CELL_SIDE)) for asset in source_assets}
|
||||||
|
units = get_units() #Liste de cellules à afficher à l'écran
|
||||||
|
font = pygame.font.SysFont(pygame.font.get_default_font(), CELL_SIDE)
|
||||||
|
redraw = True
|
||||||
|
print(event.button)
|
||||||
|
MOUSEBUTTONSDOWN.discard(event.button)
|
||||||
|
if event.type == pygame.MOUSEMOTION:
|
||||||
|
if 2 in MOUSEBUTTONSDOWN or 3 in MOUSEBUTTONSDOWN:
|
||||||
|
camera = difference(scale(difference(drag_origin, event.pos), 1/CELL_SIDE),true_camera)
|
||||||
|
redraw = True
|
||||||
|
if MOUSE:
|
||||||
|
if pointer.pos in units: units[pointer.pos].draw(screen, camera, grid)
|
||||||
|
pointer.pos = scale(event.pos, 1/CELL_SIDE)
|
||||||
|
if 1 in MOUSEBUTTONSDOWN:
|
||||||
|
if pointer.pos in units: units[pointer.pos].draw(screen, camera, grid)
|
||||||
|
pointer.pos = scale(event.pos, 1/CELL_SIDE)
|
||||||
|
if relative(camera, pointer.pos) not in visited_cells:
|
||||||
|
if relative(camera, pointer.pos) in grid.alive_cells:
|
||||||
|
grid.alive_cells.discard(relative(camera, pointer.pos))
|
||||||
|
else:
|
||||||
|
grid.alive_cells.add(relative(camera, pointer.pos))
|
||||||
|
visited_cells.add(relative(camera, pointer.pos))
|
||||||
|
if not MOUSE and (time.time() - (last_pointer_move + 5/FRAME_RATE) > 0):
|
||||||
|
for key in KEYSDOWN:
|
||||||
|
if key in [275,276,273,274]:
|
||||||
|
new_pos = list(pointer.pos)
|
||||||
|
exec("new_pos" + ("[0]+","[0]-","[1]-","[1]+")[[275,276,273,274].index(event.key)] + "=1")
|
||||||
|
if pointer.pos in units: units[pointer.pos].draw(screen, camera, grid)
|
||||||
|
pointer.pos = tuple(new_pos)
|
||||||
|
last_pointer_move = time.time()
|
||||||
|
if redraw:
|
||||||
|
relatives = {unit:relative(camera, unit) for unit in units}
|
||||||
|
draw_grid(screen, camera, grid, units)
|
||||||
|
redraw = False
|
||||||
|
if (last_tick + 1/TICK_RATE) - time.time() < 0:
|
||||||
|
last_tick = time.time()
|
||||||
|
if not pause:
|
||||||
|
grid.tick()
|
||||||
|
if True:
|
||||||
|
for unit in units:
|
||||||
|
if (relatives[unit] in grid.alive_cells) != (relatives[unit] in grid.old_cells):
|
||||||
|
units[unit].draw(screen, camera, grid)
|
||||||
|
if frame:
|
||||||
|
if pointer.pos in units:
|
||||||
|
units[pointer.pos].draw(screen, camera, grid)
|
||||||
|
pointer.draw(screen, camera, grid)
|
||||||
|
pygame.display.flip()
|
||||||
|
last_frame = time.time()
|
||||||
|
time.sleep(max(0,min((last_frame + 1/FRAME_RATE) - time.time(), (last_tick + 1/TICK_RATE) - time.time()))) #On attend avant la prochaine image / le prochain tick pour ne pas surcharger le CPU inutilement
|
684
MPSI/spe/cours/chemins
Normal file
684
MPSI/spe/cours/chemins
Normal file
@ -0,0 +1,684 @@
|
|||||||
|
0 -> 1 en 1. :
|
||||||
|
0 -> 1
|
||||||
|
0 -> 0 -> 1
|
||||||
|
0 -> 1 -> 1
|
||||||
|
0 -> 0 -> 1 -> 1
|
||||||
|
|
||||||
|
0 -> 2 en 2. :
|
||||||
|
0 -> 2
|
||||||
|
0 -> 0 -> 2
|
||||||
|
0 -> 2 -> 2
|
||||||
|
0 -> 0 -> 2 -> 2
|
||||||
|
|
||||||
|
0 -> 3 en 2. :
|
||||||
|
0 -> 1 -> 3
|
||||||
|
0 -> 0 -> 1 -> 3
|
||||||
|
0 -> 1 -> 3 -> 3
|
||||||
|
0 -> 0 -> 1 -> 3 -> 3
|
||||||
|
|
||||||
|
0 -> 4 en 4. :
|
||||||
|
0 -> 2 -> 4
|
||||||
|
0 -> 0 -> 2 -> 4
|
||||||
|
0 -> 2 -> 4 -> 4
|
||||||
|
0 -> 0 -> 2 -> 4 -> 4
|
||||||
|
|
||||||
|
0 -> 5 en 6. :
|
||||||
|
0 -> 1 -> 3 -> 5
|
||||||
|
0 -> 0 -> 1 -> 3 -> 5
|
||||||
|
0 -> 1 -> 3 -> 5 -> 5
|
||||||
|
0 -> 0 -> 1 -> 3 -> 5 -> 5
|
||||||
|
|
||||||
|
0 -> 6 en 3. :
|
||||||
|
0 -> 1 -> 3 -> 6
|
||||||
|
0 -> 0 -> 1 -> 3 -> 6
|
||||||
|
0 -> 1 -> 3 -> 6 -> 6
|
||||||
|
0 -> 0 -> 1 -> 3 -> 6 -> 6
|
||||||
|
|
||||||
|
0 -> 7 en 18. :
|
||||||
|
0 -> 1 -> 3 -> 6 -> 9 -> 10 -> 8 -> 7
|
||||||
|
0 -> 1 -> 3 -> 6 -> 9 -> 10 -> 8 -> 7 -> 7
|
||||||
|
0 -> 0 -> 1 -> 3 -> 6 -> 9 -> 10 -> 8 -> 7
|
||||||
|
0 -> 0 -> 1 -> 3 -> 6 -> 9 -> 10 -> 8 -> 7 -> 7
|
||||||
|
|
||||||
|
0 -> 8 en 17. :
|
||||||
|
0 -> 1 -> 3 -> 6 -> 9 -> 10 -> 8
|
||||||
|
0 -> 1 -> 3 -> 6 -> 9 -> 10 -> 8 -> 8
|
||||||
|
0 -> 0 -> 1 -> 3 -> 6 -> 9 -> 10 -> 8
|
||||||
|
0 -> 0 -> 1 -> 3 -> 6 -> 9 -> 10 -> 8 -> 8
|
||||||
|
|
||||||
|
0 -> 9 en 6. :
|
||||||
|
0 -> 1 -> 3 -> 6 -> 9
|
||||||
|
0 -> 0 -> 1 -> 3 -> 6 -> 9
|
||||||
|
0 -> 1 -> 3 -> 6 -> 9 -> 9
|
||||||
|
0 -> 0 -> 1 -> 3 -> 6 -> 9 -> 9
|
||||||
|
|
||||||
|
0 -> 10 en 9. :
|
||||||
|
0 -> 1 -> 3 -> 6 -> 9 -> 10
|
||||||
|
0 -> 0 -> 1 -> 3 -> 6 -> 9 -> 10
|
||||||
|
0 -> 1 -> 3 -> 6 -> 9 -> 10 -> 10
|
||||||
|
0 -> 0 -> 1 -> 3 -> 6 -> 9 -> 10 -> 10
|
||||||
|
|
||||||
|
1 -> 0 en 17. :
|
||||||
|
1 -> 3 -> 6 -> 9 -> 10 -> 0
|
||||||
|
1 -> 3 -> 6 -> 9 -> 10 -> 0 -> 0
|
||||||
|
1 -> 1 -> 3 -> 6 -> 9 -> 10 -> 0
|
||||||
|
1 -> 1 -> 3 -> 6 -> 9 -> 10 -> 0 -> 0
|
||||||
|
|
||||||
|
1 -> 2 en 19. :
|
||||||
|
1 -> 3 -> 6 -> 9 -> 10 -> 0 -> 2
|
||||||
|
1 -> 3 -> 6 -> 9 -> 10 -> 0 -> 2 -> 2
|
||||||
|
1 -> 1 -> 3 -> 6 -> 9 -> 10 -> 0 -> 2
|
||||||
|
1 -> 1 -> 3 -> 6 -> 9 -> 10 -> 0 -> 2 -> 2
|
||||||
|
|
||||||
|
1 -> 3 en 1. :
|
||||||
|
1 -> 3
|
||||||
|
1 -> 1 -> 3
|
||||||
|
1 -> 3 -> 3
|
||||||
|
1 -> 1 -> 3 -> 3
|
||||||
|
|
||||||
|
1 -> 4 en 21. :
|
||||||
|
1 -> 3 -> 6 -> 9 -> 10 -> 0 -> 2 -> 4
|
||||||
|
1 -> 3 -> 6 -> 9 -> 10 -> 0 -> 2 -> 4 -> 4
|
||||||
|
1 -> 1 -> 3 -> 6 -> 9 -> 10 -> 0 -> 2 -> 4
|
||||||
|
1 -> 1 -> 3 -> 6 -> 9 -> 10 -> 0 -> 2 -> 4 -> 4
|
||||||
|
|
||||||
|
1 -> 5 en 5. :
|
||||||
|
1 -> 3 -> 5
|
||||||
|
1 -> 1 -> 3 -> 5
|
||||||
|
1 -> 3 -> 5 -> 5
|
||||||
|
1 -> 1 -> 3 -> 5 -> 5
|
||||||
|
|
||||||
|
1 -> 6 en 2. :
|
||||||
|
1 -> 3 -> 6
|
||||||
|
1 -> 1 -> 3 -> 6
|
||||||
|
1 -> 3 -> 6 -> 6
|
||||||
|
1 -> 1 -> 3 -> 6 -> 6
|
||||||
|
|
||||||
|
1 -> 7 en 17. :
|
||||||
|
1 -> 3 -> 6 -> 9 -> 10 -> 8 -> 7
|
||||||
|
1 -> 3 -> 6 -> 9 -> 10 -> 8 -> 7 -> 7
|
||||||
|
1 -> 1 -> 3 -> 6 -> 9 -> 10 -> 8 -> 7
|
||||||
|
1 -> 1 -> 3 -> 6 -> 9 -> 10 -> 8 -> 7 -> 7
|
||||||
|
|
||||||
|
1 -> 8 en 16. :
|
||||||
|
1 -> 3 -> 6 -> 9 -> 10 -> 8
|
||||||
|
1 -> 3 -> 6 -> 9 -> 10 -> 8 -> 8
|
||||||
|
1 -> 1 -> 3 -> 6 -> 9 -> 10 -> 8
|
||||||
|
1 -> 1 -> 3 -> 6 -> 9 -> 10 -> 8 -> 8
|
||||||
|
|
||||||
|
1 -> 9 en 5. :
|
||||||
|
1 -> 3 -> 6 -> 9
|
||||||
|
1 -> 1 -> 3 -> 6 -> 9
|
||||||
|
1 -> 3 -> 6 -> 9 -> 9
|
||||||
|
1 -> 1 -> 3 -> 6 -> 9 -> 9
|
||||||
|
|
||||||
|
1 -> 10 en 8. :
|
||||||
|
1 -> 3 -> 6 -> 9 -> 10
|
||||||
|
1 -> 1 -> 3 -> 6 -> 9 -> 10
|
||||||
|
1 -> 3 -> 6 -> 9 -> 10 -> 10
|
||||||
|
1 -> 1 -> 3 -> 6 -> 9 -> 10 -> 10
|
||||||
|
|
||||||
|
2 -> 0 en 19. :
|
||||||
|
2 -> 3 -> 6 -> 9 -> 10 -> 0
|
||||||
|
2 -> 3 -> 6 -> 9 -> 10 -> 0 -> 0
|
||||||
|
2 -> 2 -> 3 -> 6 -> 9 -> 10 -> 0
|
||||||
|
2 -> 2 -> 3 -> 6 -> 9 -> 10 -> 0 -> 0
|
||||||
|
2 -> 4 -> 6 -> 9 -> 10 -> 0
|
||||||
|
2 -> 4 -> 6 -> 9 -> 10 -> 0 -> 0
|
||||||
|
2 -> 2 -> 4 -> 6 -> 9 -> 10 -> 0
|
||||||
|
2 -> 2 -> 4 -> 6 -> 9 -> 10 -> 0 -> 0
|
||||||
|
|
||||||
|
2 -> 1 en 8. :
|
||||||
|
2 -> 3 -> 5 -> 1
|
||||||
|
2 -> 3 -> 5 -> 1 -> 1
|
||||||
|
2 -> 2 -> 3 -> 5 -> 1
|
||||||
|
2 -> 2 -> 3 -> 5 -> 1 -> 1
|
||||||
|
|
||||||
|
2 -> 3 en 3. :
|
||||||
|
2 -> 3
|
||||||
|
2 -> 2 -> 3
|
||||||
|
2 -> 3 -> 3
|
||||||
|
2 -> 2 -> 3 -> 3
|
||||||
|
|
||||||
|
2 -> 4 en 2. :
|
||||||
|
2 -> 4
|
||||||
|
2 -> 2 -> 4
|
||||||
|
2 -> 4 -> 4
|
||||||
|
2 -> 2 -> 4 -> 4
|
||||||
|
|
||||||
|
2 -> 5 en 7. :
|
||||||
|
2 -> 3 -> 5
|
||||||
|
2 -> 2 -> 3 -> 5
|
||||||
|
2 -> 3 -> 5 -> 5
|
||||||
|
2 -> 2 -> 3 -> 5 -> 5
|
||||||
|
|
||||||
|
2 -> 6 en 4. :
|
||||||
|
2 -> 3 -> 6
|
||||||
|
2 -> 2 -> 3 -> 6
|
||||||
|
2 -> 4 -> 6
|
||||||
|
2 -> 2 -> 4 -> 6
|
||||||
|
2 -> 3 -> 6 -> 6
|
||||||
|
2 -> 2 -> 3 -> 6 -> 6
|
||||||
|
2 -> 4 -> 6 -> 6
|
||||||
|
2 -> 2 -> 4 -> 6 -> 6
|
||||||
|
|
||||||
|
2 -> 7 en 19. :
|
||||||
|
2 -> 3 -> 6 -> 9 -> 10 -> 8 -> 7
|
||||||
|
2 -> 3 -> 6 -> 9 -> 10 -> 8 -> 7 -> 7
|
||||||
|
2 -> 2 -> 3 -> 6 -> 9 -> 10 -> 8 -> 7
|
||||||
|
2 -> 2 -> 3 -> 6 -> 9 -> 10 -> 8 -> 7 -> 7
|
||||||
|
2 -> 4 -> 6 -> 9 -> 10 -> 8 -> 7
|
||||||
|
2 -> 4 -> 6 -> 9 -> 10 -> 8 -> 7 -> 7
|
||||||
|
2 -> 2 -> 4 -> 6 -> 9 -> 10 -> 8 -> 7
|
||||||
|
2 -> 2 -> 4 -> 6 -> 9 -> 10 -> 8 -> 7 -> 7
|
||||||
|
|
||||||
|
2 -> 8 en 18. :
|
||||||
|
2 -> 3 -> 6 -> 9 -> 10 -> 8
|
||||||
|
2 -> 3 -> 6 -> 9 -> 10 -> 8 -> 8
|
||||||
|
2 -> 2 -> 3 -> 6 -> 9 -> 10 -> 8
|
||||||
|
2 -> 2 -> 3 -> 6 -> 9 -> 10 -> 8 -> 8
|
||||||
|
2 -> 4 -> 6 -> 9 -> 10 -> 8
|
||||||
|
2 -> 4 -> 6 -> 9 -> 10 -> 8 -> 8
|
||||||
|
2 -> 2 -> 4 -> 6 -> 9 -> 10 -> 8
|
||||||
|
2 -> 2 -> 4 -> 6 -> 9 -> 10 -> 8 -> 8
|
||||||
|
|
||||||
|
2 -> 9 en 7. :
|
||||||
|
2 -> 3 -> 6 -> 9
|
||||||
|
2 -> 2 -> 3 -> 6 -> 9
|
||||||
|
2 -> 4 -> 6 -> 9
|
||||||
|
2 -> 2 -> 4 -> 6 -> 9
|
||||||
|
2 -> 3 -> 6 -> 9 -> 9
|
||||||
|
2 -> 2 -> 3 -> 6 -> 9 -> 9
|
||||||
|
2 -> 4 -> 6 -> 9 -> 9
|
||||||
|
2 -> 2 -> 4 -> 6 -> 9 -> 9
|
||||||
|
|
||||||
|
2 -> 10 en 10. :
|
||||||
|
2 -> 3 -> 6 -> 9 -> 10
|
||||||
|
2 -> 2 -> 3 -> 6 -> 9 -> 10
|
||||||
|
2 -> 4 -> 6 -> 9 -> 10
|
||||||
|
2 -> 2 -> 4 -> 6 -> 9 -> 10
|
||||||
|
2 -> 3 -> 6 -> 9 -> 10 -> 10
|
||||||
|
2 -> 2 -> 3 -> 6 -> 9 -> 10 -> 10
|
||||||
|
2 -> 4 -> 6 -> 9 -> 10 -> 10
|
||||||
|
2 -> 2 -> 4 -> 6 -> 9 -> 10 -> 10
|
||||||
|
|
||||||
|
3 -> 0 en 16. :
|
||||||
|
3 -> 6 -> 9 -> 10 -> 0
|
||||||
|
3 -> 6 -> 9 -> 10 -> 0 -> 0
|
||||||
|
3 -> 3 -> 6 -> 9 -> 10 -> 0
|
||||||
|
3 -> 3 -> 6 -> 9 -> 10 -> 0 -> 0
|
||||||
|
|
||||||
|
3 -> 1 en 5. :
|
||||||
|
3 -> 5 -> 1
|
||||||
|
3 -> 5 -> 1 -> 1
|
||||||
|
3 -> 3 -> 5 -> 1
|
||||||
|
3 -> 3 -> 5 -> 1 -> 1
|
||||||
|
|
||||||
|
3 -> 2 en 18. :
|
||||||
|
3 -> 6 -> 9 -> 10 -> 0 -> 2
|
||||||
|
3 -> 6 -> 9 -> 10 -> 0 -> 2 -> 2
|
||||||
|
3 -> 3 -> 6 -> 9 -> 10 -> 0 -> 2
|
||||||
|
3 -> 3 -> 6 -> 9 -> 10 -> 0 -> 2 -> 2
|
||||||
|
|
||||||
|
3 -> 4 en 20. :
|
||||||
|
3 -> 6 -> 9 -> 10 -> 0 -> 2 -> 4
|
||||||
|
3 -> 6 -> 9 -> 10 -> 0 -> 2 -> 4 -> 4
|
||||||
|
3 -> 3 -> 6 -> 9 -> 10 -> 0 -> 2 -> 4
|
||||||
|
3 -> 3 -> 6 -> 9 -> 10 -> 0 -> 2 -> 4 -> 4
|
||||||
|
|
||||||
|
3 -> 5 en 4. :
|
||||||
|
3 -> 5
|
||||||
|
3 -> 3 -> 5
|
||||||
|
3 -> 5 -> 5
|
||||||
|
3 -> 3 -> 5 -> 5
|
||||||
|
|
||||||
|
3 -> 6 en 1. :
|
||||||
|
3 -> 6
|
||||||
|
3 -> 3 -> 6
|
||||||
|
3 -> 6 -> 6
|
||||||
|
3 -> 3 -> 6 -> 6
|
||||||
|
|
||||||
|
3 -> 7 en 16. :
|
||||||
|
3 -> 6 -> 9 -> 10 -> 8 -> 7
|
||||||
|
3 -> 6 -> 9 -> 10 -> 8 -> 7 -> 7
|
||||||
|
3 -> 3 -> 6 -> 9 -> 10 -> 8 -> 7
|
||||||
|
3 -> 3 -> 6 -> 9 -> 10 -> 8 -> 7 -> 7
|
||||||
|
|
||||||
|
3 -> 8 en 15. :
|
||||||
|
3 -> 6 -> 9 -> 10 -> 8
|
||||||
|
3 -> 6 -> 9 -> 10 -> 8 -> 8
|
||||||
|
3 -> 3 -> 6 -> 9 -> 10 -> 8
|
||||||
|
3 -> 3 -> 6 -> 9 -> 10 -> 8 -> 8
|
||||||
|
|
||||||
|
3 -> 9 en 4. :
|
||||||
|
3 -> 6 -> 9
|
||||||
|
3 -> 3 -> 6 -> 9
|
||||||
|
3 -> 6 -> 9 -> 9
|
||||||
|
3 -> 3 -> 6 -> 9 -> 9
|
||||||
|
|
||||||
|
3 -> 10 en 7. :
|
||||||
|
3 -> 6 -> 9 -> 10
|
||||||
|
3 -> 3 -> 6 -> 9 -> 10
|
||||||
|
3 -> 6 -> 9 -> 10 -> 10
|
||||||
|
3 -> 3 -> 6 -> 9 -> 10 -> 10
|
||||||
|
|
||||||
|
4 -> 0 en 17. :
|
||||||
|
4 -> 6 -> 9 -> 10 -> 0
|
||||||
|
4 -> 6 -> 9 -> 10 -> 0 -> 0
|
||||||
|
4 -> 4 -> 6 -> 9 -> 10 -> 0
|
||||||
|
4 -> 4 -> 6 -> 9 -> 10 -> 0 -> 0
|
||||||
|
|
||||||
|
4 -> 1 en 18. :
|
||||||
|
4 -> 6 -> 9 -> 10 -> 0 -> 1
|
||||||
|
4 -> 6 -> 9 -> 10 -> 0 -> 1 -> 1
|
||||||
|
4 -> 4 -> 6 -> 9 -> 10 -> 0 -> 1
|
||||||
|
4 -> 4 -> 6 -> 9 -> 10 -> 0 -> 1 -> 1
|
||||||
|
|
||||||
|
4 -> 2 en 19. :
|
||||||
|
4 -> 6 -> 9 -> 10 -> 0 -> 2
|
||||||
|
4 -> 6 -> 9 -> 10 -> 0 -> 2 -> 2
|
||||||
|
4 -> 4 -> 6 -> 9 -> 10 -> 0 -> 2
|
||||||
|
4 -> 4 -> 6 -> 9 -> 10 -> 0 -> 2 -> 2
|
||||||
|
|
||||||
|
4 -> 3 en 19. :
|
||||||
|
4 -> 6 -> 9 -> 10 -> 0 -> 1 -> 3
|
||||||
|
4 -> 6 -> 9 -> 10 -> 0 -> 1 -> 3 -> 3
|
||||||
|
4 -> 4 -> 6 -> 9 -> 10 -> 0 -> 1 -> 3
|
||||||
|
4 -> 4 -> 6 -> 9 -> 10 -> 0 -> 1 -> 3 -> 3
|
||||||
|
|
||||||
|
4 -> 5 en 23. :
|
||||||
|
4 -> 6 -> 9 -> 10 -> 0 -> 1 -> 3 -> 5
|
||||||
|
4 -> 6 -> 9 -> 10 -> 0 -> 1 -> 3 -> 5 -> 5
|
||||||
|
4 -> 4 -> 6 -> 9 -> 10 -> 0 -> 1 -> 3 -> 5
|
||||||
|
4 -> 4 -> 6 -> 9 -> 10 -> 0 -> 1 -> 3 -> 5 -> 5
|
||||||
|
|
||||||
|
4 -> 6 en 2. :
|
||||||
|
4 -> 6
|
||||||
|
4 -> 4 -> 6
|
||||||
|
4 -> 6 -> 6
|
||||||
|
4 -> 4 -> 6 -> 6
|
||||||
|
|
||||||
|
4 -> 7 en 17. :
|
||||||
|
4 -> 6 -> 9 -> 10 -> 8 -> 7
|
||||||
|
4 -> 6 -> 9 -> 10 -> 8 -> 7 -> 7
|
||||||
|
4 -> 4 -> 6 -> 9 -> 10 -> 8 -> 7
|
||||||
|
4 -> 4 -> 6 -> 9 -> 10 -> 8 -> 7 -> 7
|
||||||
|
|
||||||
|
4 -> 8 en 16. :
|
||||||
|
4 -> 6 -> 9 -> 10 -> 8
|
||||||
|
4 -> 6 -> 9 -> 10 -> 8 -> 8
|
||||||
|
4 -> 4 -> 6 -> 9 -> 10 -> 8
|
||||||
|
4 -> 4 -> 6 -> 9 -> 10 -> 8 -> 8
|
||||||
|
|
||||||
|
4 -> 9 en 5. :
|
||||||
|
4 -> 6 -> 9
|
||||||
|
4 -> 4 -> 6 -> 9
|
||||||
|
4 -> 6 -> 9 -> 9
|
||||||
|
4 -> 4 -> 6 -> 9 -> 9
|
||||||
|
|
||||||
|
4 -> 10 en 8. :
|
||||||
|
4 -> 6 -> 9 -> 10
|
||||||
|
4 -> 4 -> 6 -> 9 -> 10
|
||||||
|
4 -> 6 -> 9 -> 10 -> 10
|
||||||
|
4 -> 4 -> 6 -> 9 -> 10 -> 10
|
||||||
|
|
||||||
|
5 -> 0 en 18. :
|
||||||
|
5 -> 1 -> 3 -> 6 -> 9 -> 10 -> 0
|
||||||
|
5 -> 1 -> 3 -> 6 -> 9 -> 10 -> 0 -> 0
|
||||||
|
5 -> 5 -> 1 -> 3 -> 6 -> 9 -> 10 -> 0
|
||||||
|
5 -> 5 -> 1 -> 3 -> 6 -> 9 -> 10 -> 0 -> 0
|
||||||
|
|
||||||
|
5 -> 1 en 1. :
|
||||||
|
5 -> 1
|
||||||
|
5 -> 1 -> 1
|
||||||
|
5 -> 5 -> 1
|
||||||
|
5 -> 5 -> 1 -> 1
|
||||||
|
|
||||||
|
5 -> 2 en 20. :
|
||||||
|
5 -> 1 -> 3 -> 6 -> 9 -> 10 -> 0 -> 2
|
||||||
|
5 -> 1 -> 3 -> 6 -> 9 -> 10 -> 0 -> 2 -> 2
|
||||||
|
5 -> 5 -> 1 -> 3 -> 6 -> 9 -> 10 -> 0 -> 2
|
||||||
|
5 -> 5 -> 1 -> 3 -> 6 -> 9 -> 10 -> 0 -> 2 -> 2
|
||||||
|
|
||||||
|
5 -> 3 en 2. :
|
||||||
|
5 -> 1 -> 3
|
||||||
|
5 -> 1 -> 3 -> 3
|
||||||
|
5 -> 5 -> 1 -> 3
|
||||||
|
5 -> 5 -> 1 -> 3 -> 3
|
||||||
|
|
||||||
|
5 -> 4 en 22. :
|
||||||
|
5 -> 1 -> 3 -> 6 -> 9 -> 10 -> 0 -> 2 -> 4
|
||||||
|
5 -> 1 -> 3 -> 6 -> 9 -> 10 -> 0 -> 2 -> 4 -> 4
|
||||||
|
5 -> 5 -> 1 -> 3 -> 6 -> 9 -> 10 -> 0 -> 2 -> 4
|
||||||
|
5 -> 5 -> 1 -> 3 -> 6 -> 9 -> 10 -> 0 -> 2 -> 4 -> 4
|
||||||
|
|
||||||
|
5 -> 6 en 3. :
|
||||||
|
5 -> 1 -> 3 -> 6
|
||||||
|
5 -> 5 -> 1 -> 3 -> 6
|
||||||
|
5 -> 1 -> 3 -> 6 -> 6
|
||||||
|
5 -> 5 -> 1 -> 3 -> 6 -> 6
|
||||||
|
|
||||||
|
5 -> 7 en 18. :
|
||||||
|
5 -> 1 -> 3 -> 6 -> 9 -> 10 -> 8 -> 7
|
||||||
|
5 -> 1 -> 3 -> 6 -> 9 -> 10 -> 8 -> 7 -> 7
|
||||||
|
5 -> 5 -> 1 -> 3 -> 6 -> 9 -> 10 -> 8 -> 7
|
||||||
|
5 -> 5 -> 1 -> 3 -> 6 -> 9 -> 10 -> 8 -> 7 -> 7
|
||||||
|
|
||||||
|
5 -> 8 en 17. :
|
||||||
|
5 -> 1 -> 3 -> 6 -> 9 -> 10 -> 8
|
||||||
|
5 -> 1 -> 3 -> 6 -> 9 -> 10 -> 8 -> 8
|
||||||
|
5 -> 5 -> 1 -> 3 -> 6 -> 9 -> 10 -> 8
|
||||||
|
5 -> 5 -> 1 -> 3 -> 6 -> 9 -> 10 -> 8 -> 8
|
||||||
|
|
||||||
|
5 -> 9 en 6. :
|
||||||
|
5 -> 1 -> 3 -> 6 -> 9
|
||||||
|
5 -> 5 -> 1 -> 3 -> 6 -> 9
|
||||||
|
5 -> 1 -> 3 -> 6 -> 9 -> 9
|
||||||
|
5 -> 5 -> 1 -> 3 -> 6 -> 9 -> 9
|
||||||
|
|
||||||
|
5 -> 10 en 9. :
|
||||||
|
5 -> 1 -> 3 -> 6 -> 9 -> 10
|
||||||
|
5 -> 5 -> 1 -> 3 -> 6 -> 9 -> 10
|
||||||
|
5 -> 1 -> 3 -> 6 -> 9 -> 10 -> 10
|
||||||
|
5 -> 5 -> 1 -> 3 -> 6 -> 9 -> 10 -> 10
|
||||||
|
|
||||||
|
6 -> 0 en 15. :
|
||||||
|
6 -> 9 -> 10 -> 0
|
||||||
|
6 -> 9 -> 10 -> 0 -> 0
|
||||||
|
6 -> 6 -> 9 -> 10 -> 0
|
||||||
|
6 -> 6 -> 9 -> 10 -> 0 -> 0
|
||||||
|
|
||||||
|
6 -> 1 en 16. :
|
||||||
|
6 -> 9 -> 10 -> 0 -> 1
|
||||||
|
6 -> 9 -> 10 -> 0 -> 1 -> 1
|
||||||
|
6 -> 6 -> 9 -> 10 -> 0 -> 1
|
||||||
|
6 -> 6 -> 9 -> 10 -> 0 -> 1 -> 1
|
||||||
|
|
||||||
|
6 -> 2 en 17. :
|
||||||
|
6 -> 9 -> 10 -> 0 -> 2
|
||||||
|
6 -> 9 -> 10 -> 0 -> 2 -> 2
|
||||||
|
6 -> 6 -> 9 -> 10 -> 0 -> 2
|
||||||
|
6 -> 6 -> 9 -> 10 -> 0 -> 2 -> 2
|
||||||
|
|
||||||
|
6 -> 3 en 17. :
|
||||||
|
6 -> 9 -> 10 -> 0 -> 1 -> 3
|
||||||
|
6 -> 9 -> 10 -> 0 -> 1 -> 3 -> 3
|
||||||
|
6 -> 6 -> 9 -> 10 -> 0 -> 1 -> 3
|
||||||
|
6 -> 6 -> 9 -> 10 -> 0 -> 1 -> 3 -> 3
|
||||||
|
|
||||||
|
6 -> 4 en 19. :
|
||||||
|
6 -> 9 -> 10 -> 0 -> 2 -> 4
|
||||||
|
6 -> 9 -> 10 -> 0 -> 2 -> 4 -> 4
|
||||||
|
6 -> 6 -> 9 -> 10 -> 0 -> 2 -> 4
|
||||||
|
6 -> 6 -> 9 -> 10 -> 0 -> 2 -> 4 -> 4
|
||||||
|
|
||||||
|
6 -> 5 en 21. :
|
||||||
|
6 -> 9 -> 10 -> 0 -> 1 -> 3 -> 5
|
||||||
|
6 -> 9 -> 10 -> 0 -> 1 -> 3 -> 5 -> 5
|
||||||
|
6 -> 6 -> 9 -> 10 -> 0 -> 1 -> 3 -> 5
|
||||||
|
6 -> 6 -> 9 -> 10 -> 0 -> 1 -> 3 -> 5 -> 5
|
||||||
|
|
||||||
|
6 -> 7 en 15. :
|
||||||
|
6 -> 9 -> 10 -> 8 -> 7
|
||||||
|
6 -> 9 -> 10 -> 8 -> 7 -> 7
|
||||||
|
6 -> 6 -> 9 -> 10 -> 8 -> 7
|
||||||
|
6 -> 6 -> 9 -> 10 -> 8 -> 7 -> 7
|
||||||
|
|
||||||
|
6 -> 8 en 14. :
|
||||||
|
6 -> 9 -> 10 -> 8
|
||||||
|
6 -> 9 -> 10 -> 8 -> 8
|
||||||
|
6 -> 6 -> 9 -> 10 -> 8
|
||||||
|
6 -> 6 -> 9 -> 10 -> 8 -> 8
|
||||||
|
|
||||||
|
6 -> 9 en 3. :
|
||||||
|
6 -> 9
|
||||||
|
6 -> 6 -> 9
|
||||||
|
6 -> 9 -> 9
|
||||||
|
6 -> 6 -> 9 -> 9
|
||||||
|
|
||||||
|
6 -> 10 en 6. :
|
||||||
|
6 -> 9 -> 10
|
||||||
|
6 -> 6 -> 9 -> 10
|
||||||
|
6 -> 9 -> 10 -> 10
|
||||||
|
6 -> 6 -> 9 -> 10 -> 10
|
||||||
|
|
||||||
|
7 -> 0 en 19. :
|
||||||
|
7 -> 6 -> 9 -> 10 -> 0
|
||||||
|
7 -> 6 -> 9 -> 10 -> 0 -> 0
|
||||||
|
7 -> 7 -> 6 -> 9 -> 10 -> 0
|
||||||
|
7 -> 7 -> 6 -> 9 -> 10 -> 0 -> 0
|
||||||
|
|
||||||
|
7 -> 1 en 20. :
|
||||||
|
7 -> 6 -> 9 -> 10 -> 0 -> 1
|
||||||
|
7 -> 6 -> 9 -> 10 -> 0 -> 1 -> 1
|
||||||
|
7 -> 7 -> 6 -> 9 -> 10 -> 0 -> 1
|
||||||
|
7 -> 7 -> 6 -> 9 -> 10 -> 0 -> 1 -> 1
|
||||||
|
|
||||||
|
7 -> 2 en 21. :
|
||||||
|
7 -> 6 -> 9 -> 10 -> 0 -> 2
|
||||||
|
7 -> 6 -> 9 -> 10 -> 0 -> 2 -> 2
|
||||||
|
7 -> 7 -> 6 -> 9 -> 10 -> 0 -> 2
|
||||||
|
7 -> 7 -> 6 -> 9 -> 10 -> 0 -> 2 -> 2
|
||||||
|
|
||||||
|
7 -> 3 en 21. :
|
||||||
|
7 -> 6 -> 9 -> 10 -> 0 -> 1 -> 3
|
||||||
|
7 -> 6 -> 9 -> 10 -> 0 -> 1 -> 3 -> 3
|
||||||
|
7 -> 7 -> 6 -> 9 -> 10 -> 0 -> 1 -> 3
|
||||||
|
7 -> 7 -> 6 -> 9 -> 10 -> 0 -> 1 -> 3 -> 3
|
||||||
|
|
||||||
|
7 -> 4 en 23. :
|
||||||
|
7 -> 6 -> 9 -> 10 -> 0 -> 2 -> 4
|
||||||
|
7 -> 6 -> 9 -> 10 -> 0 -> 2 -> 4 -> 4
|
||||||
|
7 -> 7 -> 6 -> 9 -> 10 -> 0 -> 2 -> 4
|
||||||
|
7 -> 7 -> 6 -> 9 -> 10 -> 0 -> 2 -> 4 -> 4
|
||||||
|
|
||||||
|
7 -> 5 en 25. :
|
||||||
|
7 -> 6 -> 9 -> 10 -> 0 -> 1 -> 3 -> 5
|
||||||
|
7 -> 6 -> 9 -> 10 -> 0 -> 1 -> 3 -> 5 -> 5
|
||||||
|
7 -> 7 -> 6 -> 9 -> 10 -> 0 -> 1 -> 3 -> 5
|
||||||
|
7 -> 7 -> 6 -> 9 -> 10 -> 0 -> 1 -> 3 -> 5 -> 5
|
||||||
|
|
||||||
|
7 -> 6 en 4. :
|
||||||
|
7 -> 6
|
||||||
|
7 -> 6 -> 6
|
||||||
|
7 -> 7 -> 6
|
||||||
|
7 -> 7 -> 6 -> 6
|
||||||
|
|
||||||
|
7 -> 8 en 18. :
|
||||||
|
7 -> 6 -> 9 -> 10 -> 8
|
||||||
|
7 -> 6 -> 9 -> 10 -> 8 -> 8
|
||||||
|
7 -> 7 -> 6 -> 9 -> 10 -> 8
|
||||||
|
7 -> 7 -> 6 -> 9 -> 10 -> 8 -> 8
|
||||||
|
|
||||||
|
7 -> 9 en 7. :
|
||||||
|
7 -> 6 -> 9
|
||||||
|
7 -> 7 -> 6 -> 9
|
||||||
|
7 -> 6 -> 9 -> 9
|
||||||
|
7 -> 7 -> 6 -> 9 -> 9
|
||||||
|
|
||||||
|
7 -> 10 en 10. :
|
||||||
|
7 -> 6 -> 9 -> 10
|
||||||
|
7 -> 7 -> 6 -> 9 -> 10
|
||||||
|
7 -> 6 -> 9 -> 10 -> 10
|
||||||
|
7 -> 7 -> 6 -> 9 -> 10 -> 10
|
||||||
|
|
||||||
|
8 -> 0 en 20. :
|
||||||
|
8 -> 7 -> 6 -> 9 -> 10 -> 0
|
||||||
|
8 -> 7 -> 6 -> 9 -> 10 -> 0 -> 0
|
||||||
|
8 -> 8 -> 7 -> 6 -> 9 -> 10 -> 0
|
||||||
|
8 -> 8 -> 7 -> 6 -> 9 -> 10 -> 0 -> 0
|
||||||
|
|
||||||
|
8 -> 1 en 21. :
|
||||||
|
8 -> 7 -> 6 -> 9 -> 10 -> 0 -> 1
|
||||||
|
8 -> 7 -> 6 -> 9 -> 10 -> 0 -> 1 -> 1
|
||||||
|
8 -> 8 -> 7 -> 6 -> 9 -> 10 -> 0 -> 1
|
||||||
|
8 -> 8 -> 7 -> 6 -> 9 -> 10 -> 0 -> 1 -> 1
|
||||||
|
|
||||||
|
8 -> 2 en 22. :
|
||||||
|
8 -> 7 -> 6 -> 9 -> 10 -> 0 -> 2
|
||||||
|
8 -> 7 -> 6 -> 9 -> 10 -> 0 -> 2 -> 2
|
||||||
|
8 -> 8 -> 7 -> 6 -> 9 -> 10 -> 0 -> 2
|
||||||
|
8 -> 8 -> 7 -> 6 -> 9 -> 10 -> 0 -> 2 -> 2
|
||||||
|
|
||||||
|
8 -> 3 en 22. :
|
||||||
|
8 -> 7 -> 6 -> 9 -> 10 -> 0 -> 1 -> 3
|
||||||
|
8 -> 7 -> 6 -> 9 -> 10 -> 0 -> 1 -> 3 -> 3
|
||||||
|
8 -> 8 -> 7 -> 6 -> 9 -> 10 -> 0 -> 1 -> 3
|
||||||
|
8 -> 8 -> 7 -> 6 -> 9 -> 10 -> 0 -> 1 -> 3 -> 3
|
||||||
|
|
||||||
|
8 -> 4 en 24. :
|
||||||
|
8 -> 7 -> 6 -> 9 -> 10 -> 0 -> 2 -> 4
|
||||||
|
8 -> 7 -> 6 -> 9 -> 10 -> 0 -> 2 -> 4 -> 4
|
||||||
|
8 -> 8 -> 7 -> 6 -> 9 -> 10 -> 0 -> 2 -> 4
|
||||||
|
8 -> 8 -> 7 -> 6 -> 9 -> 10 -> 0 -> 2 -> 4 -> 4
|
||||||
|
|
||||||
|
8 -> 5 en 26. :
|
||||||
|
8 -> 7 -> 6 -> 9 -> 10 -> 0 -> 1 -> 3 -> 5
|
||||||
|
8 -> 7 -> 6 -> 9 -> 10 -> 0 -> 1 -> 3 -> 5 -> 5
|
||||||
|
8 -> 8 -> 7 -> 6 -> 9 -> 10 -> 0 -> 1 -> 3 -> 5
|
||||||
|
8 -> 8 -> 7 -> 6 -> 9 -> 10 -> 0 -> 1 -> 3 -> 5 -> 5
|
||||||
|
|
||||||
|
8 -> 6 en 5. :
|
||||||
|
8 -> 7 -> 6
|
||||||
|
8 -> 7 -> 6 -> 6
|
||||||
|
8 -> 8 -> 7 -> 6
|
||||||
|
8 -> 8 -> 7 -> 6 -> 6
|
||||||
|
|
||||||
|
8 -> 7 en 1. :
|
||||||
|
8 -> 7
|
||||||
|
8 -> 7 -> 7
|
||||||
|
8 -> 8 -> 7
|
||||||
|
8 -> 8 -> 7 -> 7
|
||||||
|
|
||||||
|
8 -> 9 en 8. :
|
||||||
|
8 -> 7 -> 6 -> 9
|
||||||
|
8 -> 8 -> 7 -> 6 -> 9
|
||||||
|
8 -> 7 -> 6 -> 9 -> 9
|
||||||
|
8 -> 8 -> 7 -> 6 -> 9 -> 9
|
||||||
|
|
||||||
|
8 -> 10 en 11. :
|
||||||
|
8 -> 7 -> 6 -> 9 -> 10
|
||||||
|
8 -> 8 -> 7 -> 6 -> 9 -> 10
|
||||||
|
8 -> 7 -> 6 -> 9 -> 10 -> 10
|
||||||
|
8 -> 8 -> 7 -> 6 -> 9 -> 10 -> 10
|
||||||
|
|
||||||
|
9 -> 0 en 12. :
|
||||||
|
9 -> 10 -> 0
|
||||||
|
9 -> 10 -> 0 -> 0
|
||||||
|
9 -> 9 -> 10 -> 0
|
||||||
|
9 -> 9 -> 10 -> 0 -> 0
|
||||||
|
|
||||||
|
9 -> 1 en 13. :
|
||||||
|
9 -> 10 -> 0 -> 1
|
||||||
|
9 -> 10 -> 0 -> 1 -> 1
|
||||||
|
9 -> 9 -> 10 -> 0 -> 1
|
||||||
|
9 -> 9 -> 10 -> 0 -> 1 -> 1
|
||||||
|
|
||||||
|
9 -> 2 en 14. :
|
||||||
|
9 -> 10 -> 0 -> 2
|
||||||
|
9 -> 10 -> 0 -> 2 -> 2
|
||||||
|
9 -> 9 -> 10 -> 0 -> 2
|
||||||
|
9 -> 9 -> 10 -> 0 -> 2 -> 2
|
||||||
|
|
||||||
|
9 -> 3 en 14. :
|
||||||
|
9 -> 10 -> 0 -> 1 -> 3
|
||||||
|
9 -> 10 -> 0 -> 1 -> 3 -> 3
|
||||||
|
9 -> 9 -> 10 -> 0 -> 1 -> 3
|
||||||
|
9 -> 9 -> 10 -> 0 -> 1 -> 3 -> 3
|
||||||
|
|
||||||
|
9 -> 4 en 16. :
|
||||||
|
9 -> 10 -> 0 -> 2 -> 4
|
||||||
|
9 -> 10 -> 0 -> 2 -> 4 -> 4
|
||||||
|
9 -> 9 -> 10 -> 0 -> 2 -> 4
|
||||||
|
9 -> 9 -> 10 -> 0 -> 2 -> 4 -> 4
|
||||||
|
|
||||||
|
9 -> 5 en 18. :
|
||||||
|
9 -> 10 -> 0 -> 1 -> 3 -> 5
|
||||||
|
9 -> 10 -> 0 -> 1 -> 3 -> 5 -> 5
|
||||||
|
9 -> 9 -> 10 -> 0 -> 1 -> 3 -> 5
|
||||||
|
9 -> 9 -> 10 -> 0 -> 1 -> 3 -> 5 -> 5
|
||||||
|
|
||||||
|
9 -> 6 en 15. :
|
||||||
|
9 -> 10 -> 0 -> 1 -> 3 -> 6
|
||||||
|
9 -> 10 -> 0 -> 1 -> 3 -> 6 -> 6
|
||||||
|
9 -> 9 -> 10 -> 0 -> 1 -> 3 -> 6
|
||||||
|
9 -> 9 -> 10 -> 0 -> 1 -> 3 -> 6 -> 6
|
||||||
|
|
||||||
|
9 -> 7 en 12. :
|
||||||
|
9 -> 10 -> 8 -> 7
|
||||||
|
9 -> 10 -> 8 -> 7 -> 7
|
||||||
|
9 -> 9 -> 10 -> 8 -> 7
|
||||||
|
9 -> 9 -> 10 -> 8 -> 7 -> 7
|
||||||
|
|
||||||
|
9 -> 8 en 11. :
|
||||||
|
9 -> 10 -> 8
|
||||||
|
9 -> 10 -> 8 -> 8
|
||||||
|
9 -> 9 -> 10 -> 8
|
||||||
|
9 -> 9 -> 10 -> 8 -> 8
|
||||||
|
|
||||||
|
9 -> 10 en 3. :
|
||||||
|
9 -> 10
|
||||||
|
9 -> 9 -> 10
|
||||||
|
9 -> 10 -> 10
|
||||||
|
9 -> 9 -> 10 -> 10
|
||||||
|
|
||||||
|
10 -> 0 en 9. :
|
||||||
|
10 -> 0
|
||||||
|
10 -> 0 -> 0
|
||||||
|
10 -> 10 -> 0
|
||||||
|
10 -> 10 -> 0 -> 0
|
||||||
|
|
||||||
|
10 -> 1 en 10. :
|
||||||
|
10 -> 0 -> 1
|
||||||
|
10 -> 0 -> 1 -> 1
|
||||||
|
10 -> 10 -> 0 -> 1
|
||||||
|
10 -> 10 -> 0 -> 1 -> 1
|
||||||
|
|
||||||
|
10 -> 2 en 11. :
|
||||||
|
10 -> 0 -> 2
|
||||||
|
10 -> 0 -> 2 -> 2
|
||||||
|
10 -> 10 -> 0 -> 2
|
||||||
|
10 -> 10 -> 0 -> 2 -> 2
|
||||||
|
|
||||||
|
10 -> 3 en 11. :
|
||||||
|
10 -> 0 -> 1 -> 3
|
||||||
|
10 -> 0 -> 1 -> 3 -> 3
|
||||||
|
10 -> 10 -> 0 -> 1 -> 3
|
||||||
|
10 -> 10 -> 0 -> 1 -> 3 -> 3
|
||||||
|
|
||||||
|
10 -> 4 en 13. :
|
||||||
|
10 -> 0 -> 2 -> 4
|
||||||
|
10 -> 0 -> 2 -> 4 -> 4
|
||||||
|
10 -> 10 -> 0 -> 2 -> 4
|
||||||
|
10 -> 10 -> 0 -> 2 -> 4 -> 4
|
||||||
|
|
||||||
|
10 -> 5 en 15. :
|
||||||
|
10 -> 0 -> 1 -> 3 -> 5
|
||||||
|
10 -> 0 -> 1 -> 3 -> 5 -> 5
|
||||||
|
10 -> 10 -> 0 -> 1 -> 3 -> 5
|
||||||
|
10 -> 10 -> 0 -> 1 -> 3 -> 5 -> 5
|
||||||
|
|
||||||
|
10 -> 6 en 12. :
|
||||||
|
10 -> 0 -> 1 -> 3 -> 6
|
||||||
|
10 -> 0 -> 1 -> 3 -> 6 -> 6
|
||||||
|
10 -> 10 -> 0 -> 1 -> 3 -> 6
|
||||||
|
10 -> 10 -> 0 -> 1 -> 3 -> 6 -> 6
|
||||||
|
|
||||||
|
10 -> 7 en 9. :
|
||||||
|
10 -> 8 -> 7
|
||||||
|
10 -> 8 -> 7 -> 7
|
||||||
|
10 -> 10 -> 8 -> 7
|
||||||
|
10 -> 10 -> 8 -> 7 -> 7
|
||||||
|
|
||||||
|
10 -> 8 en 8. :
|
||||||
|
10 -> 8
|
||||||
|
10 -> 8 -> 8
|
||||||
|
10 -> 10 -> 8
|
||||||
|
10 -> 10 -> 8 -> 8
|
||||||
|
|
||||||
|
10 -> 9 en 15. :
|
||||||
|
10 -> 0 -> 1 -> 3 -> 6 -> 9
|
||||||
|
10 -> 0 -> 1 -> 3 -> 6 -> 9 -> 9
|
||||||
|
10 -> 10 -> 0 -> 1 -> 3 -> 6 -> 9
|
||||||
|
10 -> 10 -> 0 -> 1 -> 3 -> 6 -> 9 -> 9
|
||||||
|
|
BIN
MPSI/spe/cours/floyd_warshall
Executable file
BIN
MPSI/spe/cours/floyd_warshall
Executable file
Binary file not shown.
BIN
MPSI/spe/cours/floyd_warshall.cmi
Normal file
BIN
MPSI/spe/cours/floyd_warshall.cmi
Normal file
Binary file not shown.
BIN
MPSI/spe/cours/floyd_warshall.cmx
Normal file
BIN
MPSI/spe/cours/floyd_warshall.cmx
Normal file
Binary file not shown.
112
MPSI/spe/cours/floyd_warshall.ml
Normal file
112
MPSI/spe/cours/floyd_warshall.ml
Normal file
@ -0,0 +1,112 @@
|
|||||||
|
let ii = infinity;;
|
||||||
|
|
||||||
|
let g = [|
|
||||||
|
(* 0 1 2 3 4 5 6 7 8 9 10*)
|
||||||
|
(*0*) [|0.;1.;2.;ii;ii;ii;ii;ii;ii;ii;ii|];
|
||||||
|
(*1*) [|ii;0.;ii;1.;ii;ii;ii;ii;ii;ii;ii|];
|
||||||
|
(*2*) [|ii;ii;0.;3.;2.;ii;ii;ii;ii;ii;ii|];
|
||||||
|
(*3*) [|ii;ii;ii;0.;ii;4.;1.;ii;ii;ii;ii|];
|
||||||
|
(*4*) [|ii;ii;ii;ii;0.;ii;2.;ii;ii;ii;ii|];
|
||||||
|
(*5*) [|ii;1.;ii;ii;ii;0.;ii;ii;ii;ii;ii|];
|
||||||
|
(*6*) [|ii;ii;ii;ii;ii;ii;0.;ii;ii;3.;ii|];
|
||||||
|
(*7*) [|ii;ii;ii;ii;ii;ii;4.;0.;ii;ii;ii|];
|
||||||
|
(*8*) [|ii;ii;ii;ii;ii;ii;ii;1.;0.;ii;ii|];
|
||||||
|
(*9*) [|ii;ii;ii;ii;ii;ii;ii;ii;ii;0.;3.|];
|
||||||
|
(*10*)[|9.;ii;ii;ii;ii;ii;ii;ii;8.;ii;0.|];|];;
|
||||||
|
|
||||||
|
let copie_matrice m =
|
||||||
|
let p = Array.length m and q = Array.length m.(0) in
|
||||||
|
let c = Array.make_matrix p q m.(0).(0) in
|
||||||
|
for i = 0 to p-1 do
|
||||||
|
for j = 0 to q-1 do
|
||||||
|
c.(i).(j) <- m.(i).(j)
|
||||||
|
done;
|
||||||
|
done;
|
||||||
|
c;;
|
||||||
|
|
||||||
|
let ecraser_matrice m1 m2 =
|
||||||
|
let p = Array.length m2 and q = Array.length m2.(0) in
|
||||||
|
for i = 0 to p-1 do
|
||||||
|
for j = 0 to q-1 do
|
||||||
|
m1.(i).(j) <- m2.(i).(j)
|
||||||
|
done;
|
||||||
|
done;;
|
||||||
|
|
||||||
|
let floyd_warshall g =
|
||||||
|
let n = Array.length g in
|
||||||
|
(* w^(k) pour k=-1 *)
|
||||||
|
let w = copie_matrice g in
|
||||||
|
for k = 0 to n-1 do
|
||||||
|
(* mise ŕ jour de w^(k) *)
|
||||||
|
let c = Array.make_matrix n n 0. in
|
||||||
|
for i = 0 to n-1 do
|
||||||
|
for j = 0 to n-1 do
|
||||||
|
c.(i).(j) <- min w.(i).(j) (w.(i).(k)+.w.(k).(j))
|
||||||
|
done;
|
||||||
|
done;
|
||||||
|
ecraser_matrice w c;
|
||||||
|
done;
|
||||||
|
(* on retourne w^(n-1) *)
|
||||||
|
w;;
|
||||||
|
|
||||||
|
|
||||||
|
let transfo_matrice m =
|
||||||
|
let p = Array.length m and q = Array.length m.(0) in
|
||||||
|
let c = Array.make_matrix p q (m.(0).(0),[[(0,0)]]) in
|
||||||
|
for i = 0 to p-1 do
|
||||||
|
for j = 0 to q-1 do
|
||||||
|
c.(i).(j) <- (m.(i).(j), [[(i,j)]])
|
||||||
|
done;
|
||||||
|
done;
|
||||||
|
c;;
|
||||||
|
|
||||||
|
let rec joindre_chemins l1 l2 =
|
||||||
|
let rec aux chemin li = match li with
|
||||||
|
| [] -> []
|
||||||
|
| h::t -> (chemin@h)::(aux chemin t) in
|
||||||
|
match l1 with
|
||||||
|
| [] -> []
|
||||||
|
| h::t -> (aux h l2)@(joindre_chemins t l2);;
|
||||||
|
|
||||||
|
let floyd_warshall_complet g =
|
||||||
|
let n = Array.length g in
|
||||||
|
(* w^(k) pour k=-1 *)
|
||||||
|
let w = transfo_matrice g in
|
||||||
|
for k = 0 to n-1 do
|
||||||
|
(* mise ŕ jour de w^(k) *)
|
||||||
|
let c = Array.make_matrix n n w.(0).(0) in
|
||||||
|
for i = 0 to n-1 do
|
||||||
|
for j = 0 to n-1 do
|
||||||
|
let ((db,cb), (ds,cs), (dt,ct)) = (w.(i).(j), w.(i).(k), w.(k).(j)) in
|
||||||
|
if db = ds +. dt then
|
||||||
|
if db <> infinity then
|
||||||
|
c.(i).(j) <- (db,cb@(joindre_chemins cs ct))
|
||||||
|
else
|
||||||
|
c.(i).(j) <- (db, cb)
|
||||||
|
else if db > ds +. dt then
|
||||||
|
c.(i).(j) <- (ds +. dt, joindre_chemins cs ct)
|
||||||
|
else
|
||||||
|
c.(i).(j) <- (db, cb);
|
||||||
|
done;
|
||||||
|
done;
|
||||||
|
ecraser_matrice w c;
|
||||||
|
done;
|
||||||
|
(* on retourne w^(n-1) *)
|
||||||
|
w;;
|
||||||
|
|
||||||
|
open Format;;
|
||||||
|
let tous_les_chemins g =
|
||||||
|
let mat = floyd_warshall_complet g in
|
||||||
|
|
||||||
|
let rec affiche_chemin last l = match l with
|
||||||
|
| [] -> printf "%d\n" last
|
||||||
|
| (i,j)::t -> (printf "%d -> " i); affiche_chemin j t in
|
||||||
|
|
||||||
|
for i = 0 to Array.length mat - 1 do
|
||||||
|
for j = 0 to Array.length mat.(0) -1 do
|
||||||
|
if i<>j then
|
||||||
|
let (d,c) = mat.(i).(j) in printf "%d -> %d en %F :\n" i j d; List.iter (fun li -> printf " "; affiche_chemin j li) c;
|
||||||
|
print_newline ()
|
||||||
|
done
|
||||||
|
done;;
|
||||||
|
tous_les_chemins g;;
|
BIN
MPSI/spe/cours/floyd_warshall.o
Normal file
BIN
MPSI/spe/cours/floyd_warshall.o
Normal file
Binary file not shown.
30
SPE/OPT/TP 2/.kile/réponseauxquestions.kilepr.gui
Normal file
30
SPE/OPT/TP 2/.kile/réponseauxquestions.kilepr.gui
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
[General]
|
||||||
|
kile_livePreviewEnabled=true
|
||||||
|
kile_livePreviewStatusUserSpecified=false
|
||||||
|
kile_livePreviewTool=LivePreview-PDFLaTeX
|
||||||
|
lastDocument=Questions
|
||||||
|
|
||||||
|
[document-settings,item:Questions]
|
||||||
|
Bookmarks=
|
||||||
|
Encoding=
|
||||||
|
Highlighting=LaTeX
|
||||||
|
Highlighting Set By User=false
|
||||||
|
Indentation Mode=normal
|
||||||
|
Mode=LaTeX
|
||||||
|
Mode Set By User=false
|
||||||
|
|
||||||
|
[item:Questions]
|
||||||
|
open=true
|
||||||
|
order=0
|
||||||
|
|
||||||
|
[item:réponseauxquestions.kilepr]
|
||||||
|
open=false
|
||||||
|
order=-1
|
||||||
|
|
||||||
|
[view-settings,view=0,item:Questions]
|
||||||
|
CursorColumn=25
|
||||||
|
CursorLine=3
|
||||||
|
Dynamic Word Wrap=true
|
||||||
|
JumpList=
|
||||||
|
TextFolding=[]
|
||||||
|
ViMarks=
|
30
SPE/OPT/TP 2/.kile/tp2.kilepr.gui
Normal file
30
SPE/OPT/TP 2/.kile/tp2.kilepr.gui
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
[General]
|
||||||
|
kile_livePreviewEnabled=true
|
||||||
|
kile_livePreviewStatusUserSpecified=false
|
||||||
|
kile_livePreviewTool=LivePreview-PDFLaTeX
|
||||||
|
lastDocument=Questions.tex
|
||||||
|
|
||||||
|
[document-settings,item:Questions.tex]
|
||||||
|
Bookmarks=
|
||||||
|
Encoding=
|
||||||
|
Highlighting=LaTeX
|
||||||
|
Highlighting Set By User=false
|
||||||
|
Indentation Mode=normal
|
||||||
|
Mode=LaTeX
|
||||||
|
Mode Set By User=false
|
||||||
|
|
||||||
|
[item:Questions.tex]
|
||||||
|
open=true
|
||||||
|
order=0
|
||||||
|
|
||||||
|
[item:tp2.kilepr]
|
||||||
|
open=false
|
||||||
|
order=-1
|
||||||
|
|
||||||
|
[view-settings,view=0,item:Questions.tex]
|
||||||
|
CursorColumn=14
|
||||||
|
CursorLine=35
|
||||||
|
Dynamic Word Wrap=true
|
||||||
|
JumpList=
|
||||||
|
TextFolding=[]
|
||||||
|
ViMarks=.,55,44,[,55,40,],55,44
|
3
SPE/OPT/TP 2/Questions.aux
Normal file
3
SPE/OPT/TP 2/Questions.aux
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
\relax
|
||||||
|
\@writefile{toc}{\contentsline {section}{\numberline {III}Forme normale disjonctive}{1}\protected@file@percent }
|
||||||
|
\@writefile{toc}{\contentsline {subsection}{\numberline {III.1}Question :}{1}\protected@file@percent }
|
257
SPE/OPT/TP 2/Questions.log
Normal file
257
SPE/OPT/TP 2/Questions.log
Normal file
@ -0,0 +1,257 @@
|
|||||||
|
This is pdfTeX, Version 3.14159265-2.6-1.40.21 (TeX Live 2020 Gentoo Linux) (preloaded format=pdflatex 2020.9.3) 12 SEP 2020 10:32
|
||||||
|
entering extended mode
|
||||||
|
restricted \write18 enabled.
|
||||||
|
%&-line parsing enabled.
|
||||||
|
**Questions.tex
|
||||||
|
(./Questions.tex
|
||||||
|
LaTeX2e <2020-02-02> patch level 5
|
||||||
|
L3 programming layer <2020-02-25>
|
||||||
|
(/usr/share/texmf-dist/tex/latex/base/article.cls
|
||||||
|
Document Class: article 2019/12/20 v1.4l Standard LaTeX document class
|
||||||
|
(/usr/share/texmf-dist/tex/latex/base/size10.clo
|
||||||
|
File: size10.clo 2019/12/20 v1.4l Standard LaTeX file (size option)
|
||||||
|
)
|
||||||
|
\c@part=\count167
|
||||||
|
\c@section=\count168
|
||||||
|
\c@subsection=\count169
|
||||||
|
\c@subsubsection=\count170
|
||||||
|
\c@paragraph=\count171
|
||||||
|
\c@subparagraph=\count172
|
||||||
|
\c@figure=\count173
|
||||||
|
\c@table=\count174
|
||||||
|
\abovecaptionskip=\skip47
|
||||||
|
\belowcaptionskip=\skip48
|
||||||
|
\bibindent=\dimen134
|
||||||
|
)
|
||||||
|
(/usr/share/texmf-dist/tex/latex/mathtools/mathtools.sty
|
||||||
|
Package: mathtools 2020/01/17 v1.23 mathematical typesetting tools
|
||||||
|
|
||||||
|
(/usr/share/texmf-dist/tex/latex/graphics/keyval.sty
|
||||||
|
Package: keyval 2014/10/28 v1.15 key=value parser (DPC)
|
||||||
|
\KV@toks@=\toks15
|
||||||
|
)
|
||||||
|
(/usr/share/texmf-dist/tex/latex/tools/calc.sty
|
||||||
|
Package: calc 2017/05/25 v4.3 Infix arithmetic (KKT,FJ)
|
||||||
|
\calc@Acount=\count175
|
||||||
|
\calc@Bcount=\count176
|
||||||
|
\calc@Adimen=\dimen135
|
||||||
|
\calc@Bdimen=\dimen136
|
||||||
|
\calc@Askip=\skip49
|
||||||
|
\calc@Bskip=\skip50
|
||||||
|
LaTeX Info: Redefining \setlength on input line 80.
|
||||||
|
LaTeX Info: Redefining \addtolength on input line 81.
|
||||||
|
\calc@Ccount=\count177
|
||||||
|
\calc@Cskip=\skip51
|
||||||
|
)
|
||||||
|
(/usr/share/texmf-dist/tex/latex/mathtools/mhsetup.sty
|
||||||
|
Package: mhsetup 2017/03/31 v1.3 programming setup (MH)
|
||||||
|
)
|
||||||
|
(/usr/share/texmf-dist/tex/latex/amsmath/amsmath.sty
|
||||||
|
Package: amsmath 2020/01/20 v2.17e AMS math features
|
||||||
|
\@mathmargin=\skip52
|
||||||
|
|
||||||
|
For additional information on amsmath, use the `?' option.
|
||||||
|
(/usr/share/texmf-dist/tex/latex/amsmath/amstext.sty
|
||||||
|
Package: amstext 2000/06/29 v2.01 AMS text
|
||||||
|
|
||||||
|
(/usr/share/texmf-dist/tex/latex/amsmath/amsgen.sty
|
||||||
|
File: amsgen.sty 1999/11/30 v2.0 generic functions
|
||||||
|
\@emptytoks=\toks16
|
||||||
|
\ex@=\dimen137
|
||||||
|
))
|
||||||
|
(/usr/share/texmf-dist/tex/latex/amsmath/amsbsy.sty
|
||||||
|
Package: amsbsy 1999/11/29 v1.2d Bold Symbols
|
||||||
|
\pmbraise@=\dimen138
|
||||||
|
)
|
||||||
|
(/usr/share/texmf-dist/tex/latex/amsmath/amsopn.sty
|
||||||
|
Package: amsopn 2016/03/08 v2.02 operator names
|
||||||
|
)
|
||||||
|
\inf@bad=\count178
|
||||||
|
LaTeX Info: Redefining \frac on input line 227.
|
||||||
|
\uproot@=\count179
|
||||||
|
\leftroot@=\count180
|
||||||
|
LaTeX Info: Redefining \overline on input line 389.
|
||||||
|
\classnum@=\count181
|
||||||
|
\DOTSCASE@=\count182
|
||||||
|
LaTeX Info: Redefining \ldots on input line 486.
|
||||||
|
LaTeX Info: Redefining \dots on input line 489.
|
||||||
|
LaTeX Info: Redefining \cdots on input line 610.
|
||||||
|
\Mathstrutbox@=\box45
|
||||||
|
\strutbox@=\box46
|
||||||
|
\big@size=\dimen139
|
||||||
|
LaTeX Font Info: Redeclaring font encoding OML on input line 733.
|
||||||
|
LaTeX Font Info: Redeclaring font encoding OMS on input line 734.
|
||||||
|
\macc@depth=\count183
|
||||||
|
\c@MaxMatrixCols=\count184
|
||||||
|
\dotsspace@=\muskip16
|
||||||
|
\c@parentequation=\count185
|
||||||
|
\dspbrk@lvl=\count186
|
||||||
|
\tag@help=\toks17
|
||||||
|
\row@=\count187
|
||||||
|
\column@=\count188
|
||||||
|
\maxfields@=\count189
|
||||||
|
\andhelp@=\toks18
|
||||||
|
\eqnshift@=\dimen140
|
||||||
|
\alignsep@=\dimen141
|
||||||
|
\tagshift@=\dimen142
|
||||||
|
\tagwidth@=\dimen143
|
||||||
|
\totwidth@=\dimen144
|
||||||
|
\lineht@=\dimen145
|
||||||
|
\@envbody=\toks19
|
||||||
|
\multlinegap=\skip53
|
||||||
|
\multlinetaggap=\skip54
|
||||||
|
\mathdisplay@stack=\toks20
|
||||||
|
LaTeX Info: Redefining \[ on input line 2859.
|
||||||
|
LaTeX Info: Redefining \] on input line 2860.
|
||||||
|
)
|
||||||
|
LaTeX Info: Thecontrolsequence`\('isalreadyrobust on input line 129.
|
||||||
|
LaTeX Info: Thecontrolsequence`\)'isalreadyrobust on input line 129.
|
||||||
|
LaTeX Info: Thecontrolsequence`\['isalreadyrobust on input line 129.
|
||||||
|
LaTeX Info: Thecontrolsequence`\]'isalreadyrobust on input line 129.
|
||||||
|
\g_MT_multlinerow_int=\count190
|
||||||
|
\l_MT_multwidth_dim=\dimen146
|
||||||
|
\origjot=\skip55
|
||||||
|
\l_MT_shortvdotswithinadjustabove_dim=\dimen147
|
||||||
|
\l_MT_shortvdotswithinadjustbelow_dim=\dimen148
|
||||||
|
\l_MT_above_intertext_sep=\dimen149
|
||||||
|
\l_MT_below_intertext_sep=\dimen150
|
||||||
|
\l_MT_above_shortintertext_sep=\dimen151
|
||||||
|
\l_MT_below_shortintertext_sep=\dimen152
|
||||||
|
)
|
||||||
|
(/usr/share/texmf-dist/tex/latex/listings/listings.sty
|
||||||
|
\lst@mode=\count191
|
||||||
|
\lst@gtempboxa=\box47
|
||||||
|
\lst@token=\toks21
|
||||||
|
\lst@length=\count192
|
||||||
|
\lst@currlwidth=\dimen153
|
||||||
|
\lst@column=\count193
|
||||||
|
\lst@pos=\count194
|
||||||
|
\lst@lostspace=\dimen154
|
||||||
|
\lst@width=\dimen155
|
||||||
|
\lst@newlines=\count195
|
||||||
|
\lst@lineno=\count196
|
||||||
|
\lst@maxwidth=\dimen156
|
||||||
|
|
||||||
|
(/usr/share/texmf-dist/tex/latex/listings/lstmisc.sty
|
||||||
|
File: lstmisc.sty 2019/09/10 1.8c (Carsten Heinz)
|
||||||
|
\c@lstnumber=\count197
|
||||||
|
\lst@skipnumbers=\count198
|
||||||
|
\lst@framebox=\box48
|
||||||
|
)
|
||||||
|
(/usr/share/texmf-dist/tex/latex/listings/listings.cfg
|
||||||
|
File: listings.cfg 2019/09/10 1.8c listings configuration
|
||||||
|
))
|
||||||
|
Package: listings 2019/09/10 1.8c (Carsten Heinz)
|
||||||
|
|
||||||
|
(/usr/share/texmf-dist/tex/latex/graphics/color.sty
|
||||||
|
Package: color 2019/11/23 v1.2a Standard LaTeX Color (DPC)
|
||||||
|
|
||||||
|
(/usr/share/texmf-dist/tex/latex/graphics-cfg/color.cfg
|
||||||
|
File: color.cfg 2016/01/02 v1.6 sample color configuration
|
||||||
|
)
|
||||||
|
Package color Info: Driver file: pdftex.def on input line 147.
|
||||||
|
|
||||||
|
(/usr/share/texmf-dist/tex/latex/graphics-def/pdftex.def
|
||||||
|
File: pdftex.def 2018/01/08 v1.0l Graphics/color driver for pdftex
|
||||||
|
))
|
||||||
|
(/usr/share/texmf-dist/tex/latex/base/inputenc.sty
|
||||||
|
Package: inputenc 2018/08/11 v1.3c Input encoding file
|
||||||
|
\inpenc@prehook=\toks22
|
||||||
|
\inpenc@posthook=\toks23
|
||||||
|
)
|
||||||
|
(/usr/share/texmf-dist/tex/latex/listings/lstlang1.sty
|
||||||
|
File: lstlang1.sty 2019/09/10 1.8c listings language file
|
||||||
|
)
|
||||||
|
(/usr/share/texmf-dist/tex/latex/listings/lstlang2.sty
|
||||||
|
File: lstlang2.sty 2019/09/10 1.8c listings language file
|
||||||
|
)
|
||||||
|
(/usr/share/texmf-dist/tex/latex/listings/lstmisc.sty
|
||||||
|
File: lstmisc.sty 2019/09/10 1.8c (Carsten Heinz)
|
||||||
|
)
|
||||||
|
(/usr/share/texmf-dist/tex/latex/l3backend/l3backend-pdfmode.def
|
||||||
|
File: l3backend-pdfmode.def 2020-02-23 L3 backend support: PDF mode
|
||||||
|
\l__kernel_color_stack_int=\count199
|
||||||
|
\l__pdf_internal_box=\box49
|
||||||
|
)
|
||||||
|
No file Questions.aux.
|
||||||
|
\openout1 = `Questions.aux'.
|
||||||
|
|
||||||
|
LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 44.
|
||||||
|
LaTeX Font Info: ... okay on input line 44.
|
||||||
|
LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 44.
|
||||||
|
LaTeX Font Info: ... okay on input line 44.
|
||||||
|
LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 44.
|
||||||
|
LaTeX Font Info: ... okay on input line 44.
|
||||||
|
LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 44.
|
||||||
|
LaTeX Font Info: ... okay on input line 44.
|
||||||
|
LaTeX Font Info: Checking defaults for TS1/cmr/m/n on input line 44.
|
||||||
|
LaTeX Font Info: ... okay on input line 44.
|
||||||
|
LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 44.
|
||||||
|
LaTeX Font Info: ... okay on input line 44.
|
||||||
|
LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 44.
|
||||||
|
LaTeX Font Info: ... okay on input line 44.
|
||||||
|
(/usr/share/texmf-dist/tex/latex/graphics/graphicx.sty
|
||||||
|
Package: graphicx 2019/11/30 v1.2a Enhanced LaTeX Graphics (DPC,SPQR)
|
||||||
|
|
||||||
|
(/usr/share/texmf-dist/tex/latex/graphics/graphics.sty
|
||||||
|
Package: graphics 2019/11/30 v1.4a Standard LaTeX Graphics (DPC,SPQR)
|
||||||
|
|
||||||
|
(/usr/share/texmf-dist/tex/latex/graphics/trig.sty
|
||||||
|
Package: trig 2016/01/03 v1.10 sin cos tan (DPC)
|
||||||
|
)
|
||||||
|
(/usr/share/texmf-dist/tex/latex/graphics-cfg/graphics.cfg
|
||||||
|
File: graphics.cfg 2016/06/04 v1.11 sample graphics configuration
|
||||||
|
)
|
||||||
|
Package graphics Info: Driver file: pdftex.def on input line 105.
|
||||||
|
)
|
||||||
|
\Gin@req@height=\dimen157
|
||||||
|
\Gin@req@width=\dimen158
|
||||||
|
)
|
||||||
|
\c@lstlisting=\count266
|
||||||
|
|
||||||
|
(/usr/share/texmf-dist/tex/context/base/mkii/supp-pdf.mkii
|
||||||
|
[Loading MPS to PDF converter (version 2006.09.02).]
|
||||||
|
\scratchcounter=\count267
|
||||||
|
\scratchdimen=\dimen159
|
||||||
|
\scratchbox=\box50
|
||||||
|
\nofMPsegments=\count268
|
||||||
|
\nofMParguments=\count269
|
||||||
|
\everyMPshowfont=\toks24
|
||||||
|
\MPscratchCnt=\count270
|
||||||
|
\MPscratchDim=\dimen160
|
||||||
|
\MPnumerator=\count271
|
||||||
|
\makeMPintoPDFobject=\count272
|
||||||
|
\everyMPtoPDFconversion=\toks25
|
||||||
|
) (/usr/share/texmf-dist/tex/latex/epstopdf-pkg/epstopdf-base.sty
|
||||||
|
Package: epstopdf-base 2020-01-24 v2.11 Base part for package epstopdf
|
||||||
|
Package epstopdf-base Info: Redefining graphics rule for `.eps' on input line 4
|
||||||
|
85.
|
||||||
|
|
||||||
|
(/usr/share/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg
|
||||||
|
File: epstopdf-sys.cfg 2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Liv
|
||||||
|
e
|
||||||
|
)) [1
|
||||||
|
|
||||||
|
{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}] (./Questions.aux) )
|
||||||
|
Here is how much of TeX's memory you used:
|
||||||
|
4110 strings out of 482906
|
||||||
|
56889 string characters out of 5959892
|
||||||
|
481182 words of memory out of 5000000
|
||||||
|
19362 multiletter control sequences out of 15000+600000
|
||||||
|
537879 words of font info for 44 fonts, out of 8000000 for 9000
|
||||||
|
14 hyphenation exceptions out of 8191
|
||||||
|
37i,5n,51p,242b,1155s stack positions out of 5000i,500n,10000p,200000b,80000s
|
||||||
|
</usr/s
|
||||||
|
hare/texmf-dist/fonts/type1/public/amsfonts/cm/cmbx12.pfb></usr/share/texmf-dis
|
||||||
|
t/fonts/type1/public/amsfonts/cm/cmmi10.pfb></usr/share/texmf-dist/fonts/type1/
|
||||||
|
public/amsfonts/cm/cmr10.pfb></usr/share/texmf-dist/fonts/type1/public/amsfonts
|
||||||
|
/cm/cmr17.pfb></usr/share/texmf-dist/fonts/type1/public/amsfonts/cm/cmr7.pfb></
|
||||||
|
usr/share/texmf-dist/fonts/type1/public/amsfonts/cm/cmsy10.pfb></usr/share/texm
|
||||||
|
f-dist/fonts/type1/public/amsfonts/cm/cmtt9.pfb>
|
||||||
|
Output written on Questions.pdf (1 page, 67274 bytes).
|
||||||
|
PDF statistics:
|
||||||
|
36 PDF objects out of 1000 (max. 8388607)
|
||||||
|
25 compressed objects within 1 object stream
|
||||||
|
0 named destinations out of 1000 (max. 500000)
|
||||||
|
1 words of extra memory for PDF output out of 10000 (max. 10000000)
|
||||||
|
|
BIN
SPE/OPT/TP 2/Questions.pdf
Normal file
BIN
SPE/OPT/TP 2/Questions.pdf
Normal file
Binary file not shown.
BIN
SPE/OPT/TP 2/Questions.synctex.gz
Normal file
BIN
SPE/OPT/TP 2/Questions.synctex.gz
Normal file
Binary file not shown.
59
SPE/OPT/TP 2/Questions.tex
Normal file
59
SPE/OPT/TP 2/Questions.tex
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
\documentclass[a4paper,10pt]{article}
|
||||||
|
%\documentclass[a4paper,10pt]{scrartcl}
|
||||||
|
|
||||||
|
\usepackage{mathtools}
|
||||||
|
|
||||||
|
\usepackage{listings}
|
||||||
|
\usepackage{color}
|
||||||
|
\usepackage[utf8]{inputenc}
|
||||||
|
\definecolor{dkgreen}{rgb}{0,0.6,0}
|
||||||
|
\definecolor{gray}{rgb}{0.5,0.5,0.5}
|
||||||
|
\definecolor{mauve}{rgb}{0.58,0,0.82}
|
||||||
|
\lstset{frame=tb,
|
||||||
|
language=caml,
|
||||||
|
aboveskip=3mm,
|
||||||
|
belowskip=3mm,
|
||||||
|
showstringspaces=false,
|
||||||
|
columns=flexible,
|
||||||
|
basicstyle={\small\ttfamily},
|
||||||
|
numbers=none,
|
||||||
|
numberstyle=\tiny\color{gray},
|
||||||
|
keywordstyle=\color{blue},
|
||||||
|
commentstyle=\color{dkgreen},
|
||||||
|
stringstyle=\color{mauve},
|
||||||
|
breaklines=true,
|
||||||
|
breakatwhitespace=true,
|
||||||
|
tabsize=3
|
||||||
|
}
|
||||||
|
\renewcommand{\thesection}{\Roman{section}}
|
||||||
|
\newcommand{\sectioni}[2]{\setcounter{section}{#1}\addtocounter{section}{-1}\section{#2}}
|
||||||
|
\newcommand{\subsectioni}[2]{\setcounter{subsection}{#1}\addtocounter{subsection}{-1}\subsection{#2}}
|
||||||
|
\title{Questions du TP2}
|
||||||
|
\author{}
|
||||||
|
\date{}
|
||||||
|
|
||||||
|
\pdfinfo{%
|
||||||
|
/Title ()
|
||||||
|
/Author ()
|
||||||
|
/Creator ()
|
||||||
|
/Producer ()
|
||||||
|
/Subject ()
|
||||||
|
/Keywords ()
|
||||||
|
}
|
||||||
|
|
||||||
|
\begin{document}
|
||||||
|
\maketitle
|
||||||
|
\sectioni{3}{Forme normale disjonctive}
|
||||||
|
\subsectioni{1}{Question :}
|
||||||
|
On se sert du code écrit aux questions précédentes,
|
||||||
|
\begin{lstlisting}
|
||||||
|
# table_de_verite 3 g;;
|
||||||
|
- : bool array = [|true; false; true; false; true; false; false; true|]
|
||||||
|
\end{lstlisting}
|
||||||
|
$\mathcal{G} =
|
||||||
|
(\neg V_2 \wedge \neg V_1 \wedge \neg V_0) \vee
|
||||||
|
(\neg V_2 \wedge V_1 \wedge \neg V_0) \vee
|
||||||
|
(V_2 \wedge \neg V_1 \wedge \neg V_0) \vee
|
||||||
|
(V_2 \wedge V_1 \wedge V_0)
|
||||||
|
$
|
||||||
|
\end{document}
|
@ -19,15 +19,20 @@ let rec evaluer_tab t form = match form with
|
|||||||
| Or (h::tail) -> (evaluer_tab t h) || (evaluer_tab t (Or tail));;
|
| Or (h::tail) -> (evaluer_tab t h) || (evaluer_tab t (Or tail));;
|
||||||
5 lsr 1;;
|
5 lsr 1;;
|
||||||
|
|
||||||
let evaluer n c f =
|
let contexte_from_int n c =
|
||||||
let contexte = Array.make n false in
|
let contexte = Array.make n false in
|
||||||
let j = ref c in
|
let j = ref c in
|
||||||
for i = 0 to n-1 do
|
for i = 0 to n-1 do
|
||||||
contexte.(i) <- !j mod 2 = 0;
|
contexte.(i) <- !j mod 2 <> 0;
|
||||||
j := !j lsr 1
|
j := !j lsr 1
|
||||||
done;
|
done;
|
||||||
|
contexte;;
|
||||||
|
|
||||||
|
let evaluer n c f =
|
||||||
|
let contexte = contexte_from_int n c in
|
||||||
evaluer_tab contexte f;;
|
evaluer_tab contexte f;;
|
||||||
evaluer 3 0 f;;
|
|
||||||
|
evaluer 3 3 g;;
|
||||||
|
|
||||||
let table_de_verite n f =
|
let table_de_verite n f =
|
||||||
let rec puis n a = match n with
|
let rec puis n a = match n with
|
||||||
@ -40,3 +45,23 @@ let table_de_verite n f =
|
|||||||
res;;
|
res;;
|
||||||
table_de_verite 3 g;;
|
table_de_verite 3 g;;
|
||||||
|
|
||||||
|
let forme_normale_disjonctive n f =
|
||||||
|
let rec puis n a = match n with
|
||||||
|
| 0 -> 1
|
||||||
|
| _ -> a * (puis (n-1) a) in
|
||||||
|
|
||||||
|
let rec disjonction c conjs =
|
||||||
|
|
||||||
|
let rec conjonction cont conj n = match n with
|
||||||
|
| -1 -> And conj
|
||||||
|
| _ -> conjonction cont ((if cont.(n) then (Var n) else Not (Var n))::conj) (n-1) in
|
||||||
|
|
||||||
|
match c with
|
||||||
|
| -1 -> Or conjs
|
||||||
|
| _ -> let contexte = context_from_int n c in
|
||||||
|
if evaluer_tab contexte f then
|
||||||
|
disjonction (c-1) ((conjonction contexte [] (n-1))::conjs)
|
||||||
|
else
|
||||||
|
disjonction (c-1) conjs in
|
||||||
|
disjonction ((puis n 2) -1) [];;
|
||||||
|
forme_normale_disjonctive 3 g;;
|
31
SPE/OPT/TP 2/tp2.kilepr
Normal file
31
SPE/OPT/TP 2/tp2.kilepr
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
[General]
|
||||||
|
bib_extensions=.bib
|
||||||
|
bibliographyBackendAutoDetected=
|
||||||
|
bibliographyBackendUserOverride=
|
||||||
|
def_graphic_ext=eps
|
||||||
|
img_extIsRegExp=false
|
||||||
|
img_extensions=.eps .jpg .jpeg .png .pdf .ps .fig .gif
|
||||||
|
kileprversion=3
|
||||||
|
kileversion=2.9.93
|
||||||
|
masterDocument=
|
||||||
|
name=TP2
|
||||||
|
pkg_extIsRegExp=false
|
||||||
|
pkg_extensions=.cls .sty .bbx .cbx .lbx
|
||||||
|
src_extIsRegExp=false
|
||||||
|
src_extensions=.tex .ltx .latex .dtx .ins
|
||||||
|
|
||||||
|
[Tools]
|
||||||
|
MakeIndex=
|
||||||
|
QuickBuild=
|
||||||
|
|
||||||
|
[item:Questions.tex]
|
||||||
|
archive=true
|
||||||
|
encoding=
|
||||||
|
highlight=LaTeX
|
||||||
|
mode=LaTeX
|
||||||
|
|
||||||
|
[item:tp2.kilepr]
|
||||||
|
archive=true
|
||||||
|
encoding=
|
||||||
|
highlight=
|
||||||
|
mode=
|
Loading…
Reference in New Issue
Block a user