Skip to content

Commit

Permalink
[game_scripts] Cosmetic whitespace harmonisation
Browse files Browse the repository at this point in the history
  • Loading branch information
charlesbeattie authored and tkoeppe committed Dec 7, 2020
1 parent f115c01 commit b9a8843
Show file tree
Hide file tree
Showing 34 changed files with 320 additions and 320 deletions.
8 changes: 4 additions & 4 deletions game_scripts/common/log.lua
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ the message will actually be printed.
]]

local log = {
INFO = 0,
WARN = -1,
ERROR = -2,
NEVER = -3,
INFO = 0,
WARN = -1,
ERROR = -2,
NEVER = -3,
}

local ESCAPE = string.char(27)
Expand Down
98 changes: 49 additions & 49 deletions game_scripts/common/pickups.lua
Original file line number Diff line number Diff line change
Expand Up @@ -39,55 +39,55 @@ pickups.moveType = {
}

pickups.defaults = {
apple_reward = {
name = 'Apple',
classname = 'apple_reward',
model = 'models/apple.md3',
quantity = 1,
type = pickups.type.REWARD
},
lemon_reward = {
name = 'Lemon',
classname = 'lemon_reward',
model = 'models/lemon.md3',
quantity = -1,
type = pickups.type.REWARD
},
strawberry_reward = {
name = 'Strawberry',
classname = 'strawberry_reward',
model = 'models/strawberry.md3',
quantity = 2,
type = pickups.type.REWARD
},
fungi_reward = {
name = 'Fungi',
classname = 'fungi_reward',
model = 'models/toadstool.md3',
quantity = -10,
type = pickups.type.REWARD
},
watermelon_goal = {
name = 'Watermelon',
classname = 'watermelon_goal',
model = 'models/watermelon.md3',
quantity = 20,
type = pickups.type.GOAL
},
goal = {
name = 'Goal',
classname = 'goal',
model = 'models/goal_object_02.md3',
quantity = 10,
type = pickups.type.GOAL
},
mango_goal = {
name = 'Mango',
classname = 'mango_goal',
model = 'models/mango.md3',
quantity = 100,
type = pickups.type.GOAL
}
apple_reward = {
name = 'Apple',
classname = 'apple_reward',
model = 'models/apple.md3',
quantity = 1,
type = pickups.type.REWARD
},
lemon_reward = {
name = 'Lemon',
classname = 'lemon_reward',
model = 'models/lemon.md3',
quantity = -1,
type = pickups.type.REWARD
},
strawberry_reward = {
name = 'Strawberry',
classname = 'strawberry_reward',
model = 'models/strawberry.md3',
quantity = 2,
type = pickups.type.REWARD
},
fungi_reward = {
name = 'Fungi',
classname = 'fungi_reward',
model = 'models/toadstool.md3',
quantity = -10,
type = pickups.type.REWARD
},
watermelon_goal = {
name = 'Watermelon',
classname = 'watermelon_goal',
model = 'models/watermelon.md3',
quantity = 20,
type = pickups.type.GOAL
},
goal = {
name = 'Goal',
classname = 'goal',
model = 'models/goal_object_02.md3',
quantity = 10,
type = pickups.type.GOAL
},
mango_goal = {
name = 'Mango',
classname = 'mango_goal',
model = 'models/mango.md3',
quantity = 100,
type = pickups.type.GOAL
}
}

return pickups
12 changes: 6 additions & 6 deletions game_scripts/common/property_helpers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -267,10 +267,10 @@ local function removeProperty(properties, keyList)
end

return {
RESULT = RESULT,
addProperty = addProperty,
removeProperty = removeProperty,
writeProperty = writeProperty,
readProperty = readProperty,
headTailSplit = headTailSplit,
RESULT = RESULT,
addProperty = addProperty,
removeProperty = removeProperty,
writeProperty = writeProperty,
readProperty = readProperty,
headTailSplit = headTailSplit,
}
14 changes: 7 additions & 7 deletions game_scripts/decorators/debug_observations.lua
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,10 @@ local function playersHoldingFlag()
end

local FLAG_STATE = {
NONE = 0,
HOME = 1,
CARRIED = 2,
DROPPED = 3,
NONE = 0,
HOME = 1,
CARRIED = 2,
DROPPED = 3,
}

local function redFlag()
Expand Down Expand Up @@ -212,9 +212,9 @@ local function blueFlag()
end

local HOME_FLAG_STATE = {
NONE = 0,
HOME = 1,
AWAY = 2,
NONE = 0,
HOME = 1,
AWAY = 2,
}

local function redFlagHome()
Expand Down
16 changes: 8 additions & 8 deletions game_scripts/decorators/property_decorator.lua
Original file line number Diff line number Diff line change
Expand Up @@ -165,12 +165,12 @@ local function decorate(api)
end

return {
RESULT = RESULT,
decorate = decorate,
addReadWrite = addReadWrite,
addReadOnly = addReadOnly,
addWriteOnly = addWriteOnly,
removeReadWrite = removeReadWrite,
removeReadOnly = removeReadOnly,
removeWriteOnly = removeWriteOnly,
RESULT = RESULT,
decorate = decorate,
addReadWrite = addReadWrite,
addReadOnly = addReadOnly,
addWriteOnly = addWriteOnly,
removeReadWrite = removeReadWrite,
removeReadOnly = removeReadOnly,
removeWriteOnly = removeWriteOnly,
}
20 changes: 10 additions & 10 deletions game_scripts/factories/language/fastmapping_factory.lua
Original file line number Diff line number Diff line change
Expand Up @@ -354,16 +354,16 @@ function fastmapping.createLevelApi(kwargs)
kwargs, objectCount, distractorObjectCount)

return factory.createLevelApi{
episodeLengthSeconds = kwargs.episodeLengthSeconds,
instructor = fastmapping.defaultInstructor,
levelMapSelector = selectors.createIdentity(fastMap),
objectContext = object_generator.createContext{
attributes = {
shape = kwargs.goalShapes,
pattern = {'solid'}
}
},
taskSelector = selectors.createIdentity(task),
episodeLengthSeconds = kwargs.episodeLengthSeconds,
instructor = fastmapping.defaultInstructor,
levelMapSelector = selectors.createIdentity(fastMap),
objectContext = object_generator.createContext{
attributes = {
shape = kwargs.goalShapes,
pattern = {'solid'}
}
},
taskSelector = selectors.createIdentity(task),
}
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,11 +296,11 @@ function factory.createLevelApi(kwargs)
env.__index = env

setmetatable(env, {
__call = function (cls, ...)
local self = setmetatable({}, cls)
self:_init(...)
return self
end
__call = function (cls, ...)
local self = setmetatable({}, cls)
self:_init(...)
return self
end
})

--[[ Function to define a one-dimensional adaptive staircase procedure
Expand Down
6 changes: 3 additions & 3 deletions game_scripts/factories/psychlab/point_and_click.lua
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,9 @@ end
-- Calculate normalised co-ordinates with respect to the widget.
local function _normaliseCoord(widget, mouseX, mouseY)
return {
(mouseX - widget.bounds.xMin) / (widget.bounds.xMax - widget.bounds.xMin),
(mouseY - widget.bounds.yMin) / (widget.bounds.yMax - widget.bounds.yMin),
mouseX, mouseY
(mouseX - widget.bounds.xMin) / (widget.bounds.xMax - widget.bounds.xMin),
(mouseY - widget.bounds.yMin) / (widget.bounds.yMax - widget.bounds.yMin),
mouseX, mouseY
}
end

Expand Down
10 changes: 5 additions & 5 deletions game_scripts/factories/psychlab/visual_search_factory.lua
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,11 @@ function factory.createLevelApi(kwargs)
env.__index = env

setmetatable(env, {
__call = function (cls, ...)
local self = setmetatable({}, cls)
self:_init(...)
return self
end
__call = function (cls, ...)
local self = setmetatable({}, cls)
self:_init(...)
return self
end
})

--[[ Function to define the adaptive staircase procedure (a 'class').
Expand Down
28 changes: 14 additions & 14 deletions game_scripts/factories/rooms/keys_doors_puzzle_factory.lua
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,20 @@ local timeout = require 'decorators.timeout'
local factory = {}

local ITEMS = {
key = {
name = 'Key',
classname = 'key',
model = 'models/hr_key_lrg.md3',
quantity = 1,
type = pickups.type.REWARD,
},
goal = {
name = 'Goal',
classname = 'goal',
model = 'models/hr_ice_lolly_lrg.md3',
quantity = 50,
type = pickups.type.REWARD
},
key = {
name = 'Key',
classname = 'key',
model = 'models/hr_key_lrg.md3',
quantity = 1,
type = pickups.type.REWARD,
},
goal = {
name = 'Goal',
classname = 'goal',
model = 'models/hr_ice_lolly_lrg.md3',
quantity = 50,
type = pickups.type.REWARD
},
}

local POSSIBLE_COLORS = {
Expand Down
8 changes: 4 additions & 4 deletions game_scripts/factories/skymaze_factory.lua
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,10 @@ function factory.createLevelApi(kwargs)
c = ''
for n = 1, kwargs.goalHeight do
c = c .. '\n\n' .. maker:makeEntity{
i = i,
j = j,
height = height + (n - 1) * PICKUP_HEIGHT,
classname = 'goal',
i = i,
j = j,
height = height + (n - 1) * PICKUP_HEIGHT,
classname = 'goal',
}
end
return c
Expand Down
20 changes: 10 additions & 10 deletions game_scripts/language/texter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ See also `format` method for a higher level interface.
Example:
data = {
count = 2,
pets = {
{ name = {first = 'Ajax', last = 'The Cat' } },
{ name = {first = 'Fido', last = 'The Dog' } }
}
count = 2,
pets = {
{ name = {first = 'Ajax', last = 'The Cat' } },
{ name = {first = 'Fido', last = 'The Dog' } }
}
}
assert(decode('count', data) == 2)
Expand All @@ -53,11 +53,11 @@ end
Example:
data = {
count = 2,
pets = {
{ name = {first = 'Ajax', last = 'The Cat' } },
{ name = {first = 'Fido', last = 'The Dog' } }
}
count = 2,
pets = {
{ name = {first = 'Ajax', last = 'The Cat' } },
{ name = {first = 'Fido', last = 'The Dog' } }
}
}
assert(format('[count] pets', data) == '2 pets')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,8 @@ local GOAL_REWARD = 10
local COLORS = {'red', 'green', 'blue', 'cyan', 'magenta', 'yellow'}
local objectContext = object_generator.createContext{
attributes = {
color = COLORS,
pattern = {'solid'},
color = COLORS,
pattern = {'solid'},
},
attributeDefaults = {
size = 'medium',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,13 +248,13 @@ function factory.createLevelApi(kwargs)

-- setup the adaptive staircase procedure
self.staircase = psychlab_staircase.createStaircase1D{
sequence = kwargs.setSizes,
correctRewardSequence = kwargs.correctRewardSequence,
fractionToPromote = kwargs.fractionToPromote,
fractionToDemote = kwargs.fractionToDemote,
probeProbability = kwargs.probeProbability,
fixedTestLength = kwargs.fixedTestLength,
initialDifficultyLevel = kwargs.initialDifficultyLevel,
sequence = kwargs.setSizes,
correctRewardSequence = kwargs.correctRewardSequence,
fractionToPromote = kwargs.fractionToPromote,
fractionToDemote = kwargs.fractionToDemote,
probeProbability = kwargs.probeProbability,
fixedTestLength = kwargs.fixedTestLength,
initialDifficultyLevel = kwargs.initialDifficultyLevel,
}

-- blockId groups together all rows written during the same episode
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -474,10 +474,10 @@ function factory.createLevelApi(kwargs)
end

return psychlab_factory.createLevelApi{
env = point_and_click,
envOpts = {environment = env, screenSize = SCREEN_SIZE,
maxStepsOffScreen = MAX_STEPS_OFF_SCREEN},
episodeLengthSeconds = 150
env = point_and_click,
envOpts = {environment = env, screenSize = SCREEN_SIZE,
maxStepsOffScreen = MAX_STEPS_OFF_SCREEN},
episodeLengthSeconds = 150
}
end

Expand Down
Loading

0 comments on commit b9a8843

Please sign in to comment.