Making a TBA Domain

Having written several versions of a TBA domain, helped dozens of students with what tripped them up with their version, and look through dozens of submitted, working domains, I now have an informed recommended design for your domain code.

If I were starting a new domain from scratch, knowing what I know now, here’s how I would do it.

1 Global variables

I’d think of global variables in three categories:

1.1 World definition

I’d define the world in several global variables:

1.2 Config information

1.3 User progress

2 Helper functions

I’d make helper functions for the commands I plan to send to the hub:

3 Bookkeeping

3.1 /newhub

3.2 /arrive

3.3 /depart

3.4 /dropped

Nothing else needed here: the actually dropping is handled by the hub.

3.5 /command