| 926 | } |
| 927 | |
| 928 | function 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 | |
| 958 | function simplifyPos (pos) { |
| 959 | // Go from { x: 6, y: 6 } as middle of lower left square to { x: 0, y: 0 } |