Class: Company

Company


new Company()

This class represents your company. Game entity class. The game engine will create an instance under the name "company" for you.
This diagram shows the order and point in time when a particular function (you implemented) is called by the engine.

The number put in brackets defines the priority. The higher the priority the first it is called, e.g. on a day which is the first of a month (but not the start of a week), the following methods will be called in that order: realEstateAgent, hiringProcess, doMonthly, doDaily, foodDelivery.

called once at the
start of the game
called at the
start of each month
called at the
start of each week
called at the
start of each day
launch (300) realEstateAgent (290) doWeekly (190) doDaily (90)
hiringProcess (280) foodDelivery (80)
doMonthly(270)
Source:
Company.js

Members


humanResources :HumanResources

The human resources department in your company
Type:
Source:
Company.js

establishments :List

A list of all of your restaurants
Type:
Source:
Company.js

grocer :Grocer

A handle to your grocer (to buy the fresh food you need every day)
Type:
Source:
Company.js

menu A handle to your menu you offer in all of your restaurants (you try to build a brank, so you offer the same meals in each of your restaurants)
Type:
Source:
Company.js

cash :Number

Your cash money. You cannot spend more at any time. That means whenever you would need more money, you go bankrupt. The game start with 50,000. Read-only.
Type:
  • Number
Source:
Company.js

launch :function

CALLBACK METHOD! This gets called once at the start of the game. Implement your callback and assign it to this property.
Type:
  • function
Source:
Company.js
Example
company.launch = function() {
	// things you want to do at the start of the game, e.g. define a menu
};

doDaily :function

CALLBACK METHOD! This gets called at the start of each day. Implement your callback and assign it to this property.
Type:
  • function
Source:
Company.js
Example
company.doDaily = function(dailyStatistics) {
	// things you want to do each day, like ordering food 
	// (via company.grocer) or using 
	// dailyStatistics to look at last day's statistics. 
};

doWeekly :function

CALLBACK METHOD! This gets called at the start of each week. Implement your callback and assign it to this property.
Type:
  • function
Source:
Company.js
Example
company.doWeekly = function() {
		// things you want to do each week
};

doMonthly :function

CALLBACK METHOD! This gets called at the start of each month. Implement your callback and assign it to this property.
Type:
  • function
Source:
Company.js
Example
company.doMonthly = function() {
	// things you want to do each month
};

realEstateAgent :function

CALLBACK METHOD! This gets called at the start of each month. Implement your callback and assign it to this property.
Type:
  • function
Source:
Company.js
Example
company.realEstateAgent = function(realEstateProfiles) {
	// At the start of a month you can buy/rent new locations. 
	// Use realEstateProfiles to see what is available.
};

foodDelivery :function

CALLBACK METHOD! This gets called at the start of each day. Implement your callback and assign it to this property.
Type:
  • function
Source:
Company.js
Example
company.foodDelivery = function(foodDelivery) {
	// Each day you get a food delivery and you need to make sure that 
	// all locations get what they need by using foodDelivery to 
	// distribute the fresh items.
};	

Methods


getEstablishments(city)

A list of all of your restaurants in a particular city.
Parameters:
Name Type Description
city String the city name to query
Source:
Company.js
Returns:
a list of establishments
Type
List