EnemyMovementUseCase

scalata.application.usecases.enemyusecases.EnemyMovementUseCase

Calculates one AI movement step for every living enemy inside the supplied room.

==== Key steps ====

  • Generate Prolog facts – encode the grid size, obstacles (items + other enemies), enemies’ positions and the player location/visibility.
  • Run Prolog rules (breadth-first search) – compute the cost-to-player for every reachable tile and derive best_moves_all/1.
  • Conflict resolution – group candidate moves per enemy, keep only the cheapest ones, then greedily pick non-overlapping destinations.
  • Apply moves – return a new scalata.domain.world.Room with updated enemy positions.

The function is pure: it builds a Prolog engine, computes the moves and returns a modified room; the original room and session remain unchanged.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

override def execute(currentRoom: Room, gameSession: GameSession): Room

Decide the next tile for every enemy.

Decide the next tile for every enemy.

Value parameters

currentRoom

room whose enemies must move

gameSession

full session (needed for player stats)

Attributes

Returns

a copy of currentRoom with enemies moved one step

Definition Classes