-
Notifications
You must be signed in to change notification settings - Fork 15
Running your code!
Running your code is simple! The two main files we have provided for you to run your code are main.py and visualizer.py. The command line arguments for each are listed below.
You must run main.py first before running the visualizer. main.py creates the log files for the visualizer to act upon, and so to see your latest run, run main.py before running the visualizer.
main.py is the main file for running your code. Its command line arguments are
Has a default value of 300. This is the upper limit on the number of turns in a game.
The score threshold has a base threshold of 200.
This is the directory that holds each of the board files. The default value is boards/; unless you plan on moving the board directory, this should not have to be specified.
Similarly, this is the directory for the log files. The default value is logs/.
This reads from the specified file for a list of companies. The default value is companies.txt.
This specifies which file to use as the board. The default is tiny. Do not attach the .txt extension! This argument only takes the name of the file.
Similarly, this is the suffix to which the board will write the log file. So, if the argument --board_file is tiny, and the value of --log_file is out, the script will write to tiny-out.txt in the --board_directory folder.
The --debug flag indicates whether or not this script prints debug messages at each turn.
Thus, an example call to main.py would be
python main.py --board_file gates4 --log_file test
python main.py --board_file sample --debug
Debug is meant to help give you a global state of the board so you can view your bots without the need for a visualizer. The tile will have different representations - the source code for tile is provided as such
class Tile:
def __repr__(self):
if not booth:
return "BOOTH"
if not visible:
return "TXXXX"
if end_of_line:
return "E%02d%02d" % (len(self.bots), len(self.bots_in_line))
if line:
return "L%02d%02d" % (len(self.bots), len(self.bots_in_line))
# if it's a normal tile it shows up as
return "T%02d%02d" % (len(self.bots), len(self.bots_in_line))
class State:
def __repr__(self):
return "ID_%02d @%02d.%02d P_%02d_T_%02d_L_%02d" % (
self.id, self.x, self.y, self.progress, self.threshold, self.line_pos)
ID is 0, 1, 2, or 3 depending on which bot you are. (x, y) are your coordinate location. Progress is how much progress you've made talking to a recruiter if you are at the front. Threshold is the "stickiness", or how many moves you need to repeat before you can move into a tile. Line_pos is your position in the line.
Ask us in #help if you have any questions interpreting this.
The visualizer file is for visualizing your log file. It reads from the log file that main.py generates while running. It uses a similar file format scheme as main.py. It has --board_directory, --board_file, --log_directory, and log_file, all of which act in the same manner that main.py does. The only different command line argument here is
which is how fast the game moves.