完成GameBoard::leaderboard()计算的代码 #1

Closed
opened 2024-02-09 05:45:49 +00:00 by szTom · 0 comments
Owner

std::vector<TeamRanking> GameBoard::leaderboard() const {
std::vector<TeamRanking> res(t);
std::vector<PlayerRanking> prank(n);
for (Player i = 1; i <= n; ++i)
prank[i - 1].player = i;
for (Team i = 1; i <= t; ++i)
res[i - 1].team = i;
for (pos_t x = 0; x < h; ++x) {
for (pos_t y = 0; y < w; ++y) {
auto& tile = at(x, y);
if (tile.owner == neutral_player)
continue;
prank[tile.owner - 1].land += 1;
prank[tile.owner - 1].unit += tile.unit;
}
}
// for (auto &p : prank) {
// res[teamOf(p.player) - 1]
// TODO
}

参考文档“队伍排名”小节。

预计用时:<=10min

https://git.gzezfisher.top/szTom/opengenerals/src/commit/7c156dacb7168de66396eec0c952d519c96cc23b/processor/logic/GameBoard.cpp#L115-L137 参考文档“队伍排名”小节。 预计用时:<=10min
ez_lcw referenced this issue from a commit 2024-02-10 15:05:14 +00:00
szTom closed this issue 2024-02-10 15:32:10 +00:00
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: szTom/opengenerals#1
No description provided.