diff --git a/game_scripts/common/log.lua b/game_scripts/common/log.lua index 7910cb868..a266156ff 100644 --- a/game_scripts/common/log.lua +++ b/game_scripts/common/log.lua @@ -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) diff --git a/game_scripts/common/pickups.lua b/game_scripts/common/pickups.lua index 74a604061..4ed508916 100644 --- a/game_scripts/common/pickups.lua +++ b/game_scripts/common/pickups.lua @@ -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 diff --git a/game_scripts/common/property_helpers.lua b/game_scripts/common/property_helpers.lua index 254f2c6e4..d4fc13916 100644 --- a/game_scripts/common/property_helpers.lua +++ b/game_scripts/common/property_helpers.lua @@ -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, } diff --git a/game_scripts/decorators/debug_observations.lua b/game_scripts/decorators/debug_observations.lua index c5d8997a0..3006836e1 100644 --- a/game_scripts/decorators/debug_observations.lua +++ b/game_scripts/decorators/debug_observations.lua @@ -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() @@ -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() diff --git a/game_scripts/decorators/property_decorator.lua b/game_scripts/decorators/property_decorator.lua index ee7d5a67e..6627be2a3 100644 --- a/game_scripts/decorators/property_decorator.lua +++ b/game_scripts/decorators/property_decorator.lua @@ -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, } diff --git a/game_scripts/factories/language/fastmapping_factory.lua b/game_scripts/factories/language/fastmapping_factory.lua index 1805f0973..5b47d0434 100644 --- a/game_scripts/factories/language/fastmapping_factory.lua +++ b/game_scripts/factories/language/fastmapping_factory.lua @@ -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 diff --git a/game_scripts/factories/psychlab/glass_pattern_detection_factory.lua b/game_scripts/factories/psychlab/glass_pattern_detection_factory.lua index d08a60a10..99db69842 100644 --- a/game_scripts/factories/psychlab/glass_pattern_detection_factory.lua +++ b/game_scripts/factories/psychlab/glass_pattern_detection_factory.lua @@ -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 diff --git a/game_scripts/factories/psychlab/point_and_click.lua b/game_scripts/factories/psychlab/point_and_click.lua index 94c7bba6a..3b9f0f0bd 100644 --- a/game_scripts/factories/psychlab/point_and_click.lua +++ b/game_scripts/factories/psychlab/point_and_click.lua @@ -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 diff --git a/game_scripts/factories/psychlab/visual_search_factory.lua b/game_scripts/factories/psychlab/visual_search_factory.lua index d17b5e841..34f527484 100644 --- a/game_scripts/factories/psychlab/visual_search_factory.lua +++ b/game_scripts/factories/psychlab/visual_search_factory.lua @@ -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'). diff --git a/game_scripts/factories/rooms/keys_doors_puzzle_factory.lua b/game_scripts/factories/rooms/keys_doors_puzzle_factory.lua index ccfd9bbb1..abd589308 100644 --- a/game_scripts/factories/rooms/keys_doors_puzzle_factory.lua +++ b/game_scripts/factories/rooms/keys_doors_puzzle_factory.lua @@ -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 = { diff --git a/game_scripts/factories/skymaze_factory.lua b/game_scripts/factories/skymaze_factory.lua index 6c5ed14fa..44ea8cb1d 100644 --- a/game_scripts/factories/skymaze_factory.lua +++ b/game_scripts/factories/skymaze_factory.lua @@ -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 diff --git a/game_scripts/language/texter.lua b/game_scripts/language/texter.lua index f755998f8..ed29d2562 100644 --- a/game_scripts/language/texter.lua +++ b/game_scripts/language/texter.lua @@ -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) @@ -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') diff --git a/game_scripts/levels/contributed/dmlab30/language_select_located_object.lua b/game_scripts/levels/contributed/dmlab30/language_select_located_object.lua index 97957b511..9c01e93b9 100644 --- a/game_scripts/levels/contributed/dmlab30/language_select_located_object.lua +++ b/game_scripts/levels/contributed/dmlab30/language_select_located_object.lua @@ -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', diff --git a/game_scripts/levels/contributed/psychlab/factories/change_detection_factory.lua b/game_scripts/levels/contributed/psychlab/factories/change_detection_factory.lua index e8f8ca748..232418d16 100644 --- a/game_scripts/levels/contributed/psychlab/factories/change_detection_factory.lua +++ b/game_scripts/levels/contributed/psychlab/factories/change_detection_factory.lua @@ -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 diff --git a/game_scripts/levels/contributed/psychlab/factories/landoltC_identification_factory.lua b/game_scripts/levels/contributed/psychlab/factories/landoltC_identification_factory.lua index 66ea87dc6..16854b3fd 100644 --- a/game_scripts/levels/contributed/psychlab/factories/landoltC_identification_factory.lua +++ b/game_scripts/levels/contributed/psychlab/factories/landoltC_identification_factory.lua @@ -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 diff --git a/game_scripts/levels/contributed/psychlab/factories/motion_discrimination_easy_factory.lua b/game_scripts/levels/contributed/psychlab/factories/motion_discrimination_easy_factory.lua index 684a8225a..6d9dddc30 100644 --- a/game_scripts/levels/contributed/psychlab/factories/motion_discrimination_easy_factory.lua +++ b/game_scripts/levels/contributed/psychlab/factories/motion_discrimination_easy_factory.lua @@ -322,8 +322,8 @@ function factory.createLevelApi(kwargs) function env:transformToFrameCoords(coords) self._frameCoords:val({ - math.floor((coords(1):val() / CANVAS_SIZE) * self._frameSize[1] + 0.5), - math.floor((coords(2):val() / CANVAS_SIZE) * self._frameSize[2] + 0.5) + math.floor((coords(1):val() / CANVAS_SIZE) * self._frameSize[1] + 0.5), + math.floor((coords(2):val() / CANVAS_SIZE) * self._frameSize[2] + 0.5) }) return self._frameCoords end @@ -442,10 +442,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 diff --git a/game_scripts/levels/contributed/psychlab/factories/motion_discrimination_factory.lua b/game_scripts/levels/contributed/psychlab/factories/motion_discrimination_factory.lua index 39e62ae41..84c3f6ca3 100644 --- a/game_scripts/levels/contributed/psychlab/factories/motion_discrimination_factory.lua +++ b/game_scripts/levels/contributed/psychlab/factories/motion_discrimination_factory.lua @@ -362,8 +362,8 @@ function factory.createLevelApi(kwargs) function env:transformToFrameCoords(coords) self._frameCoords:val({ - math.floor((coords(1):val() / CANVAS_SIZE) * self._frameSize[1] + 0.5), - math.floor((coords(2):val() / CANVAS_SIZE) * self._frameSize[2] + 0.5) + math.floor((coords(1):val() / CANVAS_SIZE) * self._frameSize[1] + 0.5), + math.floor((coords(2):val() / CANVAS_SIZE) * self._frameSize[2] + 0.5) }) return self._frameCoords end @@ -489,10 +489,10 @@ function factory.createLevelApi(kwargs) end return psychlab_factory.createLevelApi{ - env = point_and_click, - envOpts = {environment = env, screenSize = SCREEN_SIZE, - maxStepsOffScreen = kwargs.maxStepsOffScreen}, - episodeLengthSeconds = kwargs.episodeLengthSeconds + env = point_and_click, + envOpts = {environment = env, screenSize = SCREEN_SIZE, + maxStepsOffScreen = kwargs.maxStepsOffScreen}, + episodeLengthSeconds = kwargs.episodeLengthSeconds } end diff --git a/game_scripts/levels/contributed/psychlab/factories/multiple_object_tracking_factory.lua b/game_scripts/levels/contributed/psychlab/factories/multiple_object_tracking_factory.lua index ba96f7762..04570bd83 100644 --- a/game_scripts/levels/contributed/psychlab/factories/multiple_object_tracking_factory.lua +++ b/game_scripts/levels/contributed/psychlab/factories/multiple_object_tracking_factory.lua @@ -125,11 +125,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 }) local MAX_INT = math.pow(2, 32) - 1 diff --git a/game_scripts/levels/contributed/psychlab/factories/odd_one_out_factory.lua b/game_scripts/levels/contributed/psychlab/factories/odd_one_out_factory.lua index 1bde9e036..2040ca00f 100644 --- a/game_scripts/levels/contributed/psychlab/factories/odd_one_out_factory.lua +++ b/game_scripts/levels/contributed/psychlab/factories/odd_one_out_factory.lua @@ -155,11 +155,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 }) -- 'init' gets called at the start of each episode. @@ -253,9 +253,9 @@ function factory.createLevelApi(kwargs) self.currentTrial.reward = 0 self:addArray() self.pac:addTimer{ - name = 'trial_timeout', - timeout = TRIAL_TIMEOUT, - callback = function(...) return self:trialTimeoutCallback() end + name = 'trial_timeout', + timeout = TRIAL_TIMEOUT, + callback = function(...) return self:trialTimeoutCallback() end } self.currentTrial.trialId = self.trialId @@ -422,12 +422,12 @@ function factory.createLevelApi(kwargs) callback = nil end self.pac:addWidget{ - name = 'image_' .. i .. '_' .. j, - pos = pos, - size = size, - image = image, - imageLayer = BACK_LAYER, - mouseHoverCallback = callback, + name = 'image_' .. i .. '_' .. j, + pos = pos, + size = size, + image = image, + imageLayer = BACK_LAYER, + mouseHoverCallback = callback, } end end @@ -483,19 +483,19 @@ function factory.createLevelApi(kwargs) end if leftSide then self.pac:addWidget{ - name = 'respond_left', - pos = {0.0, 0.0}, - size = {0.4, 1.0}, - imageLayer = FRONT_LAYER, - mouseHoverCallback = callback, + name = 'respond_left', + pos = {0.0, 0.0}, + size = {0.4, 1.0}, + imageLayer = FRONT_LAYER, + mouseHoverCallback = callback, } else self.pac:addWidget{ - name = 'respond_right', - pos = {0.6, 0.0}, - size = {0.4, 1.0}, - imageLayer = FRONT_LAYER, - mouseHoverCallback = callback, + name = 'respond_right', + pos = {0.6, 0.0}, + size = {0.4, 1.0}, + imageLayer = FRONT_LAYER, + mouseHoverCallback = callback, } end end @@ -528,22 +528,22 @@ function factory.createLevelApi(kwargs) size = {0.05, 1.0} end self.pac:addWidget{ - name = 'respond_left', - pos = leftPos, - size = size, - image = self.images.whiteButton, - imageLayer = FRONT_LAYER, - mouseHoverCallback = leftResponseCallback, - mouseHoverEndCallback = hoverEndLeft, + name = 'respond_left', + pos = leftPos, + size = size, + image = self.images.whiteButton, + imageLayer = FRONT_LAYER, + mouseHoverCallback = leftResponseCallback, + mouseHoverEndCallback = hoverEndLeft, } self.pac:addWidget{ - name = 'respond_right', - pos = rightPos, - size = size, - image = self.images.whiteButton, - imageLayer = FRONT_LAYER, - mouseHoverCallback = rightResponseCallback, - mouseHoverEndCallback = hoverEndRight, + name = 'respond_right', + pos = rightPos, + size = size, + image = self.images.whiteButton, + imageLayer = FRONT_LAYER, + mouseHoverCallback = rightResponseCallback, + mouseHoverEndCallback = hoverEndRight, } end diff --git a/game_scripts/levels/contributed/psychlab/factories/visual_search_factory.lua b/game_scripts/levels/contributed/psychlab/factories/visual_search_factory.lua index 1be8489fc..e48d367f2 100644 --- a/game_scripts/levels/contributed/psychlab/factories/visual_search_factory.lua +++ b/game_scripts/levels/contributed/psychlab/factories/visual_search_factory.lua @@ -196,11 +196,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 }) -- 'init' gets called at the start of each episode. diff --git a/game_scripts/levels/contributed/psychlab/visuospatial_suite/factories/defaults.lua b/game_scripts/levels/contributed/psychlab/visuospatial_suite/factories/defaults.lua index c1785d543..a41fbbdc5 100644 --- a/game_scripts/levels/contributed/psychlab/visuospatial_suite/factories/defaults.lua +++ b/game_scripts/levels/contributed/psychlab/visuospatial_suite/factories/defaults.lua @@ -20,39 +20,39 @@ visuospatial task suite. ]] local defaults = { - TIME_TO_FIXATE_CROSS = 1, -- In frames. - FAST_INTER_TRIAL_INTERVAL = 1, -- In frames. - TRIAL_TIMEOUT = 300, -- In frames. - EPISODE_LENGTH_SECONDS = 300, - MAX_STEPS_OFF_SCREEN = 300, -- 5 seconds. - TRIALS_PER_EPISODE_CAP = 50, - - BG_COLOR = {0, 0, 0}, - FIXATION_COLOR = {255, 255, 255}, -- RGB white. - WHITE_BUTTON_COLOR = {255, 255, 255}, - GREEN_BUTTON_COLOR = {100, 255, 100}, - RED_BUTTON_COLOR = {255, 100, 100}, - -- We verified that all pairs of these colors are distinguishable by humans. - COLORS = { - {240, 163, 255}, -- Amethyst - {194, 0, 136}, -- Mallow - {116, 10, 255}, -- Violet - {153, 63, 0}, -- Caramel - {255, 204, 153}, -- Honeydew - {148, 255, 181}, -- Jade - {157, 204, 0}, -- Lime - {255, 164, 5}, -- Orange - {94, 241, 242}, -- Sky - {255, 255, 0}, -- Yellow - }, - - SCREEN_SIZE = {width = 512, height = 512}, - FIXATION_SIZE = 0.1, - BUTTON_SIZE = 0.1, - - FIXATION_REWARD = 0, - CORRECT_REWARD = 1, - INCORRECT_REWARD = 0, + TIME_TO_FIXATE_CROSS = 1, -- In frames. + FAST_INTER_TRIAL_INTERVAL = 1, -- In frames. + TRIAL_TIMEOUT = 300, -- In frames. + EPISODE_LENGTH_SECONDS = 300, + MAX_STEPS_OFF_SCREEN = 300, -- 5 seconds. + TRIALS_PER_EPISODE_CAP = 50, + + BG_COLOR = {0, 0, 0}, + FIXATION_COLOR = {255, 255, 255}, -- RGB white. + WHITE_BUTTON_COLOR = {255, 255, 255}, + GREEN_BUTTON_COLOR = {100, 255, 100}, + RED_BUTTON_COLOR = {255, 100, 100}, + -- We verified that all pairs of these colors are distinguishable by humans. + COLORS = { + {240, 163, 255}, -- Amethyst + {194, 0, 136}, -- Mallow + {116, 10, 255}, -- Violet + {153, 63, 0}, -- Caramel + {255, 204, 153}, -- Honeydew + {148, 255, 181}, -- Jade + {157, 204, 0}, -- Lime + {255, 164, 5}, -- Orange + {94, 241, 242}, -- Sky + {255, 255, 0}, -- Yellow + }, + + SCREEN_SIZE = {width = 512, height = 512}, + FIXATION_SIZE = 0.1, + BUTTON_SIZE = 0.1, + + FIXATION_REWARD = 0, + CORRECT_REWARD = 1, + INCORRECT_REWARD = 0, } return defaults diff --git a/game_scripts/levels/contributed/psychlab/visuospatial_suite/factories/guided_saccade_factory.lua b/game_scripts/levels/contributed/psychlab/visuospatial_suite/factories/guided_saccade_factory.lua index 19c52e526..5eadb24fc 100644 --- a/game_scripts/levels/contributed/psychlab/visuospatial_suite/factories/guided_saccade_factory.lua +++ b/game_scripts/levels/contributed/psychlab/visuospatial_suite/factories/guided_saccade_factory.lua @@ -388,8 +388,8 @@ function factory.createLevelApi(kwargs) for i = 1, NUM_LOCATIONS do local radians = 2 * math.pi * i / NUM_LOCATIONS local pos = { - 0.5 * (1 + kwargs.locationRadius * math.sin(radians)), - 0.5 * (1 + kwargs.locationRadius * math.cos(radians)) + 0.5 * (1 + kwargs.locationRadius * math.sin(radians)), + 0.5 * (1 + kwargs.locationRadius * math.cos(radians)) } locations[i] = pos local guideName = 'guide_' .. tostring(i) diff --git a/game_scripts/levels/contributed/psychlab/visuospatial_suite/factories/odd_one_out_factory.lua b/game_scripts/levels/contributed/psychlab/visuospatial_suite/factories/odd_one_out_factory.lua index 61dea2ed0..4f5a694f8 100644 --- a/game_scripts/levels/contributed/psychlab/visuospatial_suite/factories/odd_one_out_factory.lua +++ b/game_scripts/levels/contributed/psychlab/visuospatial_suite/factories/odd_one_out_factory.lua @@ -115,11 +115,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 }) -- 'init' gets called at the start of each episode. @@ -200,9 +200,9 @@ function factory.createLevelApi(kwargs) self.currentTrial.reward = 0 self:addArray() self.pac:addTimer{ - name = 'trial_timeout', - timeout = defaults.TRIAL_TIMEOUT, - callback = function(...) return self:trialTimeoutCallback() end + name = 'trial_timeout', + timeout = defaults.TRIAL_TIMEOUT, + callback = function(...) return self:trialTimeoutCallback() end } self.currentTrial.trialId = self.trialId @@ -369,12 +369,12 @@ function factory.createLevelApi(kwargs) callback = nil end self.pac:addWidget{ - name = 'image_' .. i .. '_' .. j, - pos = pos, - size = size, - image = image, - imageLayer = BACK_LAYER, - mouseHoverCallback = callback, + name = 'image_' .. i .. '_' .. j, + pos = pos, + size = size, + image = image, + imageLayer = BACK_LAYER, + mouseHoverCallback = callback, } end end @@ -430,19 +430,19 @@ function factory.createLevelApi(kwargs) end if leftSide then self.pac:addWidget{ - name = 'respond_left', - pos = {0.0, 0.0}, - size = {0.4, 1.0}, - imageLayer = FRONT_LAYER, - mouseHoverCallback = callback, + name = 'respond_left', + pos = {0.0, 0.0}, + size = {0.4, 1.0}, + imageLayer = FRONT_LAYER, + mouseHoverCallback = callback, } else self.pac:addWidget{ - name = 'respond_right', - pos = {0.6, 0.0}, - size = {0.4, 1.0}, - imageLayer = FRONT_LAYER, - mouseHoverCallback = callback, + name = 'respond_right', + pos = {0.6, 0.0}, + size = {0.4, 1.0}, + imageLayer = FRONT_LAYER, + mouseHoverCallback = callback, } end end @@ -475,22 +475,22 @@ function factory.createLevelApi(kwargs) size = {0.05, 1.0} end self.pac:addWidget{ - name = 'respond_left', - pos = leftPos, - size = size, - image = self.images.whiteButton, - imageLayer = FRONT_LAYER, - mouseHoverCallback = leftResponseCallback, - mouseHoverEndCallback = hoverEndLeft, + name = 'respond_left', + pos = leftPos, + size = size, + image = self.images.whiteButton, + imageLayer = FRONT_LAYER, + mouseHoverCallback = leftResponseCallback, + mouseHoverEndCallback = hoverEndLeft, } self.pac:addWidget{ - name = 'respond_right', - pos = rightPos, - size = size, - image = self.images.whiteButton, - imageLayer = FRONT_LAYER, - mouseHoverCallback = rightResponseCallback, - mouseHoverEndCallback = hoverEndRight, + name = 'respond_right', + pos = rightPos, + size = size, + image = self.images.whiteButton, + imageLayer = FRONT_LAYER, + mouseHoverCallback = rightResponseCallback, + mouseHoverEndCallback = hoverEndRight, } end diff --git a/game_scripts/levels/contributed/psychlab/visuospatial_suite/factories/pathfinder_factory.lua b/game_scripts/levels/contributed/psychlab/visuospatial_suite/factories/pathfinder_factory.lua index 9e4bc26f5..be0201c7a 100644 --- a/game_scripts/levels/contributed/psychlab/visuospatial_suite/factories/pathfinder_factory.lua +++ b/game_scripts/levels/contributed/psychlab/visuospatial_suite/factories/pathfinder_factory.lua @@ -80,11 +80,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 }) -- 'init' gets called at the start of each episode. diff --git a/game_scripts/levels/contributed/psychlab/visuospatial_suite/factories/visual_match_factory.lua b/game_scripts/levels/contributed/psychlab/visuospatial_suite/factories/visual_match_factory.lua index 40609f67b..556afe17d 100644 --- a/game_scripts/levels/contributed/psychlab/visuospatial_suite/factories/visual_match_factory.lua +++ b/game_scripts/levels/contributed/psychlab/visuospatial_suite/factories/visual_match_factory.lua @@ -61,11 +61,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 }) -- 'init' gets called at the start of each episode. @@ -136,9 +136,9 @@ function factory.createLevelApi(kwargs) self.trialId = self.trialId + 1 self:addArray() self.pac:addTimer{ - name = 'trial_timeout', - timeout = defaults.TRIAL_TIMEOUT, - callback = function(...) return self:trialTimeoutCallback() end + name = 'trial_timeout', + timeout = defaults.TRIAL_TIMEOUT, + callback = function(...) return self:trialTimeoutCallback() end } -- Measure reaction time since the trial started. self._currentTrialStartTime = game:episodeTimeSeconds() @@ -220,10 +220,10 @@ function factory.createLevelApi(kwargs) local image = self:createImage( shape, color, objectHeight, objectWidth) self.pac:addWidget{ - name = 'image_' .. i, - pos = pos, - size = size, - image = image, + name = 'image_' .. i, + pos = pos, + size = size, + image = image, } end @@ -245,12 +245,12 @@ function factory.createLevelApi(kwargs) hoverEndCallback = self.onHoverEndIncorrect end self.pac:addWidget{ - name = 'button_' .. tostring(i), - image = buttonImage, - pos = {buttonPosX, 1 - defaults.BUTTON_SIZE}, - size = {defaults.BUTTON_SIZE, defaults.BUTTON_SIZE}, - mouseHoverCallback = responseCallback, - mouseHoverEndCallback = hoverEndCallback, + name = 'button_' .. tostring(i), + image = buttonImage, + pos = {buttonPosX, 1 - defaults.BUTTON_SIZE}, + size = {defaults.BUTTON_SIZE, defaults.BUTTON_SIZE}, + mouseHoverCallback = responseCallback, + mouseHoverEndCallback = hoverEndCallback, } end end diff --git a/game_scripts/levels/tests/custom_actions_test.lua b/game_scripts/levels/tests/custom_actions_test.lua index 966a9e12c..d1ecf08c4 100644 --- a/game_scripts/levels/tests/custom_actions_test.lua +++ b/game_scripts/levels/tests/custom_actions_test.lua @@ -30,8 +30,8 @@ end function api:customDiscreteActionSpec() return { - {name = 'SWITCH_GADGET', min = -1, max = 1}, - {name = 'SELECT_GADGET', min = 0, max = 10}, + {name = 'SWITCH_GADGET', min = -1, max = 1}, + {name = 'SELECT_GADGET', min = 0, max = 10}, } end diff --git a/game_scripts/levels/tests/debug_observation_test.lua b/game_scripts/levels/tests/debug_observation_test.lua index 8f80e7da5..522d416e2 100644 --- a/game_scripts/levels/tests/debug_observation_test.lua +++ b/game_scripts/levels/tests/debug_observation_test.lua @@ -29,8 +29,8 @@ local MAP = [[ ]] local api = factory.createLevelApi{ - episodeLengthSeconds = 60 * 5, - botCount = 1 + episodeLengthSeconds = 60 * 5, + botCount = 1 } local spawnCount = 1 diff --git a/game_scripts/levels/tests/episode_time_test.lua b/game_scripts/levels/tests/episode_time_test.lua index a68ee4a92..2e8ed1fae 100644 --- a/game_scripts/levels/tests/episode_time_test.lua +++ b/game_scripts/levels/tests/episode_time_test.lua @@ -22,7 +22,7 @@ local api = {} function api:customObservationSpec() return { - {name = 'EPISODE_TIME_SECONDS', type = 'Doubles', shape = {1}}, + {name = 'EPISODE_TIME_SECONDS', type = 'Doubles', shape = {1}}, } end diff --git a/game_scripts/levels/tests/extra_entities_with_bots_test.lua b/game_scripts/levels/tests/extra_entities_with_bots_test.lua index 1aabdf747..98fa909a2 100644 --- a/game_scripts/levels/tests/extra_entities_with_bots_test.lua +++ b/game_scripts/levels/tests/extra_entities_with_bots_test.lua @@ -52,7 +52,7 @@ end function api:addBots() local bots = { - {name = 'Cygni', skill = 5.0} + {name = 'Cygni', skill = 5.0} } return bots end diff --git a/game_scripts/levels/tests/lookat_test.lua b/game_scripts/levels/tests/lookat_test.lua index 75376c828..c50541c13 100644 --- a/game_scripts/levels/tests/lookat_test.lua +++ b/game_scripts/levels/tests/lookat_test.lua @@ -38,7 +38,7 @@ end function api:customObservationSpec() return { - {name = 'LOOK_AT', type = 'Doubles', shape = lookAt:shape()}, + {name = 'LOOK_AT', type = 'Doubles', shape = lookAt:shape()}, } end diff --git a/game_scripts/levels/tests/model_test.lua b/game_scripts/levels/tests/model_test.lua index fc0c599a2..4fbee197c 100644 --- a/game_scripts/levels/tests/model_test.lua +++ b/game_scripts/levels/tests/model_test.lua @@ -23,25 +23,25 @@ local api = {} function api:createModel(modelName) local models = { cone = model:cone{ - phiSegments = 4, - radiusSegments = 4, - heightSegments = 4, - shaderName = 'textures/model/beam' + phiSegments = 4, + radiusSegments = 4, + heightSegments = 4, + shaderName = 'textures/model/beam' }, cube = model:cube{ - segments = 4, - shaderName = 'textures/model/beam' + segments = 4, + shaderName = 'textures/model/beam' }, cylinder = model:cylinder{ - phiSegments = 4, - radiusSegments = 4, - heightSegments = 4, - shaderName = 'textures/model/beam' + phiSegments = 4, + radiusSegments = 4, + heightSegments = 4, + shaderName = 'textures/model/beam' }, sphere = model:sphere{ - phiSegments = 4, - thetaSegments = 4, - shaderName = 'textures/model/beam' + phiSegments = 4, + thetaSegments = 4, + shaderName = 'textures/model/beam' }, hierarchy = model:hierarchy{ transform = transform.rotateX(180), diff --git a/game_scripts/levels/tests/team_model_select.lua b/game_scripts/levels/tests/team_model_select.lua index b45f427a1..48bdde1bc 100644 --- a/game_scripts/levels/tests/team_model_select.lua +++ b/game_scripts/levels/tests/team_model_select.lua @@ -32,8 +32,8 @@ local MAP = [[ ]] local api = factory.createLevelApi{ - episodeLengthSeconds = 60 * 5, - botCount = 6, + episodeLengthSeconds = 60 * 5, + botCount = 6, } local spawnCount = 1 diff --git a/game_scripts/levels/tests/update_inventory_test.lua b/game_scripts/levels/tests/update_inventory_test.lua index 01ef7e070..13dbfcafb 100644 --- a/game_scripts/levels/tests/update_inventory_test.lua +++ b/game_scripts/levels/tests/update_inventory_test.lua @@ -51,8 +51,8 @@ end function api:customObservationSpec() return { - {name = 'DEBUG.AMOUNT', type = 'Doubles', shape = {1}}, - {name = 'DEBUG.GADGET', type = 'Doubles', shape = {1}}, + {name = 'DEBUG.AMOUNT', type = 'Doubles', shape = {1}}, + {name = 'DEBUG.GADGET', type = 'Doubles', shape = {1}}, } end diff --git a/game_scripts/themes/decals.lua b/game_scripts/themes/decals.lua index 826336ebe..91ecdc89e 100644 --- a/game_scripts/themes/decals.lua +++ b/game_scripts/themes/decals.lua @@ -30,6 +30,6 @@ for i = 1, NUMBER_OF_STYLES do end return { - decals = DEFAULT_WALL_DECALS, - images = DEFAULT_WALL_IMAGES, + decals = DEFAULT_WALL_DECALS, + images = DEFAULT_WALL_IMAGES, }