Elemente, Kombos, Fallen, KI mit Vorausschau, Kampagne, Hotseat und Netzwerk, Werkstatt, Erfolge, Tagesaufgaben, Tests und Exporte. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QPgKvy5W9WRNFHjkm5QsHx
36 lines
1.3 KiB
GDScript
36 lines
1.3 KiB
GDScript
extends SceneTree
|
|
## Misst Deckarchetypen im Duell (beide gierig): wer beginnt, Mono gegen Paar.
|
|
|
|
func deck(r: RandomNumberGenerator, mono: bool) -> Array:
|
|
var pool: Array = Cards.ELEMENTS.duplicate()
|
|
Game.shuffle(pool, r)
|
|
return Game.build_opponent_deck(r, [pool[0]] if mono else [pool[0], pool[1]])
|
|
|
|
|
|
func duel(r: RandomNumberGenerator, first_mono: bool, second_mono: bool) -> bool:
|
|
var second := Game.Player.new("Gegner 1", deck(r, second_mono), false, Game.START_LIFE, "x")
|
|
var g := Game.new_battle_with(deck(r, first_mono), [second], r)
|
|
var guard := 0
|
|
while g.winner == "" and guard < 300:
|
|
AI.take_turn(g, g.current(), true)
|
|
guard += 1
|
|
return g.winner == "human"
|
|
|
|
|
|
func run(label: String, a_mono: bool, b_mono: bool, games: int, r: RandomNumberGenerator) -> void:
|
|
var wins := 0
|
|
for i in games:
|
|
if duel(r, a_mono, b_mono):
|
|
wins += 1
|
|
print("%-28s Startspieler gewinnt %3d%%" % [label, wins * 100 / games])
|
|
|
|
|
|
func _initialize() -> void:
|
|
var r := RandomNumberGenerator.new()
|
|
r.seed = 5
|
|
run("Paar gegen Paar", false, false, 200, r)
|
|
run("Mono gegen Mono", true, true, 200, r)
|
|
run("Paar (startet) gegen Mono", false, true, 200, r)
|
|
run("Mono (startet) gegen Paar", true, false, 200, r)
|
|
quit()
|