MCPcopy Create free account
hub / github.com/codecombat/codecombat / updateProgrammableConfig

Function updateProgrammableConfig

app/lib/level-generation.js:928–956  ·  view source on GitHub ↗
({ thangs, solutionCode, starterCode, apis })

Source from the content-addressed store, hash-verified

926}
927
928function updateProgrammableConfig ({ thangs, solutionCode, starterCode, apis }) {
929 const hero = _.find(thangs, (thang) => thang.id === 'Hero Placeholder')
930 const programmable = _.find(hero.components, (component) => component.original === defaultHeroComponentIDs.Programmable)
931
932 programmable.config = {
933 programmableMethods: {
934 plan: {
935 name: 'plan',
936 source: starterCode,
937 languages: {},
938 solutions: [
939 {
940 source: solutionCode,
941 language: 'javascript',
942 succeeds: true,
943 // goals: ...
944 },
945 {
946 source: starterCode,
947 language: 'javascript',
948 succeeds: false,
949 // goals: ...
950 },
951 ]
952 }
953 },
954 programmableProperties: apis,
955 }
956}
957
958function simplifyPos (pos) {
959 // Go from { x: 6, y: 6 } as middle of lower left square to { x: 0, y: 0 }

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected