load("//tools:copts.bzl", "COPTS")

# StateRecorder library for recording game states during self-play
cc_library(
    name = "state_recorder",
    srcs = ["StateRecorder.cpp"],
    hdrs = ["StateRecorder.hpp"],
    copts = COPTS,
    visibility = ["//visibility:public"],
    deps = [
        "//src/main/cpp/net/eagle0/shardok/library:shardok_c_types",
        "//src/main/protobuf/net/eagle0/shardok/api:game_state_view_cc_proto",
        "@com_google_protobuf//:protobuf",
    ],
)

# Self-play battle runner with state recording
cc_library(
    name = "self_play_battle_runner",
    srcs = ["SelfPlayBattleRunner.cpp"],
    hdrs = ["SelfPlayBattleRunner.hpp"],
    copts = COPTS,
    visibility = ["//visibility:public"],
    deps = [
        ":state_recorder",
        "//src/main/cpp/net/eagle0/shardok/ai:shardok_ai_client",
        "//src/main/cpp/net/eagle0/shardok/ai_battle_simulator:ai_battle_config",
        "//src/main/cpp/net/eagle0/shardok/ai_battle_simulator:ai_battle_simulator",
        "//src/main/cpp/net/eagle0/shardok/library:engine",
        "//src/main/cpp/net/eagle0/shardok/library:game_state_w",
        "//src/main/cpp/net/eagle0/shardok/library/settings:game_settings",
        "//src/main/protobuf/net/eagle0/shardok/common:command_type_cc_proto",
    ],
)

# Self-play generator binary for generating ML training data
cc_binary(
    name = "self_play_generator",
    srcs = ["self_play_generator_main.cpp"],
    copts = COPTS,
    data = [
        "//src/main/resources/net/eagle0/shardok:battalion_types",
        "//src/main/resources/net/eagle0/shardok:settings",
        "//src/main/resources/net/eagle0/shardok/maps",
    ],
    deps = [
        ":self_play_battle_runner",
        ":state_recorder",
        "//src/main/cpp/net/eagle0/common:filesystem_utils",
        "//src/main/cpp/net/eagle0/common:tsv_parser",
        "//src/main/cpp/net/eagle0/shardok/ai_battle_simulator:ai_battle_config",
        "//src/main/cpp/net/eagle0/shardok/ai_battle_simulator:ai_battle_simulator",
        "//src/main/cpp/net/eagle0/shardok/library/settings:game_settings",
        "//src/main/cpp/net/eagle0/shardok/util:battalion_type_registrar",
    ],
)
