in simple_game/comm2.h [159:178]
rela::TensorDict feature() const override {
auto s = torch::zeros({ 4 + 3 });
auto accessor = s.accessor<float, 1>();
int idx = playerIdx();
if (idx == 1 && card1_ >= 0) {
accessor[card1_] = 1.0f;
} else if (idx == 2 && card2_ >= 0) {
accessor[2 + card2_] = 1.0f;
}
if (public_action_ >= 0) {
accessor[4 + public_action_] = 1.0f;
}
auto tensorPlayerIdx = (playerIdx() == 1 ? torch::zeros({1}) : torch::ones({1}));
return { { "s", s }, {"legal_move", legalActionMask() }, { "player_idx", tensorPlayerIdx } };
}