Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
genie_logiciel_2015
the_dungeon_project
Commits
d5abaee3
Commit
d5abaee3
authored
Dec 30, 2015
by
Yann Ramusat
Browse files
New package for the different kinds of AIs.
parent
18b4f6ec
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/artificial_intelligence/AI_Controler.java
View file @
d5abaee3
package
artificial_intelligence
;
import
artificial_intelligence.AIs.AI_Behaviour
;
import
core.gamestate.GameContent
;
import
core.relayer.Relayer
;
...
...
@@ -8,7 +9,7 @@ import java.util.ArrayList;
/**
* Created by yann on 30/12/15.
*
* A part of th
e
code is inspired by the class AIControler implemented by Arnaud Guerquin.
* A part of th
is
code
(killAll and startAll)
is inspired by the class AIControler implemented by Arnaud Guerquin.
*/
public
class
AI_Controler
{
...
...
@@ -41,8 +42,12 @@ public class AI_Controler {
/*** FACTORY PART ***/
public
static
void
add
(
GameContent
gameContent
,
Relayer
dmr
)
{
AI_Entity
ai
=
new
AI_Entity
(
gameContent
,
dmr
);
public
static
void
add
(
GameContent
gameContent
,
Relayer
dmr
,
AI_Behaviour
type
)
{
AI_Entity
ai
=
null
;
switch
(
type
)
{
case
DEFAULT:
ai
=
new
AI_Entity
(
gameContent
,
dmr
);
}
list
.
add
(
ai
);
}
}
src/artificial_intelligence/AI_Entity.java
View file @
d5abaee3
...
...
@@ -18,37 +18,18 @@ import static java.lang.Math.abs;
* This class provide a functional AI working on an independant thread.
* Please instanciate the class correctly an then call start() function on this.
*
* TODO
All other groups will have to securize their
class
es
wi
th synchronized to avoid concurrency
.
* TODO
This
class wi
ll be abstract
.
*/
public
class
AI_Entity
extends
Thread
{
/* Extern information */
private
Map
map
;
//TODO The three following objects are redundant. It's because the AI works with different version of the game
//TODO and the final version is not yet known.
//TODO This will be fixed when other groups will be sure of the type of the objects they will use.
private
GameState
gameState
;
// to have direct access to the map
private
Map
map
;
private
Relayer
relayer
;
//boolean to stop the thread
private
boolean
endThread
;
/* Intern information */
/**
* Instanciate an autonomous AI of indicated type given as context a Map, a GameState and a Relayer to contact.
*
* This use the core's classes.
*
* @param Map the actual map of the game.
* @param GameState the gamestate of the game.
* @param Relayer the relayer to contact.
*/
AI_Entity
(
Map
map
,
GameState
gameState
,
Relayer
relayer
)
{
this
.
map
=
map
;
this
.
gameState
=
gameState
;
this
.
relayer
=
relayer
;
}
private
boolean
endThread
;
/**
* Instanciate an autonomous AI of indicated type given as context a GameContent and a Relayer to contact.
...
...
src/artificial_intelligence/AI_Behaviour.java
→
src/artificial_intelligence/
AIs/
AI_Behaviour.java
View file @
d5abaee3
package
artificial_intelligence
;
package
artificial_intelligence
.AIs
;
/**
* Created by yann on 30/12/15.
*/
public
enum
AI_Behaviour
{
DEFAULT
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment