Skip to content

Commit

Permalink
Do not make robotInfo and thus trajectories available to opponent AI
Browse files Browse the repository at this point in the history
See merge request main/Sumatra!1794

sumatra-commit: 0df67f854a243a7590e544878b4f81ef434423df
  • Loading branch information
Mk-arc authored and TIGERs GitLab committed Jan 23, 2024
1 parent fcf8fed commit 122e55c
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@
import com.sleepycat.persist.model.Persistent;
import edu.tigers.sumatra.ids.BotID;
import edu.tigers.sumatra.math.IMirrorable;
import lombok.AccessLevel;
import lombok.Data;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.Setter;

import java.util.Collections;
import java.util.Map;
Expand All @@ -29,6 +32,8 @@ public class SimpleWorldFrame implements IMirrorable<SimpleWorldFrame>
private final Map<BotID, ITrackedBot> bots;
private final ITrackedBall ball;
private final KickedBall kickedBall;
@Getter(AccessLevel.NONE)
@Setter(AccessLevel.NONE)
private transient Map<BotID, ITrackedBot> botsReadOnly;


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,16 @@
import edu.tigers.sumatra.ids.BotID;
import edu.tigers.sumatra.ids.EAiTeam;
import edu.tigers.sumatra.ids.ETeamColor;
import lombok.AccessLevel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.Getter;

import java.util.Collections;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;


/**
Expand All @@ -28,6 +31,8 @@ public class WorldFrame extends SimpleWorldFrame
private final Map<BotID, ITrackedBot> opponentBots;
private final Map<BotID, ITrackedBot> tigerBotsVisible;
private final Map<BotID, ITrackedBot> tigerBotsAvailable;
@Getter(AccessLevel.PRIVATE)
private final Map<BotID, ITrackedBot> allBots;
private final ETeamColor teamColor;
private final boolean inverted;

Expand All @@ -41,6 +46,8 @@ public WorldFrame(final SimpleWorldFrame simpleWorldFrame, final EAiTeam team, f
opponentBots = computeOpponentBots(simpleWorldFrame, team);
tigerBotsAvailable = computeTigersAvailable(simpleWorldFrame, team);
tigerBotsVisible = computeTigersVisible(simpleWorldFrame, team);
allBots = Stream.concat(opponentBots.entrySet().stream(), tigerBotsVisible.entrySet().stream())
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
}


Expand All @@ -58,6 +65,21 @@ public WorldFrame(final WorldFrame original)
opponentBots = original.getOpponentBots();
tigerBotsAvailable = original.getTigerBotsAvailable();
tigerBotsVisible = original.getTigerBotsVisible();
allBots = original.getAllBots();
}


@Override
public ITrackedBot getBot(BotID botId)
{
return allBots.get(botId);
}


@Override
public Map<BotID, ITrackedBot> getBots()
{
return allBots;
}


Expand Down

0 comments on commit 122e55c

Please sign in to comment.