thebotslam

How does a group of us build and code a bot team?

thebotslam saves your bots' code files on your own computer, never on our servers. So the way to share code with a group is the way programmers everywhere do it: a Git repository on GitHub. Everyone has a full copy of every file, GitHub keeps them in step, and it keeps a history of every change, so you can always go back.

These steps use GitHub Desktop, a free app that does everything with buttons. (If you already use git on the command line, the same steps are clone, pull, add, commit and push.)

1. One person sets up the repository

  1. Everyone in the group makes a free account at github.com.
  2. One person (the team's organizer) clicks New repository on GitHub, names it after your team (for example our-bot-team), picks Private so only your group can see the code, ticks Add a README file, and clicks Create repository.
  3. On the repository's page, go to Settings → Collaborators → Add people and invite each teammate by their GitHub username. Each of them accepts the invitation from their email or from GitHub.

2. Everyone gets a copy

  1. Install GitHub Desktop and sign in with your GitHub account.
  2. Choose File → Clone repository, pick your team's repository and choose a folder on your computer, for example Documents/our-bot-team. That folder is your copy of all the team's code.

3. Agree on a layout

Keep it simple: one folder per bot, and one person in charge of each bot's file. For example:

our-bot-team/
  README.md        who owns which bot, and each bot's parts
  scout/scout.py
  tank/tank.py
  shared-notes.md  plans, ideas, what each bot says on the team notepad

In the README, write down each bot's machine (its chassis and what's on each mount), so anyone can build the same machine in their own Factory to test the code.

4. Save your code into the shared folder

  1. In thebotslam, open Brain code and your bot.
  2. Click Save. In Chrome and Edge, the first save asks where to put the file: pick your bot's folder in the repository (for example our-bot-team/scout). After that, every Save writes straight to that file.
  3. In other browsers, Save downloads a copy: move it into your bot's folder in the repository.
  4. To work on a file a teammate wrote, click Open file… in Brain code and choose it from the repository folder.

5. The everyday routine

  1. Before you start: in GitHub Desktop, click Fetch origin, then Pull origin, to get everyone's latest changes. In Chrome and Edge, a file you have open in Brain code reloads by itself when it changes on disk, as long as you have no unsaved changes to it.
  2. Work: edit your bot's code, test it in Brain code, and Save.
  3. Share: in GitHub Desktop you'll see the files you changed. Write a short summary (for example Scout retreats when hit), click Commit to main, then Push origin.
  4. Tell the group what you changed, so they pull it and try it.

6. When two people change the same file

If two people change the same lines, GitHub Desktop says there's a conflict when you pull. It shows both versions in the file, marked with <<<<<<<, ======= and >>>>>>>. Open the file, keep the parts you want, delete the markers, test it in Brain code, then commit and push.

The best way to avoid conflicts: one person per bot file, and pull before you start work.

7. Bigger changes: branches and pull requests

For a big rewrite you'd like a teammate to check first:

  1. In GitHub Desktop, choose Branch → New branch and name it (for example smarter-tank).
  2. Commit and push your changes as usual: they go to the branch, not to everyone's main copy.
  3. Click Create Pull Request. On GitHub, your teammates read the changes, comment, and try them.
  4. When everyone agrees, click Merge pull request. Everyone gets the change at their next pull.

8. Entering matches as a team

A team entered on the ladder or in a tournament belongs to one thebotslam account. Choose who enters it. Before a match, they pull the latest code, open each bot's file in Brain code, and check that each bot has the program it should run.

Good habits