update
This commit is contained in:
@@ -68,7 +68,6 @@ static func evaluate(g: Game, p: Game.Player) -> float:
|
||||
# --- Vorausschau ---------------------------------------------------------------
|
||||
|
||||
const MAX_TARGETS := 4 # je Angreifer nur die aussichtsreichsten Ziele prüfen
|
||||
static var allow_upgrade := true # zum Messen: Verbessern erwägen
|
||||
const DEEPEN := 8 # so viele beste Erstschritte bekommen Folgeschritte
|
||||
const FOLLOW_UPS := 10 # Folgeschritte je vertieftem Kandidat
|
||||
static var time_budget_ms := 150 # Zeitbudget je Entscheidung; danach der beste bisherige Zug
|
||||
@@ -99,18 +98,9 @@ static func candidate_actions(game: Game, p: Game.Player, prune: bool = false) -
|
||||
for card in p.hand:
|
||||
if game.can_play(p, card)[0]:
|
||||
out.append({"type": "play", "card": card, "face_down": false})
|
||||
var has_target := not game.enemies_of(p).is_empty()
|
||||
for cr in p.board:
|
||||
if cr.hidden:
|
||||
if game.can_reveal(p, cr)[0]:
|
||||
out.append({"type": "reveal", "creature": cr})
|
||||
elif allow_upgrade and has_target:
|
||||
# Nur Verbesserungen, die sich noch in diesem Zug auszahlen können: Doppelschlag für
|
||||
# ein Wesen, das gleich angreift; Flink für eines, das sonst erst nächsten Zug dürfte.
|
||||
if cr.can_attack() and game.can_upgrade(p, cr, "Doppelschlag")[0]:
|
||||
out.append({"type": "upgrade", "creature": cr, "keyword": "Doppelschlag"})
|
||||
if not cr.ready and not cr.has("Flink") and cr.power() > 0 and game.can_upgrade(p, cr, "Flink")[0]:
|
||||
out.append({"type": "upgrade", "creature": cr, "keyword": "Flink"})
|
||||
if cr.hidden and game.can_reveal(p, cr)[0]:
|
||||
out.append({"type": "reveal", "creature": cr})
|
||||
var pairs := []
|
||||
for i in p.board.size():
|
||||
for j in range(i + 1, p.board.size()):
|
||||
@@ -144,8 +134,6 @@ static func apply_on_clone(g2: Game, game: Game, action: Dictionary) -> void:
|
||||
g2.play_card(p2, action.card, bool(action.get("face_down", false)))
|
||||
"reveal":
|
||||
g2.reveal(p2, g2.find_creature(action.creature.uid))
|
||||
"upgrade":
|
||||
g2.upgrade(p2, g2.find_creature(action.creature.uid), action.keyword)
|
||||
"fuse":
|
||||
g2.fuse(p2, g2.find_creature(action.creature.uid), g2.find_creature(action.other.uid))
|
||||
_:
|
||||
@@ -269,10 +257,6 @@ static func choose_action_greedy(game: Game, p: Game.Player) -> Dictionary:
|
||||
var t = pick_attack_target(game, p, cr)
|
||||
if t != null:
|
||||
return {"type": "attack", "creature": cr, "target": t}
|
||||
if not game.enemies_of(p).is_empty():
|
||||
var strongest = _best(p.board.filter(func(c): return not c.hidden and game.can_upgrade(p, c, "Doppelschlag")[0]), func(c): return c.power())
|
||||
if strongest != null:
|
||||
return {"type": "upgrade", "creature": strongest, "keyword": "Doppelschlag"}
|
||||
if game.can_draw(p)[0]:
|
||||
return {"type": "draw"}
|
||||
return {"type": "end"}
|
||||
@@ -307,8 +291,6 @@ static func apply_action(game: Game, p: Game.Player, action: Dictionary) -> void
|
||||
game.draw(p)
|
||||
"reveal":
|
||||
game.reveal(p, action.creature)
|
||||
"upgrade":
|
||||
game.upgrade(p, action.creature, action.keyword)
|
||||
"attack":
|
||||
game.attack(action.creature, action.target)
|
||||
"fuse":
|
||||
|
||||
Reference in New Issue
Block a user