Accueil Foire Aux Questions Trouver d'autres membres Rechercher Utilisez le vBpad pour stocker des notes personnelles Ici, vous pouvez voir les sujets auxquels vous avez souscris, vos messages privés; et modifier vos informations personnelles et préférences. Statistiques du forum Enregistrez vous gratuitement ! Se déconnecter  
Forum OXMO Forum OXMO > Section Technique > Actualité - Débats > Concours de programmation ICFP


Aller au Forum:
Notez ce sujet :

Page(s) (4): [ 1   2   3   4   > ]   Sujet précédent   Sujet suivant
Auteur
Sujet Poster un nouveau sujet    Poster une réponse
 Zakath  Rechercher tous les messages de ce membre Cliquez ici pour envoyer un message privé à cet utilisateur
Guru

Déconnecté

Niveau : 5
N° de Membre : 7213

Ancienneté : 97%
Participation : 12%
Inscription: 15 Dec 2002
Localisation: Copenhague
Messages: 9866
Sujets Lancés : 426

Post Concours de programmation ICFP

Ici le thread de la team pour l'ICFP (jusqu'à lundi soir). On espère ne pas gêner les autres utilisateurs du forum (vous avez le droit de venir vous moquer de nous ou nous donner des conseils avisés ).

A venir (dans quelques minutes) : résumé succint des tâches (non, pas KeySoze )


Donc, en très bref, le but est de rendre un automate fini (dans le même genre que l'ASM). Voir la section 2.8 pour les détails, mais en gros, ça comprend des instructions du genre "Bouger", "Détecter", "Ramasser", "Lâcher" avec des branchements conditionnels.
Le jeu est simple : on est une fourmilière. On a un certain nombre de fourmis qui doivent écumer une carte pour ramasser le plus de nourriture possible. Une carte, c'est : des cailloux (on peut pas y aller) ou de la plaine (on peut y aller). Sur de la plaine, on peut avoir : une fourmilière (où il faut aller lâcher la nourriture), de la nourriture, des marqueurs chimiques (qu'on a posé ou enlevé), une fourmi (amie ou ennemie) ou rien du tout. Histoire de rigoler, la carte est hexagonale... Pour tuer une fourmi adverse, c'est très compliqué : il faut l'entourer de 5 ou 6 fourmis amies dans les cases adjacentes.
Une fourmi peut voir ce qu'il y a (nourriture, cailloux, marqueur, fourmilières...) sur les cases juste devant elle, pas plus.

Maintenant, ce qu'on doit faire, c'est :
1) écrire un jeu de règles pour simuler le monde et tester nos fourmis
2) écrire un programme qui écrit des fourmis


__________________

Allez jeter un œil à mon portfolio !

Edité par Zakath le 04-06-2004 à 18:58

Signaler ce message à un modérateur | IP: Logguée
Temps en ligne : 103 Jours, 6 Heures, 14 Minutes, 38 Secondes en ligne

Old Post 04-06-2004 18:44
Cliquez ici pour voir le profil de Zakath Cliquez ici pour lui envoyer un message privé  Visiter la Page Perso de Zakath! Trouver plus de messages de Zakath Ajouter Zakath à votre liste d'amis Editer/Effacer le Message Citer le message dans la réponse
 KeySoze  Rechercher tous les messages de ce membre Cliquez ici pour envoyer un message privé à cet utilisateur
Modérateur

Déconnecté

Niveau : 5
N° de Membre : 4449

Ancienneté : 98%
Participation : 8%
Inscription: 15 Sep 2002
Localisation: IDF
Age: 42
Messages: 6370
Sujets Lancés : 603

Allez, au boulot Zakathounet


__________________
OXMO : On est plus intelligent à plusieurs que tout seul...mais certains aident moins que d'autres


Signaler ce message à un modérateur | IP: Logguée
Temps en ligne : 46 Jours, 18 Heures, 58 Minutes, 16 Secondes en ligne

Old Post 04-06-2004 18:47
Cliquez ici pour voir le profil de KeySoze Cliquez ici pour lui envoyer un message privé  Trouver plus de messages de KeySoze Ajouter KeySoze à votre liste d'amis Editer/Effacer le Message Citer le message dans la réponse
 RhEcK  Rechercher tous les messages de ce membre Cliquez ici pour envoyer un message privé à cet utilisateur
Guru

Déconnecté

Niveau : 5
N° de Membre : 5548

Ancienneté : 98%
Participation : 9%
Inscription: 31 Oct 2002
Localisation: amiens
Age: 41
Messages: 7657
Sujets Lancés : 66

c'est ce que j'avais compris, je suis pas si nul en anglais que ca!!


__________________
mess with the best, die like the rest


<<~~=!!!RhEcK!!!=~~>>


Signaler ce message à un modérateur | IP: Logguée
Temps en ligne : 23 Jours, 18 Heures, 29 Minutes, 34 Secondes en ligne

Old Post 04-06-2004 20:16
Cliquez ici pour voir le profil de RhEcK Cliquez ici pour lui envoyer un message privé  Trouver plus de messages de RhEcK Ajouter RhEcK à votre liste d'amis       Editer/Effacer le Message Citer le message dans la réponse
 Ricco  Rechercher tous les messages de ce membre Cliquez ici pour envoyer un message privé à cet utilisateur
Confirmé

Déconnecté

Niveau : 2
N° de Membre : 629

Ancienneté : 100%
Participation : 1%
Inscription: 13 Mar 2002
Localisation: Dans le 9 4
Age: 46
Messages: 842
Sujets Lancés : 39

C'est domage que j'aime pas caml parce que ça a l'air bien sympa votre truc


__________________
"Hi ! I am a signature virus ! Put me in your signature to help me spread myself around this forum !"


Signaler ce message à un modérateur | IP: Logguée
Temps en ligne : 4 Jours, 7 Heures, 29 Minutes, 21 Secondes en ligne

Old Post 04-06-2004 20:33
Cliquez ici pour voir le profil de Ricco Cliquez ici pour lui envoyer un message privé  Trouver plus de messages de Ricco Ajouter Ricco à votre liste d'amis       Editer/Effacer le Message Citer le message dans la réponse
 bill_bool  Rechercher tous les messages de ce membre Cliquez ici pour envoyer un message privé à cet utilisateur
Confirmé

Déconnecté

Niveau : 2
N° de Membre : 38

Ancienneté : 100%
Participation : 1%
Inscription: 23 Feb 2002
Localisation: NAP
Age: 54
Messages: 686
Sujets Lancés : 11

Bonnes nuits blanches les gars. Allez, un p'tit verre de Madiran à votre santé (et au dodo pour moi...).

Bon coding, bons cafés et surtout bon courage !


Signaler ce message à un modérateur | IP: Logguée
Temps en ligne : 7 Jours, 7 Heures, 0 Minute, 21 Secondes en ligne

Old Post 05-06-2004 01:43
Cliquez ici pour voir le profil de bill_bool Cliquez ici pour lui envoyer un message privé  Trouver plus de messages de bill_bool Ajouter bill_bool à votre liste d'amis       Editer/Effacer le Message Citer le message dans la réponse
 KeySoze  Rechercher tous les messages de ce membre Cliquez ici pour envoyer un message privé à cet utilisateur
Modérateur

Déconnecté

Niveau : 5
N° de Membre : 4449

Ancienneté : 98%
Participation : 8%
Inscription: 15 Sep 2002
Localisation: IDF
Age: 42
Messages: 6370
Sujets Lancés : 603

Faut pas croire, on a dormi quand même

Cela dit la nuit fut courte en ce qui me concerne, je suis de nouveau dessus pour essayer de décrypter complètement ce truc de ouf


__________________
OXMO : On est plus intelligent à plusieurs que tout seul...mais certains aident moins que d'autres


Signaler ce message à un modérateur | IP: Logguée
Temps en ligne : 46 Jours, 18 Heures, 58 Minutes, 16 Secondes en ligne

Old Post 05-06-2004 08:08
Cliquez ici pour voir le profil de KeySoze Cliquez ici pour lui envoyer un message privé  Trouver plus de messages de KeySoze Ajouter KeySoze à votre liste d'amis Editer/Effacer le Message Citer le message dans la réponse
 KeySoze  Rechercher tous les messages de ce membre Cliquez ici pour envoyer un message privé à cet utilisateur
Modérateur

Déconnecté

Niveau : 5
N° de Membre : 4449

Ancienneté : 98%
Participation : 8%
Inscription: 15 Sep 2002
Localisation: IDF
Age: 42
Messages: 6370
Sujets Lancés : 603

Résumé en français pour mettre les choses au clair !

But du jeu :
Ramener le plus de nourriture à la fourmilière

Identification d'une fourmi par :
- son ID (unique)
- sa couleur
- son état (state de 0 à max 9999)
- un entier "resting" (compris entre 0 et 14) (cf page 4 pour explication)
- sa direction
- un booléen : "has food" (dit si la fourmi porte ou non une particule de FOOD)

1 Fourmi peut :
- poser des markers
- sentir un de ses 6 markers (numérotés de 0 à 5)
- supprimer un de ses 6 markers
- sentir les 3 cases qui sont devant sentir celle ou elle est
- sentir les markers des fourmis de l'équipe adverse sans les reconnaitre
- attaquer 1 fourmi adverse en l'encerclant (la fourmi adverse devient alors FOOD)
- ne peut porter qu'une seule unité de FOOD à la fois

Chaque cellule est soit un rocher, soit une colline, si elle est une colline, elle contient :
- au plus une fourmi
- un nombre de particules de FOOD positif ou nul (quelconque)
- des markers de chaque équipe

La cartographie = fichier tel que :
- 1ère ligne = entier x = taille suivant axe x = 100
- 2ème ligne = entier y = taille suivant axe y = 100
- y lignes, chaque ligne contenant x caractères (de longueur 1), séparés par des espaces
caractères possibles :
# cellule "rocher"
. cellule "plaine" (sans rien)
+ cellule fourmilière rouge
- cellule fourmilière noire
1 à 9 : cellule "plaine" contenant le nombre de particules de FOOD donné

Citation:
EXEMPLE :
10
10
# # # # # # # # # #
# 9 9 . . . . 3 3 #
# 9 # . - - - - - #
# . # - - - - - - #
# . . 5 - - - - - #
# + + + + + 5 . . #
# + + + + + + # . #
# + + + + + . # 9 #
# 3 3 . . . . 9 9 #
# # # # # # # # # #


Art Martial :
- 1 fourmi adjacente à 5 (ou 6) fourmis adverses meurt
- 1 fourmi qui meurt devient 3 particules de FOOD

Règles d'un monde tiré alétoirement (cf page 14 !) :
- taille du monde : 100x100 cellules
- nombre de fourmis : 91
- 2 fourmilière hexagonales (taille d'une arrête = 8 unités)
- 10 rochers
- 8 taches de FOOD

Déroulement du jeu :
- Chargement du monde et du "cerveau" des 2 types de fourmis
- Chaque cellule de la fourmilière rouge (respectivement noire) est peuplée par 1 fourmi rouge (respectivement noire)
- Chaque fourmi débute avec l'état 0 (state 0) regardant vers l'est (direction 0)
- assigement d'1 unique ID à chaque fourmi :
--------------------->
|0 1 2 3 4 5 6 .....
|..........................
|..........................
|..........................
|..........................
v..........................
- 1 GAME se déroule en 100 000 rounds (100 000 instructions exécutées pour chaque fourmi du jeu)
- 2 équipent se rencontrent 2 fois sur 1 même map, en étant une fois rouge et l'autre fois noire.
Gain d'1 GAME => 2 points pour le gagnant.
Exequo lors d'1 GAME => 1 points pour chaque équipe.
- Ils effectueront le nombre de GAMES nécessaires pour départager tout le monde.

Définitions des types :

type pos = (int, int)
définit la position (x,y) de la fourmi


type dir = 0..5
définit la direction de la fourmi


type left_or_right = Left | Right
permet de "tourner" la fourmi vers la gauche ou la droite

type sense_dir =
Here /* sense the ant’s current cell */
| Ahead /* sense the cell straight ahead in the direction ant is facing */
| LeftAhead /* sense the cell that would be ahead if ant turned left */
| RightAhead /* sense the cell that would be ahead if ant turned right */

permet à une fourmi de sentir une des 3 cases devant elle ou celle où elle se trouve

type color = Red | Black
permet de faire la distinction entre les 2 équipes, en affectant à chacune une couleur

type marker = 0..5
chaque fourmi a le droit d'utiliser ses 6 markers

type condition =
Friend /* cell contains an ant of the same color */
| Foe /* cell contains an ant of the other color */
| FriendWithFood /* cell contains an ant of the same color carrying food */
| FoeWithFood /* cell contains an ant of the other color carrying food */
| Food /* cell contains food (not being carried by an ant) */
| Rock /* cell is rocky */
| Marker(marker) /* cell is marked with a marker of this ant’s color */
| FoeMarker /* cell is marked with *some* marker of the other color */
| Home /* cell belongs to this ant’s anthill */
| FoeHome /* cell belongs to the other anthill */

Type définissant toutes les conditions permettant de localiser ce que l'on cherche sur une cellule donnée (ami, ennemi, ami avec nourriture, ennemi avec nourriture, nourriture, rocher, un de ses markers, un marker de l'équipe adverse, sa fourmilière, la fourmière adverse)

type state = int
Définit l'état actuel de la fourmi

type instruction =
Sense(sense_dir, state, state, condition)
| Mark(marker, state)
| Unmark(marker, state)
| PickUp(state, state)
| Drop(state)
| Turn(left_or_right, state)
| Move(state, state)
| Flip(int, state, state)

A chaque état, on associe une instruction. A chaque round (tour de jeu), chaque fourmi réalise une instruction et passe ainsi d'un état à un autre. On réalise un tour de jeu en exécutant la prochaine instruction de chaque fourmi dans l'ordre de leurs ID, c'est à dire de l'ID 0 à ID_MAX.

---
Voilà, j'en ai fini, ce résumé a 2 buts, être sûr qu'on a bien compris les mêmes choses donc les bonnes choses, et nous aider pendant ce WE plutot que de revenir à l'anglais encore et encore...
Si y a des erreurs, surtout faites moi signe


__________________
OXMO : On est plus intelligent à plusieurs que tout seul...mais certains aident moins que d'autres

Edité par KeySoze le 05-06-2004 à 15:14
Raison de l'édition: markers de chaque équipe sur 1 cellule

Signaler ce message à un modérateur | IP: Logguée
Temps en ligne : 46 Jours, 18 Heures, 58 Minutes, 16 Secondes en ligne

Old Post 05-06-2004 09:16
Cliquez ici pour voir le profil de KeySoze Cliquez ici pour lui envoyer un message privé  Trouver plus de messages de KeySoze Ajouter KeySoze à votre liste d'amis Editer/Effacer le Message Citer le message dans la réponse
 Zakath  Rechercher tous les messages de ce membre Cliquez ici pour envoyer un message privé à cet utilisateur
Guru

Déconnecté

Niveau : 5
N° de Membre : 7213

Ancienneté : 97%
Participation : 12%
Inscription: 15 Dec 2002
Localisation: Copenhague
Messages: 9866
Sujets Lancés : 426

Ca a l'air d'aller.
Bien joué


__________________

Allez jeter un œil à mon portfolio !


Signaler ce message à un modérateur | IP: Logguée
Temps en ligne : 103 Jours, 6 Heures, 14 Minutes, 38 Secondes en ligne

Old Post 05-06-2004 09:22
Cliquez ici pour voir le profil de Zakath Cliquez ici pour lui envoyer un message privé  Visiter la Page Perso de Zakath! Trouver plus de messages de Zakath Ajouter Zakath à votre liste d'amis Editer/Effacer le Message Citer le message dans la réponse
 Zakath  Rechercher tous les messages de ce membre Cliquez ici pour envoyer un message privé à cet utilisateur
Guru

Déconnecté

Niveau : 5
N° de Membre : 7213

Ancienneté : 97%
Participation : 12%
Inscription: 15 Dec 2002
Localisation: Copenhague
Messages: 9866
Sujets Lancés : 426

Premiers programmes. Le serveur a l'air de tourner (maj : correction de quelques bugs. J'ai réduit à 10000 tours au lieu de 100 000).
Re-edit : avec une vraie carte (sample0.world, renommée en sample.world), ça marche nickel.

code:
type pos = int * int;; type left_or_right = Left | Right;; type sense_dir = Here | Ahead | RightAhead | LeftAhead;; type color = Black | Red;; type ant = {mutable id :int; col :color; mutable resting :int; mutable dir :int; mutable has_food :bool; mutable state :int};; type case = Rock | Clear | AntHill of color;; type etat_case = {mutable phys :case; mutable food :int; mutable fourmi :ant; mutable marker :bool array * bool array};; type sensedir = Here |Ahead |LeftAhead |RightAhead;; type condition = Friend |Foe |FriendWithFood |FoeWithFood |Nourriture |Caillou |Marker of int |FoeMarker |Home |FoeHome;; type instruction = Sense of sensedir * int * int * condition |Mark of int * int |Unmark of int * int |PickUp of int * int |Drop of int |Turn of left_or_right * int |Move of int * int |Flip of int * int * int;; let void_ant = {id = -1; col = Red; resting = 0; dir = 0; has_food = false; state = 0};; let init_ant ident couleur = {id = ident; col = couleur; resting = 0; dir = 0; has_food = false; state = 0};; let adjacent_cell p d = let (x, y) = p in match d with |0 -> (x+1,y) |1 -> if (y mod 2 = 0) then (x,y+1) else (x+1,y+1) |2 -> if (y mod 2 = 0) then (x-1,y+1) else (x,y+1) |3 -> (x-1,y) |4 -> if (y mod 2 = 0) then (x-1,y-1) else (x,y-1) |5 -> if (y mod 2 = 0) then (x,y-1) else (x+1,y-1) |_ -> failwith "Mauvaise direction";; let turn d = function |Left -> (d + 5) mod 6 |Right -> (d + 1) mod 6;; let sensed_cell p d = function |Here -> p |Ahead -> adjacent_cell p d |LeftAhead -> adjacent_cell p (turn d Left) |RightAhead -> adjacent_cell p (turn d Right);; let other_color = function |Red -> Black |Black -> Red;; (* Lecture d'une map *) let read_map file = let fcarte = open_in file in let x_dim = int_of_string (input_line fcarte) in let y_dim = int_of_string (input_line fcarte) in let carte = Array.create_matrix x_dim y_dim {phys = Clear; food = 0; fourmi = void_ant; marker = ([|false;false;false;false;false;false|], [|false; false; false; false; false;false|])} in for i = 0 to (y_dim - 1) do let ligne = input_line fcarte in let j = ref 0 and n = String.length ligne and k = ref 0 and f1 = ref 0 and f2 = ref 0 in while !j < n do match ligne.[!j] with |' ' -> j:= !j+1 |'#' -> carte.(i).(!k).phys <- Rock; j:= !j+1; k:= !k+1 |'.' -> j:= !j+1; k:= !k+1 |'+' -> carte.(i).(!k).phys <- AntHill Red; carte.(i).(!k).fourmi <- (init_ant !f1 Red); j:= !j+1; k:= !k+1; f1:= !f1+1 |'-' -> carte.(i).(!k).phys <- AntHill Black; carte.(i).(!k).fourmi <- (init_ant !f2 Black); j:= !j+1; k:= !k+1; f2:= !f2+1 |f -> carte.(i).(!k).food <- (int_of_char f); j:= !j+1; k:= !k+1 done done; (carte, x_dim, y_dim);; let (carte, x_dim, y_dim) = read_map "E:\\Informatique\\ICFP\\sample.world";; (* Lecture d'un cerveau de fourmi *) let read_brain file = let fbrain = open_in file in let instruct = Array.create 9999 "" and k = ref 0 in try for i = 0 to 9998 do instruct.(i) <- input_line fbrain; k:= !k+1 done; instruct; with End_of_file -> let t = Array.create !k "" in for i = 0 to (!k-1) do t.(i) <- instruct.(i) done; t;; let instruct1 = read_brain "E:\\Informatique\\ICFP\\sample.ant";; let instruct2 = read_brain "E:\\Informatique\\ICFP\\sample.ant";; let rec print_list = function |[] -> () |t::q -> Printf.printf "%s\n" t; print_list q;; let lexeur inst = let i = ref 0 and i2 = ref 0 and l = ref [] in while !i < (String.length inst) do while (!i < (String.length inst) && inst.[!i] <> ' ') do i:= !i+1 done; l:= (String.sub inst !i2 (!i - !i2))::(!l); i:= !i+1; i2 := !i done; List.rev(!l);; let cond_of_string = function |"Friend" -> Friend |"Foe" -> Foe |"FriendWithFood" -> FriendWithFood |"FoeWithFood" -> FoeWithFood |"Rock" -> Caillou |"Food" -> Nourriture |"Marker 0" -> Marker 0 |"Marker 1" -> Marker 1 |"Marker 2" -> Marker 2 |"Marker 3" -> Marker 3 |"Marker 4" -> Marker 4 |"Marker 5" -> Marker 5 |"FoeMarker" -> FoeMarker |"Home" -> Home |"FoeHome" -> FoeHome |_ -> failwith "Erreur de condition";; let lr_of_string = function |"Left" -> Left |"Right" -> Right |_ -> failwith "Erreur de direction de virage";; let sensedir_of_string = function |"Here" -> Here |"Ahead" -> Ahead |"LeftAhead" -> LeftAhead |"RightAhead" -> RightAhead |_ -> failwith "Erreur de direction de détection";; let parseur = function |["Sense";sd;st1;st2;cond] -> Sense ((sensedir_of_string sd), (int_of_string st1), (int_of_string st2), (cond_of_string cond)) |["Sense";sd;st1;st2;cond;i] -> Sense ((sensedir_of_string sd), (int_of_string st1), (int_of_string st2), (cond_of_string (cond^" "^i))) |["Mark";i;st] -> Mark ((int_of_string i), (int_of_string st)) |["Unmark";i;st] -> Unmark ((int_of_string i), (int_of_string st)) |["PickUp";st1;st2] -> PickUp ((int_of_string st1), (int_of_string st2)) |["Drop";st] -> Drop (int_of_string st) |["Turn";lr;st] -> Turn ((lr_of_string lr), (int_of_string st)) |["Move";st1;st2] -> Move ((int_of_string st1), (int_of_string st2)) |["Flip";p;st1;st2] -> Flip ((int_of_string p), (int_of_string st1), (int_of_string st2)) |_ -> failwith "Instruction non valide";; let make_inst t = let n = Array.length t in let inst = Array.create n (Drop 0) in for i = 0 to (n-1) do inst.(i) <- parseur (lexeur (t.(i))) done; inst;; let inst1 = make_inst instruct1;; let inst2 = make_inst instruct2;; let rocky (x,y) = try carte.(x).(y).phys = Rock with Invalid_argument("Array.get") -> true;; let some_ant_is_at (x,y) = carte.(x).(y).fourmi.id >= 0;; let find_ant ident col = let f = ref void_ant and x= ref (-1) and y = ref (-1) in for i = 0 to (y_dim-1) do for j = 0 to (x_dim-1) do if (carte.(i).(j).fourmi.id = ident && carte.(i).(j).fourmi.col = col) then (f:= carte.(i).(j).fourmi; x:= i; y:= j) done done; (!f, !x, !y);; let ant_is_alive ident col = let (f,x,y) = (find_ant ident col) in f.id >= 0;; let ant_pos ident col = let (f,i,j) = (find_ant ident col) in (i,j);; let test_anthill (x,y) col = match carte.(x).(y).phys with |AntHill c -> c = col |_ -> false;; let test_marker t = let b = ref false in for i = 0 to 5 do b:= (!b || t.(i)) done; !b;; let cell_match (x,y) col = function |Caillou -> rocky (x,y) |Friend -> carte.(x).(y).fourmi.id >=0 && carte.(x).(y).fourmi.col = col |Foe -> carte.(x).(y).fourmi.id >=0 && carte.(x).(y).fourmi.col <> col |FriendWithFood -> carte.(x).(y).fourmi.id >=0 && carte.(x).(y).fourmi.col = col && carte.(x).(y).fourmi.has_food |FoeWithFood -> carte.(x).(y).fourmi.id >=0 && carte.(x).(y).fourmi.col <> col && carte.(x).(y).fourmi.has_food |Nourriture -> carte.(x).(y).food > 0 |Marker i -> if col = Red then (fst(carte.(x).(y).marker)).(i) else (snd(carte.(x).(y).marker)).(i) |FoeMarker -> if col = Red then (test_marker (snd(carte.(x).(y).marker))) else test_marker (fst(carte.(x).(y).marker)) |Home -> test_anthill (x,y) col |FoeHome -> test_anthill (x,y) (other_color col);; let adjacent_ants (x,y) col = let n = ref 0 in for d = 0 to 5 do let (i,j) = adjacent_cell (x,y) d in if carte.(i).(j).fourmi.id >=0 && carte.(i).(j).fourmi.col = col then n:= !n+1 done; !n;; let check_surrounded_ant (x,y) = if carte.(x).(y).fourmi.id >= 0 then if (adjacent_ants (x,y) carte.(x).(y).fourmi.col) >= 5 then begin carte.(x).(y).fourmi.id <- (-1); carte.(x).(y).food <- (carte.(x).(y).food + 3); if carte.(x).(y).fourmi.has_food then carte.(x).(y).food <- carte.(x).(y).food + 1; end;; let check_surrounded_ants (x,y) = check_surrounded_ant (x,y); for d = 0 to 5 do check_surrounded_ant (adjacent_cell (x,y) d) done;; let step ident col = let inst = ref [||] in let (f, x, y) = (find_ant ident col) in if x <> (-1) then begin if f.resting > 0 then carte.(x).(y).fourmi.resting <- carte.(x).(y).fourmi.resting - 1 else begin if col = Red then inst := inst1 else inst:= inst2; match !inst.(f.state) with |Sense (sd, st1, st2, cond) -> let p2 = sensed_cell (x,y) f.dir sd in let st = if cell_match (x,y) f.col cond then st1 else st2 in carte.(x).(y).fourmi.state <- st |Mark (i, st) -> if f.col = Red then (fst(carte.(x).(y).marker)).(i) <- true else (snd(carte.(x).(y).marker)).(i) <- true; carte.(x).(y).fourmi.state <- st |Unmark (i, st) -> if f.col = Red then (fst(carte.(x).(y).marker)).(i) <- false else (snd(carte.(x).(y).marker)).(i) <- false; carte.(x).(y).fourmi.state <- st |PickUp (st1, st2) -> if (carte.(x).(y).food > 0 || carte.(x).(y).fourmi.has_food) then carte.(x).(y).fourmi.state <- st2 else begin carte.(x).(y).food <- carte.(x).(y).food -1; carte.(x).(y).fourmi.has_food <- true; carte.(x).(y).fourmi.state <- st1; end |Drop st -> if carte.(x).(y).fourmi.has_food then (carte.(x).(y).fourmi.has_food <- false; carte.(x).(y).food <- carte.(x).(y).food + 1); carte.(x).(y).fourmi.state <- st |Turn (lr, st) -> carte.(x).(y).fourmi.dir <- turn carte.(x).(y).fourmi.dir lr; carte.(x).(y).fourmi.state <- st |Move (st1, st2) -> let (x2, y2) = adjacent_cell (x,y) carte.(x).(y).fourmi.dir in if (rocky (x2, y2) || carte.(x2).(y2).fourmi.id >= 0) then carte.(x).(y).fourmi.state <- st2 else begin carte.(x2).(y2).fourmi <- carte.(x).(y).fourmi; carte.(x).(y).fourmi <- void_ant; carte.(x2).(y2).fourmi.state <- st1; carte.(x2).(y2).fourmi.resting <- 14; check_surrounded_ants (x2, y2); end |Flip (p, st1, st2) -> if Random.int p = 0 then carte.(x).(y).fourmi.state <- st1 else carte.(x).(y).fourmi.state <- st2 end; end;; let compte col = (*Comptabilise la quantité de nourriture sur les fourmilières *) let n = ref 0 in for i = 0 to (y_dim-1) do for j = 0 to (x_dim-1) do if test_anthill (i,j) col then n := !n + carte.(i).(j).food done done; !n;; let nb_ants col = (*Compte le nombre de fourmis*) let n = ref 0 in for i = 0 to (y_dim-1) do for j = 0 to (x_dim-1) do if (carte.(i).(j).fourmi.id >= 0 && carte.(i).(j).fourmi.col = col) then n := !n + 1 done done; !n;; let play nb_turns = let n = nb_ants Red in for k = 1 to nb_turns do for i = 0 to (n-1) do step i Red; step i Black done; Printf.printf "%d\t" k done; let f_red = compte Red and f_black = compte Black in if f_red > f_black then Printf.printf "Victoire des Rouges avec %d contre %d\n" f_red f_black else (if f_black > f_red then Printf.printf "Victoire des Noirs avec %d contre %d\n" f_black f_red else Printf.printf "Egalite avec %d\n" f_red);; play 100000;;


__________________

Allez jeter un œil à mon portfolio !

Edité par Zakath le 05-06-2004 à 23:10

Signaler ce message à un modérateur | IP: Logguée
Temps en ligne : 103 Jours, 6 Heures, 14 Minutes, 38 Secondes en ligne

Old Post 05-06-2004 11:51
Cliquez ici pour voir le profil de Zakath Cliquez ici pour lui envoyer un message privé  Visiter la Page Perso de Zakath! Trouver plus de messages de Zakath Ajouter Zakath à votre liste d'amis Editer/Effacer le Message Citer le message dans la réponse
 KeySoze  Rechercher tous les messages de ce membre Cliquez ici pour envoyer un message privé à cet utilisateur
Modérateur

Déconnecté

Niveau : 5
N° de Membre : 4449

Ancienneté : 98%
Participation : 8%
Inscription: 15 Sep 2002
Localisation: IDF
Age: 42
Messages: 6370
Sujets Lancés : 603

Et voilà comment Zakath se transforme en machine à faire des programmes


__________________
OXMO : On est plus intelligent à plusieurs que tout seul...mais certains aident moins que d'autres


Signaler ce message à un modérateur | IP: Logguée
Temps en ligne : 46 Jours, 18 Heures, 58 Minutes, 16 Secondes en ligne

Old Post 05-06-2004 14:14
Cliquez ici pour voir le profil de KeySoze Cliquez ici pour lui envoyer un message privé  Trouver plus de messages de KeySoze Ajouter KeySoze à votre liste d'amis Editer/Effacer le Message Citer le message dans la réponse
 KeySoze  Rechercher tous les messages de ce membre Cliquez ici pour envoyer un message privé à cet utilisateur
Modérateur

Déconnecté

Niveau : 5
N° de Membre : 4449

Ancienneté : 98%
Participation : 8%
Inscription: 15 Sep 2002
Localisation: IDF
Age: 42
Messages: 6370
Sujets Lancés : 603

Bon, vu le mal que j'ai eu à comprendre tout ça, je me fais une copie de sauvegarde (légale ) de cette stratégie !

- au debut, avant toutes choses, on prend une partie des fourmis et on en fait des marqueuses.
- les non-marqueuses vont se balader totalement au pif dans la map, jusqu'a ce qu'elles trouvent de la bouffe
- les marqueuses vont se deplacer en lignes (presque) droites, en cherchant aussi de la bouffe, mais en posant a chaque etape un marqueur 0

- Maintenant, si une marqueuse ou une non-marqueuse trouve de la bouffe, elles se comportent pareil :
- elles la ramassent et passent en mode recolteuse
- dans ce mode, elles vont essayer de revenir a la fourmiliere le plus vite possible
- pour ce faire, elles vont se balader au pif et essayer de trouver des markers 0, qui ont ete posees par les marqueuses puisqu'on sait que ces markers menent a la fourmiliere
- et a chaque etape, elles vont mettre un marker bouffe
- marker bouffe = marker entre 1 et 5
- s'il n'y en a encore aucun, c'est un marker 1
- s'il y a un marker i, elle pose un marker i+1
- sauf si i = 5, bien sur
- et tout fourmi non-recolteuse, quand elle trouve un marqueur bouffe, a une probabilite de suivre le marker proportionnelle a la valeur du marker constituant donc des pistes

Rmq :
- quand une fourmi revient a la fourmiliere, elle a une certaine chance de se transformer en marqueuse
- une fourmi peut poser autant de marqueurs qu'elle veut !
- nb de marqueuses : dans les 10/15
- les marqueuse ne recoltent pas sauf quand elles trouvent de la bouf par hasard et la elles reviennent sur leur pas, si une marqueuse trouve un marker, elle l'ignore car sinon, on risque de louper certains coins


__________________
OXMO : On est plus intelligent à plusieurs que tout seul...mais certains aident moins que d'autres


Signaler ce message à un modérateur | IP: Logguée
Temps en ligne : 46 Jours, 18 Heures, 58 Minutes, 16 Secondes en ligne

Old Post 05-06-2004 20:31
Cliquez ici pour voir le profil de KeySoze Cliquez ici pour lui envoyer un message privé  Trouver plus de messages de KeySoze Ajouter KeySoze à votre liste d'amis Editer/Effacer le Message Citer le message dans la réponse
 Zakath  Rechercher tous les messages de ce membre Cliquez ici pour envoyer un message privé à cet utilisateur
Guru

Déconnecté

Niveau : 5
N° de Membre : 7213

Ancienneté : 97%
Participation : 12%
Inscription: 15 Dec 2002
Localisation: Copenhague
Messages: 9866
Sujets Lancés : 426

Ca sent le copier/coller depuis IRC


__________________

Allez jeter un œil à mon portfolio !


Signaler ce message à un modérateur | IP: Logguée
Temps en ligne : 103 Jours, 6 Heures, 14 Minutes, 38 Secondes en ligne

Old Post 05-06-2004 20:52
Cliquez ici pour voir le profil de Zakath Cliquez ici pour lui envoyer un message privé  Visiter la Page Perso de Zakath! Trouver plus de messages de Zakath Ajouter Zakath à votre liste d'amis Editer/Effacer le Message Citer le message dans la réponse
 Zakath  Rechercher tous les messages de ce membre Cliquez ici pour envoyer un message privé à cet utilisateur
Guru

Déconnecté

Niveau : 5
N° de Membre : 7213

Ancienneté : 97%
Participation : 12%
Inscription: 15 Dec 2002
Localisation: Copenhague
Messages: 9866
Sujets Lancés : 426

Et voila un beau programme en ASM. Pas encore testé, cela dit :

code:
Flip 10 1 2 ; séparation marqueuses/normales procédure pour avancer au pif total : ;0; Flip 6 1 2 ;1; Move (sortie si reussite) (sortie si echec) ;2; Turn Left 3 ;3; Flip 5 1 4 ;4; Turn Left 5 ;5; Flip 4 1 6 ;6; Turn Left 7 ;7; Flip 3 1 8 ;8; Turn Left 9 ;9; Flip 2 1 10 ;10; Turn Left 1 procédure pour checker les marqueurs et avancer selon la probabilité ;0; Sense Ahead 7 1 Marker 5 ;1; Sense Ahead 9 2 Marker 4 ;2; Sense Ahead 10 3 Marker 3 ;3; Sense Ahead 11 4 Marker 2 ;4; Sense Ahead 12 5 Marker 1 ;5; Sense Ahead 13 6 Marker 0 ;6; Flip 2 14 15 ;si aucun marqueur, tourner aléatoirement à droite ou a gauche ;7; Flip 30 8 (etat d'avancee au pif) ;8; Move (sortie si reussite) (sortie si echec) ;9; Flip 25 8 (etat d'avancee au pif) ;10; Flip 20 8 (etat d'avancee au pif) ;11; Flip 15 8 (etat d'avancee au pif) ;12; Flip 10 8 (etat d'avancee au pif) ;13; Sense Here 8 (etat d'avancee au pif) FriendWithFood ;14; Turn Left 16 ;15; Turn Right 16 ;16; Flip 6 8 0 ;une chance sur 6 d'avancer, sinon recommencer la détection procédure totale pour fourmi non marqueuse sans nourriture en vadrouille : ;0; Sense Ahead 27 1 Food ; détecte s'il y a de la nourriture ;1; Sense Ahead 11 2 Mark 5 ; checke les marqueurs ;2; Sense Ahead 12 3 Mark 4 ;3; Sense Ahead 13 4 Mark 3 ;4; Sense Ahead 14 5 Mark 2 ;5; Sense Ahead 15 6 Mark 1 ; si aucun marqueur intéressant, alors ;6; Flip 6 7 8 ; une chance sur 6 d'avancer ;7; Move 0 8 ; avancer si possible, sinon tourner ;8; Flip 2 9 10 ; tourner aléatoirement à gauche ou a droite et recommencer ;9; Turn Left 0 ;10; Turn Right 0 ;11; Flip 30 16 7 ; 29 chances sur 30 d'avancer, sinon avancer aléatoirement ;12; Flip 25 16 7 ;13; Flip 20 16 7 ;14; Flip 15 16 7 ;15; Flip 10 16 7 ;16; Flip 6 26 17 ; algo d'avançage au total pif ;17; Turn Left 18 ;18; Flip 5 26 19 ;19; Turn Left 20 ;20; Flip 4 26 21 ;21; Turn Left 22 ;22; Flip 3 26 23 ;23; Turn Left 24 ;24; Flip 2 26 25 ;25; Turn Left 26 ;26; Move 0 16 ;27; Move 28 27 ; si il y a de la nourriture, avancer et ramasser ;28; PickUp s_food 0 ;29; Turn Left 30 ; faire demi-tour ;30; Turn Left 31 ;31; Turn Left s_food quand trouvé nourriture, rechercher les markers 0 pour rejoindre la fourmiliere : ;0; Sense Ahead 10 1 Marker 5 ; placement du bon marqueur ;1; Sense Ahead 5 2 Marker 4 ;2; Sense Ahead 6 3 Marker 3 ;3; Sense Ahead 7 4 Marker 2 ;4; Sense Ahead 8 9 Marker 1 ;5; Mark 5 10 ;6; Mark 4 10 ;7; Mark 3 10 ;8; Mark 2 10 ;9; Mark 1 10 ;10; Sense Ahead 11 13 Home ; si fourmiliere droit devant, avancer et lacher nourriture ;11; Move 12 13 ;12; Drop s_req ;13; Sense Ahead 24 14 Marker 0 ; si pas de marker 0 tourner et chercher ;14; Turn Left 15 ;15; Sense Ahead 24 16 Marker 0 ;16; Turn Left 17 ;17; Sense Ahead 24 18 Marker 0 ;18; Turn Left 19 ;19; Sense Ahead 24 20 Marker 0 ;20; Turn Left 21 ;21; Sense Ahead 24 22 Marker 0 ;22; Turn Left 23 ;23; Sense Ahead 24 25 Marker 0 ;24; Move 0 25 ;25; Flip 6 35 26 ; algo d'avançage au total pif ;26; Turn Left 27 ;27; Flip 5 35 28 ;28; Turn Left 29 ;29; Flip 4 35 30 ;30; Turn Left 31 ;31; Flip 3 35 32 ;32; Turn Left 33 ;33; Flip 2 35 34 ;34; Turn Left 35 ;35; Move 0 25 algo pour les marqueuses (avancer en ligne droite tant que possible) : ;0; Mark 0 1 ; pose un marqueur ;1; Sense Ahead x 2 Food ; détecte s'il y a de la nourriture ;2; Sense Ahead 4 3 Marker 5 ; detecte un marqueur de tres forte intensite ;3; Flip 6 8 4 ; 5 chances sur 6 d'avancer ;4; Move 0 5 ; avancer si possible, sinon tourner ;5; Flip 2 6 7 ; tourner aléatoirement à gauche ou a droite et recommencer ;6; Turn Left 4 ;7; Turn Right 4 ;8; Flip 2 9 11 ; Faire deux tours aléatoirement à gauche ou à droite ;9; Turn Left 10 ;10; Turn Left 13 ;11; Turn Right 12 ;12; Turn Right 13 ;13; Move 0 0 ; essayer de bouger ;14; Move 15 14 ; si nourriture detectee, boucler jusqu'a ce qu'on puisse la ramasser ;15; PickUp 16 16 ;16; Turn Left 17 ; faire demi-tour ;17; Turn Left 18 ;18; Turn Left s_food ; et se mettre en mode récolteuse Au départ, une sur 8 est marqueuse et elles choisissent toutes une direction au pif : ;0; Flip 6 10 1 ; choix d'une direction aleatoirement ;1; Turn Left 2 ;2; Flip 5 10 3 ;3; Turn Left 4 ;4; Flip 4 10 5 ;5; Turn Left 6 ;6; Flip 3 10 7 ;7; Turn Left 8 ;8; Flip 2 10 9 ;9; Turn Left 10 ;10; Flip 8 s_marqueuses s_non_marqueuses ; repartition marqueuses/non-marqueuses


__________________

Allez jeter un œil à mon portfolio !

Edité par Zakath le 05-06-2004 à 23:21

Signaler ce message à un modérateur | IP: Logguée
Temps en ligne : 103 Jours, 6 Heures, 14 Minutes, 38 Secondes en ligne

Old Post 05-06-2004 23:09
Cliquez ici pour voir le profil de Zakath Cliquez ici pour lui envoyer un message privé  Visiter la Page Perso de Zakath! Trouver plus de messages de Zakath Ajouter Zakath à votre liste d'amis Editer/Effacer le Message Citer le message dans la réponse
 Zakath  Rechercher tous les messages de ce membre Cliquez ici pour envoyer un message privé à cet utilisateur
Guru

Déconnecté

Niveau : 5
N° de Membre : 7213

Ancienneté : 97%
Participation : 12%
Inscription: 15 Dec 2002
Localisation: Copenhague
Messages: 9866
Sujets Lancés : 426

Allez, un serveur qui marche et une fourmi qui devrait marcher mais qui ne marche pas encore :

code:
type pos = int * int;; type left_or_right = Left | Right;; type sense_dir = Here | Ahead | RightAhead | LeftAhead;; type color = Black | Red;; type ant = {mutable id :int; col :color; mutable resting :int; mutable dir :int; mutable has_food :bool; mutable state :int};; type case = Rock | Clear | AntHill of color;; type etat_case = {mutable phys :case; mutable food :int; mutable fourmi :ant; mutable marker :bool array * bool array};; (*carte_phys carte_food carte_marker_0 carte_marker_1 carte_marker_2 carte_marker_3 carte_marker_4 carte_marker_5 carte_ant_id carte_ant_col carte_ant_dir carte_ant_resting carte_ant_has_food carte_ant_state*) type sensedir = Here |Ahead |LeftAhead |RightAhead;; type condition = Friend |Foe |FriendWithFood |FoeWithFood |Nourriture |Caillou |Marker of int |FoeMarker |Home |FoeHome;; type instruction = Sense of sensedir * int * int * condition |Mark of int * int |Unmark of int * int |PickUp of int * int |Drop of int |Turn of left_or_right * int |Move of int * int |Flip of int * int * int;; let void_ant = {id = -1; col = Red; resting = 0; dir = 0; has_food = false; state = 0};; let init_ant ident couleur = {id = ident; col = couleur; resting = 0; dir = 0; has_food = false; state = 0};; let adjacent_cell p d = let (x, y) = p in match d with |0 -> (x+1,y) |1 -> if (y mod 2 = 0) then (x,y+1) else (x+1,y+1) |2 -> if (y mod 2 = 0) then (x-1,y+1) else (x,y+1) |3 -> (x-1,y) |4 -> if (y mod 2 = 0) then (x-1,y-1) else (x,y-1) |5 -> if (y mod 2 = 0) then (x,y-1) else (x+1,y-1) |_ -> failwith "Mauvaise direction";; let turn d = function |Left -> (d + 5) mod 6 |Right -> (d + 1) mod 6;; let sensed_cell p d = function |Here -> p |Ahead -> adjacent_cell p d |LeftAhead -> adjacent_cell p (turn d Left) |RightAhead -> adjacent_cell p (turn d Right);; let other_color = function |Red -> Black |Black -> Red;; (* Lecture d'une map *) let read_map file = let fcarte = open_in file in let x_dim = int_of_string (input_line fcarte) in let y_dim = int_of_string (input_line fcarte) in (*let carte = Array.create_matrix x_dim y_dim {phys = Clear; food = 0; fourmi = void_ant; marker = ([|false;false;false;false;false;false|], [|false; false; false; false; false;false|])} in*) let carte_phys = Array.create_matrix y_dim x_dim Clear and carte_food = Array.create_matrix y_dim x_dim 0 and carte_marker_0 = Array.create_matrix y_dim x_dim (false, false) and carte_marker_1 = Array.create_matrix y_dim x_dim (false, false) and carte_marker_2 = Array.create_matrix y_dim x_dim (false, false) and carte_marker_3 = Array.create_matrix y_dim x_dim (false, false) and carte_marker_4 = Array.create_matrix y_dim x_dim (false, false) and carte_marker_5 = Array.create_matrix y_dim x_dim (false, false) and carte_ant_id = Array.create_matrix y_dim x_dim (-1) and carte_ant_col = Array.create_matrix y_dim x_dim Red and carte_ant_resting = Array.create_matrix y_dim x_dim 0 and carte_ant_has_food = Array.create_matrix y_dim x_dim false and carte_ant_dir = Array.create_matrix y_dim x_dim 0 and carte_ant_state = Array.create_matrix y_dim x_dim 0 and f = ref 0 in for i = 0 to (y_dim - 1) do let ligne = input_line fcarte in let j = ref 0 and n = String.length ligne and k = ref 0 in while !j < n do match ligne.[!j] with |' ' -> j:= !j+1 |'#' -> carte_phys.(i).(!k) <- Rock; j:= !j+1; k:= !k+1 |'.' -> j:= !j+1; k:= !k+1 |'+' -> carte_phys.(i).(!k) <- AntHill Red; carte_ant_id.(i).(!k) <- !f; j:= !j+1; k:= !k+1; f:= !f+1; |'-' -> carte_phys.(i).(!k) <- AntHill Black; carte_ant_id.(i).(!k) <- !f; carte_ant_col.(i).(!k) <- Black; j:= !j+1; k:= !k+1;f:= !f+1 |w -> carte_food.(i).(!k) <- (int_of_char w - 48); j:= !j+1; k:= !k+1 done done; (carte_phys, carte_food, carte_marker_0, carte_marker_1, carte_marker_2, carte_marker_3, carte_marker_4, carte_marker_5, carte_ant_id, carte_ant_col, carte_ant_dir, carte_ant_resting, carte_ant_has_food, carte_ant_state, x_dim, y_dim);; let (carte_phys, carte_food, carte_marker_0, carte_marker_1, carte_marker_2, carte_marker_3, carte_marker_4, carte_marker_5, carte_ant_id, carte_ant_col, carte_ant_dir, carte_ant_resting, carte_ant_has_food, carte_ant_state, x_dim, y_dim) = read_map "E:\\Informatique\\ICFP\\sample.world";; let rocky (x,y) = try carte_phys.(x).(y) = Rock with Invalid_argument("Array.get") -> true;; let nb_ants() = (*Compte le nombre de fourmis*) let n = ref 0 in for i = 0 to (y_dim-1) do for j = 0 to (x_dim-1) do if carte_ant_id.(i).(j) >= 0 then n := !n + 1; done done; !n;; let ant_pos = Array.create (nb_ants()) (-1,-1);; let find_ant ident = let f = ref void_ant and x= ref (-1) and y = ref (-1) in for i = 0 to (y_dim-1) do for j = 0 to (x_dim-1) do if carte_ant_id.(i).(j) = ident then (x:= i; y:= j) done done; (!x, !y);; for i = 0 to (Array.length ant_pos - 1) do ant_pos.(i) <- (find_ant i); done;; (*let chan = open_out "E:\\Informatique\\ICFP\\out2" in for x = 0 to (y_dim - 1) do for y = 0 to (x_dim - 1) do Printf.fprintf chan "cell (%d, %d): " x y; if rocky (x,y) then Printf.fprintf chan "rocky;" else (if carte_food.(x).(y) > 0 then Printf.fprintf chan "%d food; " carte_food.(x).(y); if carte_phys.(x).(y) = AntHill Red then Printf.fprintf chan "red hill; "; if carte_phys.(x).(y) = AntHill Black then Printf.fprintf chan "black hill; "; if carte_ant_id.(x).(y) >= 0 then (if carte_ant_col.(x).(y) = Red then Printf.fprintf chan "red " else Printf.fprintf chan "black "; Printf.fprintf chan "ant of id %d, dir %d, food %b, state %d, resting %d;" carte_ant_id.(x).(y) carte_ant_dir.(x).(y) carte_ant_has_food.(x).(y) carte_ant_state.(x).(y) carte_ant_resting.(x).(y))); Printf.fprintf chan "\n" done done; Printf.fprintf chan "\n\n\n";;*) (* Lecture d'un cerveau de fourmi *) let read_brain file = let fbrain = open_in file in let instruct = Array.create 9999 "" and k = ref 0 in try for i = 0 to 9998 do instruct.(i) <- input_line fbrain; k:= !k+1 done; instruct; with End_of_file -> let t = Array.create !k "" in for i = 0 to (!k-1) do t.(i) <- instruct.(i) done; t;; let instruct1 = read_brain "E:\\Informatique\\ICFP\\brain3_def";; let instruct2 = read_brain "E:\\Informatique\\ICFP\\do_nothing.ant";; let rec print_list = function |[] -> () |t::q -> Printf.printf "%s\n" t; print_list q;; let lexeur inst = let i = ref 0 and i2 = ref 0 and l = ref [] in while !i < (String.length inst) do while (!i < (String.length inst) && inst.[!i] <> ' ') do i:= !i+1 done; l:= (String.sub inst !i2 (!i - !i2))::(!l); i:= !i+1; i2 := !i done; List.rev(!l);; let cond_of_string = function |"Friend" -> Friend |"Foe" -> Foe |"FriendWithFood" -> FriendWithFood |"FoeWithFood" -> FoeWithFood |"Rock" -> Caillou |"Food" -> Nourriture |"Marker 0" -> Marker 0 |"Marker 1" -> Marker 1 |"Marker 2" -> Marker 2 |"Marker 3" -> Marker 3 |"Marker 4" -> Marker 4 |"Marker 5" -> Marker 5 |"FoeMarker" -> FoeMarker |"Home" -> Home |"FoeHome" -> FoeHome |t -> Printf.printf "%s\n" t; failwith "Erreur de condition";; let lr_of_string = function |"Left" -> Left |"Right" -> Right |_ -> failwith "Erreur de direction de virage";; let sensedir_of_string = function |"Here" -> Here |"Ahead" -> Ahead |"LeftAhead" -> LeftAhead |"RightAhead" -> RightAhead |_ -> failwith "Erreur de direction de détection";; let parseur = function |["Sense";sd;st1;st2;cond] -> Sense ((sensedir_of_string sd), (int_of_string st1), (int_of_string st2), (cond_of_string cond)) |["Sense";sd;st1;st2;cond;i] -> Sense ((sensedir_of_string sd), (int_of_string st1), (int_of_string st2), (cond_of_string (cond^" "^i))) |["Mark";i;st] -> Mark ((int_of_string i), (int_of_string st)) |["Unmark";i;st] -> Unmark ((int_of_string i), (int_of_string st)) |["PickUp";st1;st2] -> PickUp ((int_of_string st1), (int_of_string st2)) |["Drop";st] -> Drop (int_of_string st) |["Turn";lr;st] -> Turn ((lr_of_string lr), (int_of_string st)) |["Move";st1;st2] -> Move ((int_of_string st1), (int_of_string st2)) |["Flip";p;st1;st2] -> Flip ((int_of_string p), (int_of_string st1), (int_of_string st2)) |t -> print_list t; failwith "Instruction non valide";; let make_inst t = let n = Array.length t in let inst = Array.create n (Drop 0) in for i = 0 to (n-1) do inst.(i) <- parseur (lexeur (t.(i))) done; inst;; let inst1 = make_inst instruct1;; let inst2 = make_inst instruct2;; let some_ant_is_at (x,y) = carte_ant_id.(x).(y) >= 0;; let ant_is_alive ident col = let (x,y) = (ant_pos.(ident)) in carte_ant_id.(x).(y) >= 0;; let test_anthill (x,y) col = match carte_phys.(x).(y) with |AntHill c -> c = col |_ -> false;; let test_marker (x,y) = function |Red -> (fst(carte_marker_0.(x).(y))) || (fst(carte_marker_1.(x).(y))) || (fst(carte_marker_2.(x).(y))) || (fst(carte_marker_3.(x).(y))) || (fst(carte_marker_4.(x).(y))) || (fst(carte_marker_5.(x).(y))) |Black -> (snd(carte_marker_0.(x).(y))) || (snd(carte_marker_1.(x).(y))) || (snd(carte_marker_2.(x).(y))) || (snd(carte_marker_3.(x).(y))) || (snd(carte_marker_4.(x).(y))) || (snd(carte_marker_5.(x).(y)));; let cell_match (x,y) col = function |Caillou -> rocky (x,y) |Friend -> carte_ant_id.(x).(y) >=0 && carte_ant_col.(x).(y) = col |Foe -> carte_ant_id.(x).(y) >=0 && carte_ant_col.(x).(y) <> col |FriendWithFood -> carte_ant_id.(x).(y) >=0 && carte_ant_col.(x).(y) = col && carte_ant_has_food.(x).(y) |FoeWithFood -> carte_ant_id.(x).(y) >=0 && carte_ant_col.(x).(y) <> col && carte_ant_has_food.(x).(y) |Nourriture -> carte_food.(x).(y) > 0 |Marker 0 -> if col = Red then (fst(carte_marker_0.(x).(y))) else (snd(carte_marker_0.(x).(y))) |Marker 1 -> if col = Red then (fst(carte_marker_1.(x).(y))) else (snd(carte_marker_1.(x).(y))) |Marker 2 -> if col = Red then (fst(carte_marker_2.(x).(y))) else (snd(carte_marker_2.(x).(y))) |Marker 3 -> if col = Red then (fst(carte_marker_3.(x).(y))) else (snd(carte_marker_3.(x).(y))) |Marker 4 -> if col = Red then (fst(carte_marker_4.(x).(y))) else (snd(carte_marker_4.(x).(y))) |Marker 5 -> if col = Red then (fst(carte_marker_5.(x).(y))) else (snd(carte_marker_5.(x).(y))) |Marker i -> failwith "Marqueur invalide" |FoeMarker -> test_marker (x,y) col |Home -> test_anthill (x,y) col |FoeHome -> test_anthill (x,y) (other_color col);; let adjacent_ants (x,y) col = let n = ref 0 in for d = 0 to 5 do let (i,j) = adjacent_cell (x,y) d in if carte_ant_id.(i).(j) >= 0 && carte_ant_col.(i).(j) = col then n:= !n+1 done; !n;; let check_surrounded_ant (x,y) = if carte_ant_id.(x).(y) >= 0 then if (adjacent_ants (x,y) (other_color carte_ant_col.(x).(y))) >= 5 then begin ant_pos.(carte_ant_id.(x).(y)) <- ((-1), (-1)); carte_ant_id.(x).(y) <- (-1); carte_food.(x).(y) <- (carte_food.(x).(y) + 3); if carte_ant_has_food.(x).(y) then carte_food.(x).(y) <- carte_food.(x).(y) + 1; end;; let check_surrounded_ants (x,y) = check_surrounded_ant (x,y); for d = 0 to 5 do check_surrounded_ant (adjacent_cell (x,y) d) done;; let print_carte() = let chan = open_out "E:\\Informatique\\ICFP\\out" in for x = 0 to (x_dim - 1) do for y = 0 to (y_dim - 1) do Printf.fprintf chan "cell (%d, %d): " x y; if rocky (x,y) then Printf.fprintf chan "rocky;" else (if carte_food.(x).(y) > 0 then Printf.fprintf chan "%d food; " carte_food.(x).(y); if carte_phys.(x).(y) = AntHill Red then Printf.fprintf chan "red hill; "; if carte_phys.(x).(y) = AntHill Black then Printf.fprintf chan "black hill; "; if carte_ant_id.(x).(y) >= 0 then (if carte_ant_col.(x).(y) = Red then Printf.fprintf chan "red " else Printf.fprintf chan "black "; Printf.fprintf chan "ant of id %d, dir %d, food %b, state %d, resting %d;" carte_ant_id.(x).(y) carte_ant_dir.(x).(y) carte_ant_has_food.(x).(y) carte_ant_state.(x).(y) carte_ant_resting.(x).(y))); Printf.fprintf chan "\n" done done; Printf.fprintf chan "\n\n";; let step ident ch = let inst = ref [||] in let (x, y) = (ant_pos.(ident)) in if x <> (-1) then begin if carte_ant_resting.(x).(y) > 0 then carte_ant_resting.(x).(y) <- carte_ant_resting.(x).(y) - 1 else begin if carte_ant_col.(x).(y) = Red then inst := inst1 else inst:= inst2; match !inst.(carte_ant_state.(x).(y)) with |Sense (sd, st1, st2, cond) -> Printf.fprintf ch "Sense\n"; let p2 = sensed_cell (x,y) carte_ant_dir.(x).(y) sd in let st = if cell_match (x,y) carte_ant_col.(x).(y) cond then st1 else st2 in carte_ant_state.(x).(y) <- st; |Mark (0, st) -> Printf.fprintf ch "Mark\n"; if carte_ant_col.(x).(y) = Red then (carte_marker_0.(x).(y) <- (true, snd(carte_marker_0.(x).(y)))) else (carte_marker_0.(x).(y) <- (fst(carte_marker_0.(x).(y)), true)); carte_ant_state.(x).(y) <- st |Mark (1, st) -> Printf.fprintf ch "Mark\n"; if carte_ant_col.(x).(y) = Red then (carte_marker_1.(x).(y) <- (true, snd(carte_marker_1.(x).(y)))) else (carte_marker_1.(x).(y) <- (fst(carte_marker_1.(x).(y)), true)); carte_ant_state.(x).(y) <- st |Mark (2, st) -> Printf.fprintf ch "Mark\n"; if carte_ant_col.(x).(y) = Red then (carte_marker_2.(x).(y) <- (true, snd(carte_marker_2.(x).(y)))) else (carte_marker_2.(x).(y) <- (fst(carte_marker_2.(x).(y)), true)); carte_ant_state.(x).(y) <- st |Mark (3, st) -> Printf.fprintf ch "Mark\n"; if carte_ant_col.(x).(y) = Red then (carte_marker_3.(x).(y) <- (true, snd(carte_marker_3.(x).(y)))) else (carte_marker_3.(x).(y) <- (fst(carte_marker_3.(x).(y)), true)); carte_ant_state.(x).(y) <- st |Mark (4, st) -> Printf.fprintf ch "Mark\n"; if carte_ant_col.(x).(y) = Red then (carte_marker_4.(x).(y) <- (true, snd(carte_marker_4.(x).(y)))) else (carte_marker_4.(x).(y) <- (fst(carte_marker_4.(x).(y)), true)); carte_ant_state.(x).(y) <- st |Mark (5, st) -> Printf.fprintf ch "Mark\n"; if carte_ant_col.(x).(y) = Red then (carte_marker_5.(x).(y) <- (true, snd(carte_marker_5.(x).(y)))) else (carte_marker_5.(x).(y) <- (fst(carte_marker_5.(x).(y)), true)); carte_ant_state.(x).(y) <- st |Mark(i, st) -> failwith "Marqueur invalide"; |Unmark (0, st) -> Printf.fprintf ch "Unmark\n"; if carte_ant_col.(x).(y) = Red then (carte_marker_0.(x).(y) <- (false, snd(carte_marker_0.(x).(y)))) else (carte_marker_0.(x).(y) <- (fst(carte_marker_0.(x).(y)), false)); carte_ant_state.(x).(y) <- st |Unmark (1, st) -> Printf.fprintf ch "Unmark\n"; if carte_ant_col.(x).(y) = Red then (carte_marker_1.(x).(y) <- (false, snd(carte_marker_1.(x).(y)))) else (carte_marker_1.(x).(y) <- (fst(carte_marker_1.(x).(y)), false)); carte_ant_state.(x).(y) <- st |Unmark (2, st) -> Printf.fprintf ch "Unmark\n"; if carte_ant_col.(x).(y) = Red then (carte_marker_2.(x).(y) <- (false, snd(carte_marker_2.(x).(y)))) else (carte_marker_2.(x).(y) <- (fst(carte_marker_2.(x).(y)), false)); carte_ant_state.(x).(y) <- st |Unmark (3, st) -> Printf.fprintf ch "Unmark\n"; if carte_ant_col.(x).(y) = Red then (carte_marker_3.(x).(y) <- (false, snd(carte_marker_3.(x).(y)))) else (carte_marker_3.(x).(y) <- (fst(carte_marker_3.(x).(y)), false)); carte_ant_state.(x).(y) <- st |Unmark (4, st) -> Printf.fprintf ch "Unmark\n"; if carte_ant_col.(x).(y) = Red then (carte_marker_4.(x).(y) <- (false, snd(carte_marker_4.(x).(y)))) else (carte_marker_4.(x).(y) <- (fst(carte_marker_4.(x).(y)), false)); carte_ant_state.(x).(y) <- st |Unmark (5, st) -> Printf.fprintf ch "Unmark\n"; if carte_ant_col.(x).(y) = Red then (carte_marker_5.(x).(y) <- (false, snd(carte_marker_5.(x).(y)))) else (carte_marker_5.(x).(y) <- (fst(carte_marker_5.(x).(y)), false)); carte_ant_state.(x).(y) <- st |Unmark (i, st) -> failwith "Marqueur invalide"; |PickUp (st1, st2) -> Printf.fprintf ch "PickUp\n"; if (carte_food.(x).(y) = 0 || carte_ant_has_food.(x).(y)) then carte_ant_state.(x).(y) <- st2 else begin carte_food.(x).(y) <- carte_food.(x).(y) - 1; carte_ant_has_food.(x).(y) <- true; carte_ant_state.(x).(y) <- st1; end |Drop st -> Printf.fprintf ch "Drop\n"; if carte_ant_has_food.(x).(y) then (carte_ant_has_food.(x).(y) <- false; carte_food.(x).(y) <- carte_food.(x).(y) + 1); carte_ant_state.(x).(y) <- st |Turn (lr, st) -> Printf.fprintf ch "Turn\n"; carte_ant_dir.(x).(y) <- turn carte_ant_dir.(x).(y) lr; carte_ant_state.(x).(y) <- st |Move (st1, st2) -> Printf.fprintf ch "Move\n"; let (x2, y2) = adjacent_cell (x,y) carte_ant_dir.(x).(y) in if (rocky (x2, y2) || carte_ant_id.(x2).(y2) >= 0) then carte_ant_state.(x).(y) <- st2 else begin carte_ant_id.(x2).(y2) <- carte_ant_id.(x).(y); ant_pos.(carte_ant_id.(x2).(y2)) <- (x2, y2); carte_ant_col.(x2).(y2) <- carte_ant_col.(x).(y); carte_ant_dir.(x2).(y2) <- carte_ant_dir.(x).(y); carte_ant_has_food.(x2).(y2) <- carte_ant_has_food.(x).(y); carte_ant_resting.(x2).(y2) <- 14; carte_ant_state.(x2).(y2) <- st1; carte_ant_id.(x).(y) <- (-1); check_surrounded_ants (x2, y2); end; |Flip (p, st1, st2) -> Printf.fprintf ch "Flip\n"; if Random.int p = 0 then carte_ant_state.(x).(y) <- st1 else carte_ant_state.(x).(y) <- st2 end; end (*else Printf.printf "Pas bouge\n"*);; let compte col = (*Comptabilise la quantité de nourriture sur les fourmilières *) let n = ref 0 in for i = 0 to (y_dim-1) do for j = 0 to (x_dim-1) do if test_anthill (i,j) col then n := !n + carte_food.(i).(j) done done; !n;; let play nb_turns = let chan = open_out "E:\\Informatique\\ICFP\\out" in let ch = open_out "E:\\Informatique\\ICFP\\log" in let n = (Array.length ant_pos) in for k = 1 to nb_turns do if k mod 500 = 0 then (Printf.fprintf ch "\n\nTour n° %d\n" k; for x = 0 to (y_dim - 1) do for y = 0 to (x_dim - 1) do Printf.fprintf chan "cell (%d, %d): " x y; if rocky (x,y) then Printf.fprintf chan "rock;" else (if carte_food.(x).(y) > 0 then Printf.fprintf chan "%d food; " carte_food.(x).(y); if carte_phys.(x).(y) = AntHill Red then Printf.fprintf chan "red hill; "; if carte_phys.(x).(y) = AntHill Black then Printf.fprintf chan "black hill; "; if carte_ant_id.(x).(y) >= 0 then (if carte_ant_col.(x).(y) = Red then Printf.fprintf chan "red " else Printf.fprintf chan "black "; Printf.fprintf chan "ant of id %d, dir %d, food %b, state %d, resting %d;" carte_ant_id.(x).(y) carte_ant_dir.(x).(y) carte_ant_has_food.(x).(y) carte_ant_state.(x).(y) carte_ant_resting.(x).(y))); Printf.fprintf chan "\n" done done; Printf.fprintf chan "\n\n\n";); Printf.printf "%d\t" k; if k mod 500 = 0 then (for i = 0 to (n-1) do Printf.fprintf ch "fourmi id %d :\n" i; step i ch; done;) else (let ch2 = open_out "E:\\Informatique\\ICFP\\dev_null" in for i = 0 to (n-1) do Printf.fprintf ch2 "fourmi id %d :\n" i; step i ch2 done; close_out ch2); done; let f_red = compte Red and f_black = compte Black in if f_red > f_black then (Printf.printf "Victoire des Rouges avec %d contre %d\n" f_red f_black; Printf.fprintf ch "Victoire des Rouges avec %d contre %d\n" f_red f_black) else (if f_black > f_red then (Printf.printf "Victoire des Noirs avec %d contre %d\n" f_black f_red; Printf.fprintf ch "Victoire des Noirs avec %d contre %d\n" f_black f_red) else (Printf.printf "Egalite avec %d\n" f_red; Printf.fprintf ch "Egalite avec %d\n" f_red;));; let print_marker fd (x,y) i = match carte_marker_5.(x).(y) with |(true, false) -> Printf.fprintf fd "y " |(false, true) -> Printf.fprintf fd "h " |(true, true) -> Printf.fprintf fd "b " |(false, false) -> match carte_marker_4.(x).(y) with |(true, false) -> Printf.fprintf fd "t " |(false, true) -> Printf.fprintf fd "g " |(true, true) -> Printf.fprintf fd "b " |(false, false) -> match carte_marker_3.(x).(y) with |(true, false) -> Printf.fprintf fd "r " |(false, true) -> Printf.fprintf fd "f " |(true, true) -> Printf.fprintf fd "v " |(false, false) -> match carte_marker_2.(x).(y) with |(true, false) -> Printf.fprintf fd "e " |(false, true) -> Printf.fprintf fd "d " |(true, true) -> Printf.fprintf fd "c " |(false, false) -> match carte_marker_1.(x).(y) with |(true, false) -> Printf.fprintf fd "z " |(false, true) -> Printf.fprintf fd "s " |(true, true) -> Printf.fprintf fd "x " |(false, false) -> match carte_marker_0.(x).(y) with |(true, false) -> Printf.fprintf fd "a " |(false, true) -> Printf.fprintf fd "q " |(true, true) -> Printf.fprintf fd "w " |(false, false) -> if i = 1 then Printf.fprintf fd ". " else (if i = 2 then Printf.fprintf fd "+ " else Printf.fprintf fd "- ");; let print_marker2 fd (x,y) i = match carte_marker_0.(x).(y) with |(true, false) -> Printf.fprintf fd "a " |(false, true) -> Printf.fprintf fd "q " |(true, true) -> Printf.fprintf fd "w " |(false, false) -> match carte_marker_1.(x).(y) with |(true, false) -> Printf.fprintf fd "z " |(false, true) -> Printf.fprintf fd "s " |(true, true) -> Printf.fprintf fd "x " |(false, false) -> if i = 1 then Printf.fprintf fd ". " else (if i = 2 then Printf.fprintf fd "+ " else Printf.fprintf fd "- ");; let print_map() = let de = open_out "E:\\Informatique\\ICFP\\dessin" in for x = 0 to (x_dim - 1) do if x mod 2 = 1 then Printf.fprintf de " "; for y = 0 to (y_dim - 1) do match carte_phys.(x).(y) with |Rock -> Printf.fprintf de "# " |AntHill Red -> if carte_food.(x).(y) > 0 then Printf.fprintf de "%d " carte_food.(x).(y) else begin if carte_ant_id.(x).(y) >= 0 then begin if carte_ant_col.(x).(y) = Red then Printf.fprintf de "R " else Printf.fprintf de "B "; end else print_marker de (x,y) 2; end |AntHill Black -> if carte_food.(x).(y) > 0 then Printf.fprintf de "%d " carte_food.(x).(y) else begin if carte_ant_id.(x).(y) >= 0 then begin if carte_ant_col.(x).(y) = Red then Printf.fprintf de "R " else Printf.fprintf de "B "; end else print_marker de (x,y) 3; end |Clear -> if carte_food.(x).(y) > 0 then Printf.fprintf de "%d " carte_food.(x).(y) else begin if carte_ant_id.(x).(y) >= 0 then begin if carte_ant_col.(x).(y) = Red then Printf.fprintf de "R " else Printf.fprintf de "B "; end else print_marker de (x,y) 1; end; done; Printf.fprintf de "\n" done;; let print_map2() = let de = open_out "E:\\Informatique\\ICFP\\dessin2" in for x = 0 to (x_dim - 1) do if x mod 2 = 1 then Printf.fprintf de " "; for y = 0 to (y_dim - 1) do match carte_phys.(x).(y) with |Rock -> Printf.fprintf de "# " |AntHill Red -> if carte_food.(x).(y) > 0 then Printf.fprintf de "%d " carte_food.(x).(y) else begin if carte_ant_id.(x).(y) >= 0 then begin if carte_ant_col.(x).(y) = Red then Printf.fprintf de "R " else Printf.fprintf de "B "; end else print_marker2 de (x,y) 2; end |AntHill Black -> if carte_food.(x).(y) > 0 then Printf.fprintf de "%d " carte_food.(x).(y) else begin if carte_ant_id.(x).(y) >= 0 then begin if carte_ant_col.(x).(y) = Red then Printf.fprintf de "R " else Printf.fprintf de "B "; end else print_marker2 de (x,y) 3; end |Clear -> if carte_food.(x).(y) > 0 then Printf.fprintf de "%d " carte_food.(x).(y) else begin if carte_ant_id.(x).(y) >= 0 then begin if carte_ant_col.(x).(y) = Red then Printf.fprintf de "R " else Printf.fprintf de "B "; end else print_marker2 de (x,y) 1; end; done; Printf.fprintf de "\n" done;; let print_tab t = for i = 0 to (Array.length t - 1) do Printf.printf "%d - %d\n" (fst t.(i)) (snd t.(i)) done;; play 100000;; print_map();; print_map2();;


code:
Flip 50 119 35 Turn Left 2 Flip 5 10 3 Turn Left 4 Flip 4 10 5 Turn Left 6 Flip 3 10 7 Turn Left 8 Flip 2 10 9 Turn Left 10 Flip 30 100 118 Mark 0 12 Sense Ahead 98 13 Food Sense Ahead 15 14 Marker 5 Flip 6 19 15 Move 11 16 Flip 2 17 18 Turn Left 15 Turn Right 15 Flip 2 20 22 Turn Left 21 Turn Left 24 Turn Right 23 Turn Right 24 Move 11 11 Move 26 25 PickUp 27 27 Turn Left 28 Turn Left 29 Turn Left 62 Sense Ahead 99 31 Food Sense Ahead 41 32 Marker 5 Sense Ahead 42 33 Marker 4 Sense Ahead 43 34 Marker 3 Sense Ahead 44 36 Marker 2 Flip 50 126 45 Flip 6 37 38 Move 30 38 Flip 2 39 40 Turn Left 118 Turn Right 118 Flip 30 46 37 Flip 25 46 37 Flip 20 46 37 Flip 15 46 37 Flip 50 136 66 Flip 6 56 47 Turn Left 48 Flip 5 56 49 Turn Left 50 Flip 4 56 51 Turn Left 52 Flip 3 56 53 Turn Left 54 Flip 2 56 55 Turn Left 56 Move 30 46 Move 58 57 PickUp 59 59 Turn Left 60 Turn Left 61 Turn Left 62 Sense Ahead 72 63 Marker 5 Sense Ahead 67 64 Marker 4 Sense Ahead 68 65 Marker 3 Sense Ahead 69 70 Marker 2 Flip 50 144 71 Mark 5 72 Mark 4 72 Mark 3 72 Mark 2 72 Flip 6 10 1 Sense Ahead 73 153 Home Move 74 74 Drop 118 Sense Ahead 86 76 Marker 0 Turn Left 77 Sense Ahead 86 78 Marker 0 Turn Left 79 Sense Ahead 86 80 Marker 0 Turn Left 81 Sense Ahead 86 82 Marker 0 Turn Left 83 Sense Ahead 86 84 Marker 0 Turn Left 85 Sense Ahead 86 87 Marker 0 Move 62 87 Flip 4 97 88 Turn Left 89 Flip 3 97 90 Turn Left 91 Flip 3 97 92 Turn Left 93 Flip 2 97 94 Turn Left 95 Flip 2 97 96 Turn Left 97 Move 62 87 Sense Ahead 13 25 Home Sense Ahead 31 57 Home Sense Here 102 104 Marker 5 Mark 4 102 Unmark 5 114 Sense Here 104 106 Marker 4 Mark 3 105 Unmark 4 114 Sense Here 107 109 Marker 3 Mark 2 108 Unmark 3 114 Sense Here 110 114 Marker 2 Unmark 2 114 Unmark 2 115 Sense Here 114 115 Marker 1 Unmark 1 114 Move 100 115 Flip 2 116 117 Turn Left 114 Turn Right 114 Sense Ahead 99 31 Food Flip 2 120 121 Move 124 121 Turn Left 122 Move 125 123 Turn Right 120 Mark 0 120 Mark 0 122 Turn Left 127 Turn Left 128 Turn Left 129 Flip 2 130 131 Move 134 131 Turn Left 132 Move 135 133 Turn Right 130 Mark 0 130 Mark 0 132 Turn Left 137 Flip 2 138 139 Move 142 139 Turn Left 140 Move 143 141 Turn Right 138 Mark 1 138 Mark 1 140 Turn Right 145 Turn Right 146 Flip 2 147 148 Move 151 148 Turn Left 149 Move 152 150 Turn Right 147 Mark 1 147 Mark 1 149 Sense Ahead 158 154 Marker 0 Sense LeftAhead 155 156 Marker 0 Turn Left 158 Sense RightAhead 157 159 Marker 0 Turn Right 158 Move 167 167 Sense Ahead 164 160 Marker 1 Sense LeftAhead 161 162 Marker 1 Turn Left 164 Sense RightAhead 163 165 Marker 1 Turn Right 164 Move 182 182 Move 153 166 Turn Left 165 Sense Ahead 169 168 Marker 0 Turn Left 167 Move 170 167 Sense Ahead 178 171 Marker 5 Sense Ahead 174 172 Marker 4 Sense Ahead 175 173 Marker 3 Sense Ahead 176 174 Marker 2 Mark 5 178 Mark 4 178 Mark 3 178 Mark 2 178 Sense Ahead 179 167 Home Move 180 180 Drop 118 Sense Ahead 183 182 Marker 1 Turn Left 183 Move 184 182 Sense Ahead 193 185 Marker 5 Sense Ahead 188 186 Marker 4 Sense Ahead 189 187 Marker 3 Sense Ahead 190 188 Marker 2 Mark 5 193 Mark 4 193 Mark 3 193 Mark 2 193 Sense Ahead 193 182 Home Move 194 194 Drop 118


Plus que demain pour débugger la jolie fourmi et prier...:-\

J'suis tout mouru, moi. §censuré§


__________________

Allez jeter un œil à mon portfolio !


Signaler ce message à un modérateur | IP: Logguée
Temps en ligne : 103 Jours, 6 Heures, 14 Minutes, 38 Secondes en ligne

Old Post 06-06-2004 23:41
Cliquez ici pour voir le profil de Zakath Cliquez ici pour lui envoyer un message privé  Visiter la Page Perso de Zakath! Trouver plus de messages de Zakath Ajouter Zakath à votre liste d'amis Editer/Effacer le Message Citer le message dans la réponse
 Solacin  Rechercher tous les messages de ce membre Cliquez ici pour envoyer un message privé à cet utilisateur
Guru

Déconnecté

Niveau : 5
N° de Membre : 11117

Ancienneté : 96%
Participation : 10%
Inscription: 23 Mar 2003
Localisation: 974
Age: 52
Messages: 8254
Sujets Lancés : 28

Et ben, quel boulot Zakath !!!!!!


__________________


Signaler ce message à un modérateur | IP: Logguée
Temps en ligne : 25 Jours, 5 Heures, 22 Minutes, 48 Secondes en ligne

Old Post 07-06-2004 05:51
Cliquez ici pour voir le profil de Solacin Cliquez ici pour lui envoyer un message privé  Trouver plus de messages de Solacin Ajouter Solacin à votre liste d'amis       Editer/Effacer le Message Citer le message dans la réponse
Il est actuellement 05:05 (GMT) Poster un nouveau sujet    Poster une réponse   
Page(s) (4): [ 1   2   3   4   > ]  Sujet précédent   Sujet suivant
Forum OXMO > Section Technique > Actualité - Débats > Concours de programmation ICFP

Aller au Forum:
Notez ce sujet :


 Réponse Rapide
Titre: (Optionnel)
Message:

Convertir automatiquement les URLs Montrer la Signature
Afficher une version imprimable | Envoyer cette page par email | S'inscrire à ce sujet | Télécharger ce sujet
Règles du forum :
Créer de nouveaux sujets
Répondre aux messages
Attacher des fichiers
Editer vos messages
: not autorisé
: not autorisé
: not autorisé
: not autorisé
Le Code HTML est OFF
Le Code vB est ON
Les Smileys sont ONs
Le code [IMG] est ON
 
< Contactez-nous - Forum OXMO>

Uptime du serveur SQL : 3 jour(s) 4 heure(s) et 42 minute(s)
Page générée en 0.015987 secondes en exécutant 46 requêtes SQL.
Apache - Compression GZIP : Activée.