Below are the rules and instructions for running a Capture the Flag tournament in breve. See the sample file CaptureTheFlagTemplate.tz for an sample tournament with two simple team strategies.
If you have any questions about running a Capture the Flag tournament in breve, mail me.
- You'll need to download the Capture the Flag simulation files.
- Two teams of 10 players compete, the Reds and the Blues.
- Each team has a home-side—Blues on the negative side of the X-axis, Reds on the positive side.
- If a player is tagged offsides, the player is sent to jail.
- If a player tags the jail on the other team's side, all of the jailed teammates are freed. The freed teammates are automatically zapped back to random locations on their home-side ("free walkbacks"). The agent that tagged the jail does not automatically return home.
- Agent's cannot move their own team's flag.
- The game is over when one of the following conditions has been met:
- one team's flag has been carried to the other team's side
- all players from one team have been captured
- 500 simulated seconds have elapsed
- The winning team is the team that:
- captures the other team's flag; or,
- the one that captures all of the other team's opponents; or,
- if neither of the above conditions are met, then the winning team is the one which has possession of its opponent's flag for the larger portion of the game.
- The results of the competition are printed to the output log.
- Your entry into the competition should be a single breve class, a subclass of "CaptureTheFlagPlayer" with a unique name.
- Your team will arbitrarily be assigned to be the red or blue players. Blue players have the team number "0" and live on the negative side of the X-axis. Red players have the team number "1" and live on the positive side of the X-axis.
- Agents can execute the following action methods:
- turn-left: turns the agent slightly to the left.
- turn-right: turns the agent slightly to the right.
- set-speed to X: sets the speed of the agent on a scale from 0.0 to 1.0.
- Agents can execute the following methods to get sensor information:
- get-id-number: returns a unique number between 0 and 9 for each agent on the team. You can use this to assign different tasks to different agents (for example: offense, flag guard and jail guard).
- sense-my-team: returns a list of the players on the agent's team in the agent's sensor range.
- sense-other-team: returns a list of the players on the other team in the agent's sensor range.
- sense-my-flag: returns a single object—the flag of the agent's team, if it is in the sensor range.
- sense-other-flag: returns a single object—the flag of the other team, if it is in the sensor range.
- sense-my-jail: returns a single object—the jail where your teammates are being held, if it is in the sensor range. This is the jail you want to get to in order to free your teammates.
- sense-other-jail: returns a single object—the jail where the other team's players are being held, if it is in the sensor range. This is the jail you want to defend.
- get-my-home-location: returns a vector, the closest point to the agent on the agent's home-side.
- get-angle-to vector: returns a number representing, in radians, the angle to the specified point. A positive number indicates that the point is to right of the agent, a negative number indicates that the point is to the left.
- Given an object, be it a player, a flag or a jail, the following method can be used:
- get-location: returns the location of an object.
- The CaptureTheFlagController class responds to the following useful methods:
- get-time: returns the current time in simulated seconds. Since the game is only 500.0 seconds long, you may wish to modify agent behaviors based on the current time.
- get-jailed-red-count: returns the number of Red agents in jail.
- get-jailed-blue-count: returns the number of Blue agents in jail.
- To run a match between two strategies:
- Edit the file Tournament.tz (included with the download files).
- Include the proper source files with "@use" lines
- Change the two "new" lines (16 & 18) to create the proper object types.
- Run the simulation!
Return to the Capture the Flag page.