Skip to content

Commit

Permalink
e.g. add enemy evaluation logic
Browse files Browse the repository at this point in the history
  • Loading branch information
mskasa committed Aug 27, 2023
1 parent 6c5f88a commit b0f405f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions enemy.go
Expand Up @@ -43,6 +43,7 @@ type strategy interface {
}
type assault struct{}
type tricky struct{}
type ambush struct{}

type underRune struct {
char rune
Expand Down Expand Up @@ -136,6 +137,10 @@ func (s *tricky) eval(p *player, x, y int) float64 {
return math.Sqrt(math.Pow(float64(p.y-y), 2) + math.Pow(float64(p.x-x), 2))
}
}
func (s *ambush) eval(p *player, x, y int) float64 {
// Implement the logic for calculating the evaluation value.
return float64(random(0, 30))
}

// Return a value between min and max
// e.g. random(0, 3) returns 0,1,2,3
Expand Down
2 changes: 1 addition & 1 deletion stage.go
Expand Up @@ -26,7 +26,7 @@ func initStages() []stage {
{
level: 1,
mapPath: "files/stage/map01.txt",
hunterBuilder: newEnemyBuilder().defaultHunter(),
hunterBuilder: newEnemyBuilder().defaultHunter().strategize(&ambush{}),
assassinBuilder: newEnemyBuilder().defaultAssassin(), // The only change is here.
gameSpeed: 1250 * time.Millisecond,
},
Expand Down

0 comments on commit b0f405f

Please sign in to comment.