Skip to content

Instantly share code, notes, and snippets.

@cflewis
Created December 11, 2010 21:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cflewis/737677 to your computer and use it in GitHub Desktop.
Save cflewis/737677 to your computer and use it in GitHub Desktop.
class StarcraftResourceGame extends EgyptModel {
val name = "Starcraft Resource Game"
def get_crystal = {
require(crystals > 0)
crystals--
}
def get_gas = {
require(gas > 0)
gas--
}
def crystal_rush = {Map(get_crystal -> 0.9, get_gas -> 0.1)}
def gas_rush = {Map(get_gas -> 0.9, gas_crystal -> 0.1)}
def random = {Map()}
def environment_model = {Map('gas -> 50, 'crystals -> 50))}
def interaction_model = {
rules([get_crystal, get_gas])
end_system(crystals == 0 && gas == 0)
}
def user_model = {
users([crystal_rush, gas_rush, random])
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment