Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#include "krabi2015.h"
Krabi2015::Krabi2015(bool isBlue) : StrategieV3(isBlue)
{
// Initialisation des stocks
//Initialisation des tableaux d'étapes
this->nombreEtapes = NOMBRE_ETAPES;
this->numeroEtapeGarage = ETAPE_GARAGE;
tableauEtapesTotal = new Etape*[NOMBRE_ETAPES];
actionEtape = new MediumLevelAction*[NOMBRE_ETAPES];
actionGoto = new ActionGoTo[NOMBRE_ETAPES];
// TODO: A supprimer pour une variable statique dans Etape
int numeroEtape = 0;
// Création des étapes
//arguments : Position, tableau des etapes liées, nombre d'étapes liées, numéro de l'étape, type d'étape, état de l'étape, nombreEtapesLieesParFinirEtape
Etape* etape0 = new Etape(Position(300, 1000, isBlue), numeroEtape++, tableauEtapesTotal, Etape::DEPART, -1, 0);
Etape* etape1 = new Etape(Position(836, 1700, isBlue), numeroEtape++, tableauEtapesTotal, Etape::CLAP, -1, 0);
Etape* etape2 = new Etape(Position(1500, 1100, isBlue), numeroEtape++, tableauEtapesTotal, Etape::CENTRE_TABLE,-1, 0);
//J ai modifié NOMBRE_ETAPES dans krabi2015.h et le etape.h
//Initialisation des actions par défaut
for(int i = 0 ; i < NOMBRE_ETAPES ; i++)
{
if (tableauEtapesTotal[i]->getState() == -1)
{
actionGoto[i] = ActionGoTo(tableauEtapesTotal[i]->getPosition());
actionEtape[i] = &actionGoto[i];
}
}
actionClap[0]= Clap(Position(836, 1700, isBlue),Position(1000, 1700, isBlue));
actionEtape[1]= &actionClap[0];
etape0->addVoisin(etape1);
etape1->addVoisin(etape2);
// Lancer Dijkstra
startDijkstra();
}
void Krabi2015::updateStock(){
switch(this->tableauEtapes[this->etapeEnCours]->getEtapeType()){
case Etape::DEPART :
this->tableauEtapes[this->etapeEnCours]->setEtapeType(Etape::POINT_PASSAGE);
break;
default :
this->tableauEtapes[this->etapeEnCours]->setEtapeType(Etape::POINT_PASSAGE);
}
}
int Krabi2015::getScoreEtape(int i){
/* TODO : Supprimer le modificateur temporel et inclure directement un coefficient dans le score pour les actions longues
Plus tard : pourquoi pas changer le système en ayant les FEU etc... fils de Etape, ça éviterait aussi le switch dans updateStock().
Juste faire attention à comment transmettre le stock à update.
*/
switch (this->tableauEtapesTotal[i]->getEtapeType()){
case Etape::CENTRE_TABLE :
return 200;
break;
case Etape::CLAP :
return 100;
break;
default :
return 0;
break;
}
}