From 283eeae0ff7996e9cbea51e4d3c751de70fc8275 Mon Sep 17 00:00:00 2001 From: Shu Uesugi Date: Fri, 1 Nov 2019 07:57:36 -0700 Subject: [PATCH] Improve 7, failed try --- scripts/lib/initialExpressionContainers.ts | 8 + scripts/lib/runnerConfigs.ts | 12 + src/components/Runners/Fqcg.tsx | 12 + src/components/Runners/Xmns.tsx | 12 + src/components/Runners/fakeIndex.ts | 2 + src/components/Runners/index.ts | 2 + src/contents/7.en.tsx | 491 +++++++++++++++------ src/lib/runners/fqcg.json | 89 ++++ src/lib/runners/xmns.json | 89 ++++ 9 files changed, 587 insertions(+), 130 deletions(-) create mode 100644 src/components/Runners/Fqcg.tsx create mode 100644 src/components/Runners/Xmns.tsx create mode 100644 src/lib/runners/fqcg.json create mode 100644 src/lib/runners/xmns.json diff --git a/scripts/lib/initialExpressionContainers.ts b/scripts/lib/initialExpressionContainers.ts index 44c66b251..353a0ebce 100644 --- a/scripts/lib/initialExpressionContainers.ts +++ b/scripts/lib/initialExpressionContainers.ts @@ -275,6 +275,12 @@ export const kaaf = initializeDoneExpressionContainer({ export const mxkk = initializeDoneExpressionContainer({ shorthandNumber: 5 }) export const lyet = initializeExpressionContainer(numberParams('d', 'e', 0)) + +export const vlfz = initializeExpressionContainer([ + highlighted('bentoBox'), + numberParams('d', 'e', 0) +]) + export const zdlx = initializeExpressionContainer( numberParamsHighlightNumber('d', 'e', 1) ) @@ -834,6 +840,8 @@ export const iqbf = initializeExpressionContainer({ } }) +export const dpev = initializeExpressionContainer(numberParams('b', 'c', 1)) + export const abbh = initializeExpressionContainer( numberParamsHighlightNonNumber('b', 'c', 1) ) diff --git a/scripts/lib/runnerConfigs.ts b/scripts/lib/runnerConfigs.ts index d9cf25b6c..cbe80fe9f 100644 --- a/scripts/lib/runnerConfigs.ts +++ b/scripts/lib/runnerConfigs.ts @@ -1137,6 +1137,12 @@ export const dvfg: ExpressionRunnerShorthandConfig = { showPriorities: true } +export const xmns: ExpressionRunnerShorthandConfig = { + runner: 'simple', + initialExpressionContainer: initialExpressionContainers.vlfz, + showPriorities: true +} + export const hkbs: ExpressionRunnerShorthandConfig = { runner: 'simple', initialExpressionContainer: initialExpressionContainers.lyet, @@ -1246,6 +1252,12 @@ export const fhrd: ExpressionRunnerShorthandConfig = { bottomRightBadgeOverrides: { b: '🅰️', c: '🅱️' } } +export const fqcg: ExpressionRunnerShorthandConfig = { + runner: 'simple', + initialExpressionContainer: initialExpressionContainers.dpev, + showPriorities: true +} + export const bgxi: ExpressionRunnerShorthandConfig = { runner: 'simple', initialExpressionContainer: initialExpressionContainers.abbh, diff --git a/src/components/Runners/Fqcg.tsx b/src/components/Runners/Fqcg.tsx new file mode 100644 index 000000000..34d0d8c68 --- /dev/null +++ b/src/components/Runners/Fqcg.tsx @@ -0,0 +1,12 @@ +import React from 'react' +import ExpressionRunnerPrecomputed from 'src/components/ExpressionRunnerPrecomputed' +import config from 'src/lib/runners/fqcg.json' + +const Fqcg = ({ children }: { children?: React.ReactNode }) => ( + // @ts-ignore + + {children} + +) + +export default Fqcg diff --git a/src/components/Runners/Xmns.tsx b/src/components/Runners/Xmns.tsx new file mode 100644 index 000000000..770a69429 --- /dev/null +++ b/src/components/Runners/Xmns.tsx @@ -0,0 +1,12 @@ +import React from 'react' +import ExpressionRunnerPrecomputed from 'src/components/ExpressionRunnerPrecomputed' +import config from 'src/lib/runners/xmns.json' + +const Xmns = ({ children }: { children?: React.ReactNode }) => ( + // @ts-ignore + + {children} + +) + +export default Xmns diff --git a/src/components/Runners/fakeIndex.ts b/src/components/Runners/fakeIndex.ts index fd3a0f5dc..ebe439164 100644 --- a/src/components/Runners/fakeIndex.ts +++ b/src/components/Runners/fakeIndex.ts @@ -171,6 +171,7 @@ export { default as Cawa } from 'src/components/FakeRunner' export { default as Fzpz } from 'src/components/FakeRunner' export { default as Pbop } from 'src/components/FakeRunner' export { default as Dvfg } from 'src/components/FakeRunner' +export { default as Xmns } from 'src/components/FakeRunner' export { default as Hkbs } from 'src/components/FakeRunner' export { default as Rbup } from 'src/components/FakeRunner' export { default as Ehsw } from 'src/components/FakeRunner' @@ -186,6 +187,7 @@ export { default as Hnyn } from 'src/components/FakeRunner' export { default as Bwff } from 'src/components/FakeRunner' export { default as Xwzc } from 'src/components/FakeRunner' export { default as Fhrd } from 'src/components/FakeRunner' +export { default as Fqcg } from 'src/components/FakeRunner' export { default as Bgxi } from 'src/components/FakeRunner' export { default as Plde } from 'src/components/FakeRunner' export { default as Cpim } from 'src/components/FakeRunner' diff --git a/src/components/Runners/index.ts b/src/components/Runners/index.ts index f9167290c..0091c4750 100644 --- a/src/components/Runners/index.ts +++ b/src/components/Runners/index.ts @@ -171,6 +171,7 @@ export { default as Cawa } from 'src/components/Runners/Cawa' export { default as Fzpz } from 'src/components/Runners/Fzpz' export { default as Pbop } from 'src/components/Runners/Pbop' export { default as Dvfg } from 'src/components/Runners/Dvfg' +export { default as Xmns } from 'src/components/Runners/Xmns' export { default as Hkbs } from 'src/components/Runners/Hkbs' export { default as Rbup } from 'src/components/Runners/Rbup' export { default as Ehsw } from 'src/components/Runners/Ehsw' @@ -186,6 +187,7 @@ export { default as Hnyn } from 'src/components/Runners/Hnyn' export { default as Bwff } from 'src/components/Runners/Bwff' export { default as Xwzc } from 'src/components/Runners/Xwzc' export { default as Fhrd } from 'src/components/Runners/Fhrd' +export { default as Fqcg } from 'src/components/Runners/Fqcg' export { default as Bgxi } from 'src/components/Runners/Bgxi' export { default as Plde } from 'src/components/Runners/Plde' export { default as Cpim } from 'src/components/Runners/Cpim' diff --git a/src/contents/7.en.tsx b/src/contents/7.en.tsx index fe6b8c70b..296185291 100644 --- a/src/contents/7.en.tsx +++ b/src/contents/7.en.tsx @@ -18,7 +18,6 @@ import EmojiForLetter from 'src/components/EmojiForLetter' import CardContent from 'src/components/CardContent' import H from 'src/components/H' import ExpressionRunnerSeparator from 'src/components/ExpressionRunnerSeparator' -import ExpressionRunnerCaptionOnly from 'src/components/ExpressionRunnerCaptionOnly' import EmojiSeparator from 'src/components/EmojiSeparator' import * as R from 'src/components/Runners' import EmojiWithText from 'src/components/EmojiWithText' @@ -177,7 +176,8 @@ export default () => ( ) }, { - title: <>The problem, + type: 'challengeProblem', + title: <>The Challenge Question, content: ( <> ( children: ( <>

- As promised: If you can solve this problem, - I’ll return your mathboxes. + As promised: If you can solve this + challenge question, I’ll return your mathboxes.

Minion, explain the problem!

@@ -242,12 +242,30 @@ export default () => ( type: 'dog', children: ( <> -

Now, take a look at this lunchbox.

+ Second,{' '} + + . +

+ + ) + } + ]} + /> + + +

+ We learned on the last page that{' '} - Each icon{' '} - represents a food item, but we’ll - talk about that later. + I can convert this lunchbox to{' '} + .

@@ -255,10 +273,13 @@ export default () => ( } ]} /> - - Each icon represents a - food item - + + + + + ( children: ( <>

+ Now, here’s the question:{' '} - We now combine the above two lunchboxes. + How can you turn the first lunchbox into the second + lunchbox?

-

If you combine them, it’ll look like this:

) } ]} /> - After combining the two lunchboxes + How can you turn the first lunchbox… + + Into the second lunchbox? + +

+ This is the “very difficult question” I’ve + been talking about. +

+

+ + If you solve this, I’ll return your mathboxes! + +

+ + ) + }, + { + type: 'thinking', + children: ( + <> +

Hmm… I have no idea…

+ + ) + }, + { + type: 'dog', + children: ( + <> +

No problem. Let me give you some hints!

+ + ) + } + ]} + /> ) }, { type: 'challengeProblem', - title: ( - <> - to - - ), + title: <>Hint 1: Combine with something, content: ( <> ( children: ( <>

- Now, here’s the challenge: + Here’s the first hint:

    - If you fill each{' '} - icon with - the correct food item, + If you combine the first lunchbox with a specific + kind of a lunchbox 🍱 and{' '} + it, - After running it, it becomes a lunchbox that can be - converted to . + You’ll end up with the second lunchbox.
@@ -318,17 +373,16 @@ export default () => ( } ]} /> - - If you fill each icon with -
- the correct food item, -
+ + If you combine the first lunchbox with +
a specific kind of a lunchbox 🍱… +
- - After running it, it becomes a lunchbox + + After you it,
- that can be converted to -
+ you’ll end up with the second lunchbox +
( children: ( <>

- Because the top lunchbox can be converted to{' '} - , + So the question is:{' '} + What lunchbox should we use?

- - - -

- It means that: -

-
    - By running the combined lunchbox, - - - A lunchbox that can be converted to{' '} - … - - - - - Becomes a lunchbox that can be converted to{' '} - . - - -
) } ]} /> , - , - + emojis={['❓', '🍱', '❓']} + description={<>What lunchbox should we use?} + /> + +

Hmm… I still have no idea…

+ + ) + }, + { + type: 'dog', + children: ( + <> +

No problem. Let me give you another hint!

+ + ) + } + ]} + /> + + ) + }, + { + type: 'challengeProblem', + title: ( + <> + Hint 2: A lunchbox with + ’s + + ), + content: ( + <> + +

Take a look at this lunchbox.

+

+ + Each icon{' '} + represents a food item. + +

+ + ) + } ]} - description={ - <> - A lunchbox that can be converted to -
- becomes a lunchbox -
- that can be converted to - - } /> + + Each icon represents a + food item + ( children: ( <>

- So, here’s what you need to do: + Here’s the second hint:

    - Fill each {' '} - icon in a way such that, - - - - - After you{' '} + If you combine the first lunchbox with the above + lunchbox and{' '} it, - The resulting lunchbox can be converted to{' '} - . + You’ll end up with the second lunchbox.
@@ -421,20 +485,28 @@ export default () => ( } ]} /> - + + If you combine the first lunchbox with +
+ the above lunchbox… +
+ + + After you it, +
+ you’ll end up with the second lunchbox +

- This is the “very difficult question” I’ve - been talking about. -

-

+ So the question is:{' '} - If you solve this, I’ll return your mathboxes! + Which food item goes in each{' '} + icon?

@@ -442,9 +514,178 @@ export default () => ( } ]} /> + + Which food item goes in each{' '} + icon? + ) }, + // { + // type: 'challengeProblem', + // title: ( + // <> + // to + // + // ), + // content: ( + // <> + // + //

+ // Now, here’s the challenge: + //

+ //
    + // + // + // If you fill each{' '} + // icon with + // the correct food item, + // + // + // + // + // After running it, it becomes a lunchbox that can be + // converted to . + // + // + //
+ // + // ) + // } + // ]} + // /> + // + // If you fill each icon with + //
+ // the correct food item, + //
+ // + // + // After running it, it becomes a lunchbox + //
+ // that can be converted to + //
+ // + //

+ // Because the top lunchbox can be converted to{' '} + // , + //

+ // + // + // + //

+ // It means that: + //

+ //
    + // By running the combined lunchbox, + // + // + // A lunchbox that can be converted to{' '} + // … + // + // + // + // + // Becomes a lunchbox that can be converted to{' '} + // . + // + // + //
+ // + // ) + // } + // ]} + // /> + // , + // , + // + // ]} + // description={ + // <> + // A lunchbox that can be converted to + //
+ // becomes a lunchbox + //
+ // that can be converted to + // + // } + // /> + // + //

+ // So, here’s what you need to do: + //

+ //
    + // + // + // Fill each {' '} + // icon in a way such that, + // + // + // + // + // After you{' '} + // it, + // + // + // + // + // The resulting lunchbox can be converted to{' '} + // . + // + // + //
+ // + // ) + // } + // ]} + // /> + // + // + //

+ // This is the “very difficult question” I’ve + // been talking about. + //

+ //

+ // + // If you solve this, I’ll return your mathboxes! + // + //

+ // + // ) + // } + // ]} + // /> + // + // ) + // }, { title: <>Try filling with random items, content: ( @@ -455,8 +696,7 @@ export default () => ( type: 'crying', children: ( <> -

Hmm… I don’t know if I understood the problem.

-

And I have no idea how to solve it!

+

Hmm… I still have no idea…

) }, @@ -472,10 +712,6 @@ export default () => ( random food item.

-

- By doing so, you’ll be able to understand the problem - better. -

) } @@ -520,41 +756,26 @@ export default () => ( <>

Now, we’ll {' '} - the above lunchbox, and… + the above lunchbox and{' '} + + check see if it becomes the second lunchbox. +

-
    - - - If it becomes a lunchbox that can be converted to{' '} - , it’s a{' '} - success! 🎉 - - - - - If not, then it’s a failure.{' '} - 😭 - - -
) } ]} /> + We’ll this lunchbox, and… - - If it becomes a lunchbox that can be -
- converted to ,{' '} - success. 🎉 -
- Otherwise, failure 😭 -
+ + See if it becomes this lunchbox{' '} + + ( ) }, { - title: <>Can’t convert to a mathbox, + title: <>Not what we wanted, content: ( <> ( type: 'dog', children: ( <> -

Now, we want to convert this to a mathbox…

-

- But unfortunately:{' '} - I won’t be able to convert this. -

+

What we wanted to get at the end was this lunchbox:

+ + ) + } + ]} + /> + What we wanted + +

But instead, we got this lunchbox:

) } ]} /> + We got this lunchbox instead Can’t convert this to a mathbox{' '} diff --git a/src/lib/runners/fqcg.json b/src/lib/runners/fqcg.json new file mode 100644 index 000000000..c82203651 --- /dev/null +++ b/src/lib/runners/fqcg.json @@ -0,0 +1,89 @@ +{ + "expressionContainers": [ + { + "expression": { + "arg": { + "name": "b", + "highlightType": "default", + "topLeftBadgeType": "none", + "bottomRightBadgeType": "none", + "type": "variable", + "argPriorityAgg": [], + "funcPriorityAgg": [], + "emphasizePriority": false, + "bound": false, + "maxNestedFunctionDepth": 0 + }, + "body": { + "arg": { + "name": "c", + "highlightType": "default", + "topLeftBadgeType": "none", + "bottomRightBadgeType": "none", + "type": "variable", + "argPriorityAgg": [], + "funcPriorityAgg": [], + "emphasizePriority": false, + "bound": false, + "maxNestedFunctionDepth": 0 + }, + "body": { + "arg": { + "name": "c", + "highlightType": "default", + "topLeftBadgeType": "none", + "bottomRightBadgeType": "none", + "type": "variable", + "argPriorityAgg": [ + 1 + ], + "funcPriorityAgg": [], + "emphasizePriority": false, + "bound": true, + "maxNestedFunctionDepth": 0 + }, + "func": { + "name": "b", + "highlightType": "default", + "topLeftBadgeType": "none", + "bottomRightBadgeType": "none", + "type": "variable", + "argPriorityAgg": [], + "funcPriorityAgg": [ + 1 + ], + "emphasizePriority": false, + "bound": true, + "maxNestedFunctionDepth": 0 + }, + "state": "default", + "type": "call", + "priority": 1, + "maxNestedFunctionDepth": 0 + }, + "type": "function", + "maxNestedFunctionDepth": 1 + }, + "type": "function", + "maxNestedFunctionDepth": 2 + }, + "numLeafNodes": 2, + "containerState": "ready", + "previouslyChangedExpressionState": "default" + } + ], + "speed": 1, + "hideControls": true, + "explanationsVisibility": "hidden", + "hidePriorities": false, + "hideRunButton": false, + "hideBottomRightBadges": false, + "skipToTheEnd": false, + "hideFuncUnboundBadgeOnExplanation": false, + "highlightOverridesCallArgAndFuncUnboundOnly": false, + "bottomRightBadgeOverrides": {}, + "highlightOverrides": {}, + "highlightOverrideActiveAfterStart": false, + "highlightFunctions": false, + "showBottomProgressBar": false +} diff --git a/src/lib/runners/xmns.json b/src/lib/runners/xmns.json new file mode 100644 index 000000000..698cc12f4 --- /dev/null +++ b/src/lib/runners/xmns.json @@ -0,0 +1,89 @@ +{ + "expressionContainers": [ + { + "expression": { + "arg": { + "arg": { + "name": "d", + "highlightType": "default", + "topLeftBadgeType": "none", + "bottomRightBadgeType": "none", + "type": "variable", + "argPriorityAgg": [ + 1 + ], + "funcPriorityAgg": [], + "emphasizePriority": false, + "bound": false, + "maxNestedFunctionDepth": 0 + }, + "body": { + "arg": { + "name": "e", + "highlightType": "default", + "topLeftBadgeType": "none", + "bottomRightBadgeType": "none", + "type": "variable", + "argPriorityAgg": [], + "funcPriorityAgg": [], + "emphasizePriority": false, + "bound": false, + "maxNestedFunctionDepth": 0 + }, + "body": { + "name": "e", + "highlightType": "default", + "topLeftBadgeType": "none", + "bottomRightBadgeType": "none", + "type": "variable", + "argPriorityAgg": [], + "funcPriorityAgg": [], + "emphasizePriority": false, + "bound": true, + "maxNestedFunctionDepth": 0 + }, + "type": "function", + "maxNestedFunctionDepth": 1 + }, + "type": "function", + "maxNestedFunctionDepth": 2 + }, + "func": { + "name": "bentoBox", + "highlightType": "initialHighlighted", + "topLeftBadgeType": "none", + "bottomRightBadgeType": "none", + "type": "variable", + "argPriorityAgg": [], + "funcPriorityAgg": [ + 1 + ], + "emphasizePriority": false, + "bound": true, + "maxNestedFunctionDepth": 0 + }, + "state": "default", + "type": "call", + "priority": 1, + "maxNestedFunctionDepth": 2 + }, + "numLeafNodes": 2, + "containerState": "ready", + "previouslyChangedExpressionState": "default" + } + ], + "speed": 1, + "hideControls": true, + "explanationsVisibility": "hidden", + "hidePriorities": false, + "hideRunButton": false, + "hideBottomRightBadges": false, + "skipToTheEnd": false, + "hideFuncUnboundBadgeOnExplanation": false, + "highlightOverridesCallArgAndFuncUnboundOnly": false, + "bottomRightBadgeOverrides": {}, + "highlightOverrides": {}, + "highlightOverrideActiveAfterStart": false, + "highlightFunctions": false, + "showBottomProgressBar": false +}