From 9713611fae2f5b0ebb312f5c704577142e0133b0 Mon Sep 17 00:00:00 2001 From: Shu Uesugi Date: Mon, 24 Jun 2019 15:36:36 -0700 Subject: [PATCH 01/20] Start writing episode 1 --- src/contents/1.v2.jp.tsx | 407 +-------------------------------------- 1 file changed, 6 insertions(+), 401 deletions(-) diff --git a/src/contents/1.v2.jp.tsx b/src/contents/1.v2.jp.tsx index 6b6d4fb2b..2a8a7378c 100644 --- a/src/contents/1.v2.jp.tsx +++ b/src/contents/1.v2.jp.tsx @@ -1,417 +1,22 @@ import React from 'react' -import { - Em, - Img, - P, - PFullWidth, - Hr, - Strong, - InlineHeader -} from 'src/components/ContentTags' -import Emoji from 'src/components/Emoji' -import EmojiWithText from 'src/components/EmojiWithText' -import EmojiSeparator from 'src/components/EmojiSeparator' -import YesNoButtons from 'src/components/YesNoButtons' -import NextLessonButton from 'src/components/NextLessonButton' +import { P, Strong } from 'src/components/ContentTags' import EpisodeCardList from 'src/components/EpisodeCardList' import H from 'src/components/H' -import ExpressionRunnerSeparator from 'src/components/ExpressionRunnerSeparator' -import * as R from 'src/components/Runners' +import EmojiSeparator from 'src/components/EmojiSeparator' export default () => ( , + title: <>この話はフィクションです, content: ( <>

- 当記事では、とあるパズル - を使って - - とは何かを学んでいきます。 今回は、 - このパズルの基本法則 - を紹介します。 -

-

- まずはじめにこちらの写真をご覧ください。筆者の地元・横浜の崎陽軒で販売されているお弁当です(撮影は筆者)。 -

- - Bento Boxes - -

- なぜお弁当の写真をお見せしたかというと、今回紹介するパズルには - - という名前がついているからです。 -

- -

- - がどんなものか、説明しますね! -

- - ) - }, - { - title: ( - <> - これが - - - ), - content: ( - <> -

- 下の図が、 - - です。実際の弁当箱のように、 - - 四角の中にいくつかマスがあり、それぞれのマスの中に料理が入っています - - 。 -

-

- 例その1: 上段には - - 、下段には - - がふたつ入っています。 -

- -

- 「寿司とサンドイッチが同時に入っている弁当箱なんてあるの?」というツッコミは無しの方向でお願いします。 -

- - - ) - }, - { - title: ( - <> - まだあるよ - - - ), - content: ( - <> -

- さらにいくつか、 - - の例を紹介していきます: -

-

- 例その2: 上段には - - 、下段には - と - - が入っています。 -

- -

マクドナルドのメニューにありそうな料理ばかりですね!

-
-

- 例その3: 上段には - - 、下段には - - がふたつ入っています。 -

- -

こちらは、イタリアンな弁当箱ですね!

-
-

- 例その4: 上段には - - 、下段には - と - - が入っています。 -

- -

こちらは普通に美味しそうですね。

- - ) - }, - { - title: ( - <> - - - ), - content: ( - <> -

- それぞれの - - には、 - - があります。 -

-

- 例その1: こちらは、最初に紹介した - - です。 - -

- - - ), - footer: { - content: ( - <> -

- {' '} - を押せばもう一度最初から実行できます。 -

- - ) - } - }, - { - title: ( - <> - - するとこうなります - - ), - content: ( - <> -

- どうやら、さきほどの - - は、 - - すると、最終的に - - だけになるようです。 -

-

- 例その1: -

- - - -

- 実はこれ、 - - に従っているんです。 -

-

- その法則を説明する前に、他の - - も実行してみましょう。 -

- - ) - }, - { - title: ( - <> - 他のも - - してみましょう - - ), - content: ( - <> -

- 先ほど紹介した3つの - - を、それぞれ - - してみましょう! -

-

- 例その2: -

- -

- 例その3: -

- -

- 例その4: -

- - - ), - footer: { - content: ( -

- どれも - - に従っています。どんな法則か、考えみてください! -

- ) - } - }, - { - title: ( - <> - - - ), - content: ( - <> -

それぞれ、このような結果になりました!

-

- 例その2: -

- - - -

- 例その3: -

- - - -

- 例その4: -

- - - - - ), - footer: { - content: ( -

- どれも - - に従っています。どんな法則か、考えみてください! -

- ) - } - }, - { - title: <>法則がわかりましたか?, - content: ( - <> - -

- 上記あわせて4種類の - を - - しましたが、どれも - - に従っています。 -

-

- その法則がわかりましたか? - もう一度4つの例を見て、考えてみてください! -

-

- なんとなく予想がついたら、合っているかどうか次の - - でチェックしてみましょう! -

-

- さっぱり分からなくてもご心配なく! - とりあえず勘で答えてみてください。😉 -

- - ) - }, - { - type: 'yesNoQuiz', - title: ( - <> - - 、その1 - - ), - content: ( - <> -

- {' '} - こちらに、ヘルシーな野菜が入っている - - があります。 -

- -

- これを - - すると、最終的に下のようになるでしょうか? - これまでの法則から予想してみてください。 -

- - - - ) - }, - { - type: 'yesNoQuiz', - title: ( - <> - - 、その2 - - ), - content: ( - <> -

- こちらの - を - - すると、 -

- -

- 最終的に下のようになるでしょうか? - これまでの法則から予想してみてください。 -

- - - - ) - }, - { - title: <>答え合わせ, - content: ( - <> -

それぞれ実行すると、次のようになります。

-

- 例その5: -

- -

- つまり - - 1問目の - - - でした。 -

-

- 例その6: -

- -

- つまり - - 2問目の - - {' '} - ( - ではない) でした。 -

- - ) - }, - { - title: <>法則は次のページに, - content: ( - <> -

- 次のページで - - の法則を紹介します。予想が当たった方も、よく分からなかった方も、ぜひ次に進んでみてください。 + 当記事は物語調で話を進めていきます。ちなみに、この話はフィクションです。まずは、物語の主役となる「 + 計算箱」の話をしましょう。

- + ) } From ebb600fa783656292d137344f6056b6c457faf23 Mon Sep 17 00:00:00 2001 From: Shu Uesugi Date: Mon, 24 Jun 2019 20:17:28 -0700 Subject: [PATCH 02/20] Continue with 1 --- scripts/lib/lessonExpressions.ts | 10 +++ scripts/lib/runnerConfigs/fdek.ts | 9 +++ src/components/H.tsx | 11 ++++ src/components/Runners/Fdek.tsx | 8 +++ src/components/Runners/index.ts | 1 + src/components/VariableExpressionBox.tsx | 12 +++- src/contents/1.v2.jp.tsx | 44 ++++++++++++- src/lib/runners/fdek.json | 81 ++++++++++++++++++++++++ src/types/ExpressionTypes.ts | 2 +- src/types/HTypes.ts | 1 + 10 files changed, 175 insertions(+), 4 deletions(-) create mode 100644 scripts/lib/runnerConfigs/fdek.ts create mode 100644 src/components/Runners/Fdek.tsx create mode 100644 src/lib/runners/fdek.json diff --git a/scripts/lib/lessonExpressions.ts b/scripts/lib/lessonExpressions.ts index ce56cc4ad..bfaaafa09 100644 --- a/scripts/lib/lessonExpressions.ts +++ b/scripts/lib/lessonExpressions.ts @@ -961,3 +961,13 @@ export const e16E1 = initializeExpressionContainer([ }, 'B' ]) + +export const v2e1E1 = initializeExpressionContainer([ + 'question', + [ + { + shorthandBinary: 'add' + }, + 'question' + ] +]) diff --git a/scripts/lib/runnerConfigs/fdek.ts b/scripts/lib/runnerConfigs/fdek.ts new file mode 100644 index 000000000..2efce4d45 --- /dev/null +++ b/scripts/lib/runnerConfigs/fdek.ts @@ -0,0 +1,9 @@ +import { ExpressionRunnerShorthandConfig } from '../expressionRunnerShorthandConfig' + +const config: ExpressionRunnerShorthandConfig = { + runner: 'simple', + lessonExpressionsKey: 'v2e1E1', + caption: { name: 'addMathBox' } +} + +export default config diff --git a/src/components/H.tsx b/src/components/H.tsx index 199a5a46b..2012168f8 100644 --- a/src/components/H.tsx +++ b/src/components/H.tsx @@ -1727,6 +1727,17 @@ const H = ({ args, highlightType, episodeNumberOverrides }: HProps) => { ) } } + if (args.name === 'addMathBox') { + if (locale === 'en') { + return <>? + } else { + return ( + <> + 足し算ができる計算箱 🎁 + + ) + } + } throw new Error() } diff --git a/src/components/Runners/Fdek.tsx b/src/components/Runners/Fdek.tsx new file mode 100644 index 000000000..3b9f31dbd --- /dev/null +++ b/src/components/Runners/Fdek.tsx @@ -0,0 +1,8 @@ +import React from 'react' +import ExpressionRunnerPrecomputed from 'src/components/ExpressionRunnerPrecomputed' +import config from 'src/lib/runners/fdek.json' + +// @ts-ignore +const Fdek = () => + +export default Fdek diff --git a/src/components/Runners/index.ts b/src/components/Runners/index.ts index d13070708..e000e475c 100644 --- a/src/components/Runners/index.ts +++ b/src/components/Runners/index.ts @@ -66,6 +66,7 @@ export { default as Evqx } from 'src/components/Runners/Evqx' export { default as Exww } from 'src/components/Runners/Exww' export { default as Fapu } from 'src/components/Runners/Fapu' export { default as Fatm } from 'src/components/Runners/Fatm' +export { default as Fdek } from 'src/components/Runners/Fdek' export { default as Fhlw } from 'src/components/Runners/Fhlw' export { default as Fiab } from 'src/components/Runners/Fiab' export { default as Fivy } from 'src/components/Runners/Fivy' diff --git a/src/components/VariableExpressionBox.tsx b/src/components/VariableExpressionBox.tsx index 18a22b007..586783b23 100644 --- a/src/components/VariableExpressionBox.tsx +++ b/src/components/VariableExpressionBox.tsx @@ -75,6 +75,16 @@ const SecretCodeLabel = ({ number }: { number?: number }) => ( ) +const shorthandBinary = ( + shorthandBinary: NonNullable +) => { + if (shorthandBinary === 'mult') { + return '✖️' + } else { + return '➕' + } +} + const VariableEmoji = ({ expression }: VariableExpressionBoxProps) => { const { hideBottomRightBadges, bottomRightBadgeOverrides } = useContext( ExpressionRunnerContext @@ -142,7 +152,7 @@ const VariableEmoji = ({ expression }: VariableExpressionBoxProps) => { {expression.highlightType === 'removed' ? '💥' : expression.shorthandBinary !== undefined - ? '✖️' + ? shorthandBinary(expression.shorthandBinary) : letterEmojiMapping[expression.name]} )} diff --git a/src/contents/1.v2.jp.tsx b/src/contents/1.v2.jp.tsx index 2a8a7378c..25ea51d82 100644 --- a/src/contents/1.v2.jp.tsx +++ b/src/contents/1.v2.jp.tsx @@ -1,8 +1,12 @@ import React from 'react' -import { P, Strong } from 'src/components/ContentTags' +import { P, Strong, Em, InlineHeader } from 'src/components/ContentTags' import EpisodeCardList from 'src/components/EpisodeCardList' import H from 'src/components/H' import EmojiSeparator from 'src/components/EmojiSeparator' +import Emoji from 'src/components/Emoji' +import EmojiNumber from 'src/components/EmojiNumber' +import * as R from 'src/components/Runners' +import { InlineEmojiBoxesForQuestion } from 'src/components/InlineEmojiBoxes' export default () => ( ( <>

- 当記事は物語調で話を進めていきます。ちなみに、この話はフィクションです。まずは、物語の主役となる「 + 当記事は物語調で話を進めていきます。ちなみに、この話はフィクションです。 + 😉 +

+

+ まずは、物語の主役となる「 計算箱」の話をしましょう。

) + }, + { + title: <>計算箱, + content: ( + <> +

+ むかしむかしあるところに、「計算箱 + 」と呼ばれる便利な道具がありました。 + 計算箱は + さまざまな計算を自動で行ってくれる道具 + です。人々は 難しい計算を行うとき、いつもこの + 計算箱に頼っていました。 +

+ +

+ 計算箱にはさまざまな種類があります。まずこちらが、「 + 足し算ができる計算箱」です: +

+ +

+ 一番上と下にハテナマーク + + があり、真ん中に足し算の記号 がありますね。 +

+

+ この + + の部分には、それぞれ数字を入れることができます。たとえば{' '} + を両方に入れてみましょう。 +

+ + ) } ]} /> diff --git a/src/lib/runners/fdek.json b/src/lib/runners/fdek.json new file mode 100644 index 000000000..5c67bc5b4 --- /dev/null +++ b/src/lib/runners/fdek.json @@ -0,0 +1,81 @@ +{ + "expressionContainers": [ + { + "containerState": "ready", + "previouslyChangedExpressionState": "default", + "expression": { + "arg": { + "arg": { + "name": "question", + "highlightType": "default", + "topLeftBadgeType": "none", + "bottomRightBadgeType": "none", + "type": "variable", + "argPriorityAgg": [ + 1, + 2 + ], + "funcPriorityAgg": [], + "emphasizePriority": false, + "bound": true + }, + "func": { + "name": "shorthandBinary", + "highlightType": "default", + "topLeftBadgeType": "none", + "bottomRightBadgeType": "none", + "type": "variable", + "argPriorityAgg": [], + "funcPriorityAgg": [ + 2 + ], + "emphasizePriority": false, + "bound": true, + "shorthandBinary": "add" + }, + "state": "default", + "type": "call", + "priority": 2 + }, + "func": { + "name": "question", + "highlightType": "default", + "topLeftBadgeType": "none", + "bottomRightBadgeType": "none", + "type": "variable", + "argPriorityAgg": [], + "funcPriorityAgg": [ + 1 + ], + "emphasizePriority": false, + "bound": true + }, + "state": "default", + "type": "call", + "priority": 1 + } + } + ], + "speed": 1, + "showOnlyFocused": false, + "caption": { + "name": "addMathBox" + }, + "hideControls": true, + "explanationsVisibility": "hidden", + "hidePriorities": true, + "variableSize": "lg", + "containerSize": "xxs", + "hidePlayButton": false, + "hideBottomRightBadges": false, + "skipToTheEnd": false, + "hideFuncUnboundBadgeOnExplanation": false, + "highlightOverridesCallArgAndFuncUnboundOnly": false, + "bottomRightBadgeOverrides": {}, + "highlightOverrides": {}, + "highlightOverrideActiveAfterStart": false, + "argPriorityAggHighlights": [], + "funcPriorityAggHighlights": [], + "highlightFunctions": false, + "superFastForward": false +} diff --git a/src/types/ExpressionTypes.ts b/src/types/ExpressionTypes.ts index 6d65a7a2e..d4cf96592 100644 --- a/src/types/ExpressionTypes.ts +++ b/src/types/ExpressionTypes.ts @@ -10,7 +10,7 @@ export interface VariableExpression { readonly emphasizePriority: boolean readonly argPriorityAgg: number[] readonly funcPriorityAgg: number[] - readonly shorthandBinary?: 'mult' + readonly shorthandBinary?: 'mult' | 'add' readonly shorthandNumber?: number readonly shorthandUnary?: 'pred' readonly magical?: boolean diff --git a/src/types/HTypes.ts b/src/types/HTypes.ts index 0ed2f6fb3..af2bb1c62 100644 --- a/src/types/HTypes.ts +++ b/src/types/HTypes.ts @@ -124,4 +124,5 @@ export interface HProps { | { name: 'csDescription' } | { name: 'numberOfAIsSecretCodeCaption' } | { name: 'mentionRightArrow' } + | { name: 'addMathBox' } } From c488b31f58cdce7066968741467bd5d905c5978d Mon Sep 17 00:00:00 2001 From: Shu Uesugi Date: Mon, 24 Jun 2019 20:37:27 -0700 Subject: [PATCH 03/20] Continue with 1 --- scripts/lib/lessonExpressions.ts | 14 ++++++ scripts/lib/runnerConfigs/jfsd.ts | 8 ++++ src/components/Runners/Jfsd.tsx | 8 ++++ src/components/Runners/index.ts | 1 + src/contents/1.v2.jp.tsx | 12 +++++ src/lib/runners/jfsd.json | 80 +++++++++++++++++++++++++++++++ 6 files changed, 123 insertions(+) create mode 100644 scripts/lib/runnerConfigs/jfsd.ts create mode 100644 src/components/Runners/Jfsd.tsx create mode 100644 src/lib/runners/jfsd.json diff --git a/scripts/lib/lessonExpressions.ts b/scripts/lib/lessonExpressions.ts index bfaaafa09..451402775 100644 --- a/scripts/lib/lessonExpressions.ts +++ b/scripts/lib/lessonExpressions.ts @@ -971,3 +971,17 @@ export const v2e1E1 = initializeExpressionContainer([ 'question' ] ]) + +export const v2e1E2 = initializeExpressionContainer([ + { + shorthandNumber: 1 + }, + [ + { + shorthandBinary: 'add' + }, + { + shorthandNumber: 1 + } + ] +]) diff --git a/scripts/lib/runnerConfigs/jfsd.ts b/scripts/lib/runnerConfigs/jfsd.ts new file mode 100644 index 000000000..ec86a0060 --- /dev/null +++ b/scripts/lib/runnerConfigs/jfsd.ts @@ -0,0 +1,8 @@ +import { ExpressionRunnerShorthandConfig } from '../expressionRunnerShorthandConfig' + +const config: ExpressionRunnerShorthandConfig = { + runner: 'simple', + lessonExpressionsKey: 'v2e1E2' +} + +export default config diff --git a/src/components/Runners/Jfsd.tsx b/src/components/Runners/Jfsd.tsx new file mode 100644 index 000000000..f2cca9886 --- /dev/null +++ b/src/components/Runners/Jfsd.tsx @@ -0,0 +1,8 @@ +import React from 'react' +import ExpressionRunnerPrecomputed from 'src/components/ExpressionRunnerPrecomputed' +import config from 'src/lib/runners/jfsd.json' + +// @ts-ignore +const Jfsd = () => + +export default Jfsd diff --git a/src/components/Runners/index.ts b/src/components/Runners/index.ts index e000e475c..776349319 100644 --- a/src/components/Runners/index.ts +++ b/src/components/Runners/index.ts @@ -118,6 +118,7 @@ export { default as Iwkx } from 'src/components/Runners/Iwkx' export { default as Iygh } from 'src/components/Runners/Iygh' export { default as Izgz } from 'src/components/Runners/Izgz' export { default as Jbam } from 'src/components/Runners/Jbam' +export { default as Jfsd } from 'src/components/Runners/Jfsd' export { default as Jlet } from 'src/components/Runners/Jlet' export { default as Jliw } from 'src/components/Runners/Jliw' export { default as Jmmp } from 'src/components/Runners/Jmmp' diff --git a/src/contents/1.v2.jp.tsx b/src/contents/1.v2.jp.tsx index 25ea51d82..1e84f8a49 100644 --- a/src/contents/1.v2.jp.tsx +++ b/src/contents/1.v2.jp.tsx @@ -57,6 +57,18 @@ export default () => ( の部分には、それぞれ数字を入れることができます。たとえば{' '} を両方に入れてみましょう。

+ +

+ そして、それぞれの計算箱には + + + ボタン + + がついており、それを押すと計算が実行されます。試しに、下の計算箱で + + + +

) } diff --git a/src/lib/runners/jfsd.json b/src/lib/runners/jfsd.json new file mode 100644 index 000000000..8f3b40b0b --- /dev/null +++ b/src/lib/runners/jfsd.json @@ -0,0 +1,80 @@ +{ + "expressionContainers": [ + { + "containerState": "ready", + "previouslyChangedExpressionState": "default", + "expression": { + "arg": { + "arg": { + "name": "shorthandNumber", + "highlightType": "default", + "topLeftBadgeType": "none", + "bottomRightBadgeType": "none", + "type": "variable", + "argPriorityAgg": [ + 1, + 2 + ], + "funcPriorityAgg": [], + "emphasizePriority": false, + "bound": true, + "shorthandNumber": 1 + }, + "func": { + "name": "shorthandBinary", + "highlightType": "default", + "topLeftBadgeType": "none", + "bottomRightBadgeType": "none", + "type": "variable", + "argPriorityAgg": [], + "funcPriorityAgg": [ + 2 + ], + "emphasizePriority": false, + "bound": true, + "shorthandBinary": "add" + }, + "state": "default", + "type": "call", + "priority": 2 + }, + "func": { + "name": "shorthandNumber", + "highlightType": "default", + "topLeftBadgeType": "none", + "bottomRightBadgeType": "none", + "type": "variable", + "argPriorityAgg": [], + "funcPriorityAgg": [ + 1 + ], + "emphasizePriority": false, + "bound": true, + "shorthandNumber": 1 + }, + "state": "default", + "type": "call", + "priority": 1 + } + } + ], + "speed": 1, + "showOnlyFocused": false, + "hideControls": true, + "explanationsVisibility": "hidden", + "hidePriorities": true, + "variableSize": "lg", + "containerSize": "xxs", + "hidePlayButton": false, + "hideBottomRightBadges": false, + "skipToTheEnd": false, + "hideFuncUnboundBadgeOnExplanation": false, + "highlightOverridesCallArgAndFuncUnboundOnly": false, + "bottomRightBadgeOverrides": {}, + "highlightOverrides": {}, + "highlightOverrideActiveAfterStart": false, + "argPriorityAggHighlights": [], + "funcPriorityAggHighlights": [], + "highlightFunctions": false, + "superFastForward": false +} From 5675f193505a01345bc7c3dc254d384fdd141f9a Mon Sep 17 00:00:00 2001 From: Shu Uesugi Date: Tue, 25 Jun 2019 15:17:00 -0700 Subject: [PATCH 04/20] FInish slide 2, episode 1 --- now.json | 3 + scripts/lib/buildExpressionContainers.ts | 132 ++++++++++-------- ...uildExpressionRunnerConfigFromShorthand.ts | 37 ++++- .../lib/expressionRunnerShorthandConfig.ts | 29 ++++ scripts/lib/lessonExpressions.ts | 8 ++ scripts/lib/runnerConfigs/nlfx.ts | 8 ++ src/components/Runners/Nlfx.tsx | 8 ++ src/components/Runners/index.ts | 1 + src/contents/1.v2.jp.tsx | 8 +- src/lib/date.tsx | 4 +- src/lib/runners/nlfx.json | 96 +++++++++++++ 11 files changed, 266 insertions(+), 68 deletions(-) create mode 100644 scripts/lib/runnerConfigs/nlfx.ts create mode 100644 src/components/Runners/Nlfx.tsx create mode 100644 src/lib/runners/nlfx.json diff --git a/now.json b/now.json index 1e2507100..a32ff4eee 100644 --- a/now.json +++ b/now.json @@ -4,5 +4,8 @@ "alias": "y.chibicode.com", "github": { "silent": true + }, + "engines": { + "node": "10.x" } } diff --git a/scripts/lib/buildExpressionContainers.ts b/scripts/lib/buildExpressionContainers.ts index ca1675a2f..feaf629ef 100644 --- a/scripts/lib/buildExpressionContainers.ts +++ b/scripts/lib/buildExpressionContainers.ts @@ -9,6 +9,7 @@ import * as lessonExpressions from 'scripts/lib/lessonExpressions' const buildExpressionContainers = ({ lessonExpressionsKey, + predefinedExpressionsKeys, initializeInstructions, showAllShowSteps, skipAlphaConvert, @@ -18,35 +19,20 @@ const buildExpressionContainers = ({ lastAllowedExpressionStateAfterIterations, hidePlayButton }: ExpressionRunnerConfig): readonly ExpressionContainer[] => { - let currentExpressionContainer: SteppedExpressionContainer = - lessonExpressions[lessonExpressionsKey] - let results: ExpressionContainer[] = [] - const stepOptions = { showAllShowSteps, skipAlphaConvert } + if (lessonExpressionsKey) { + let currentExpressionContainer: SteppedExpressionContainer = + lessonExpressions[lessonExpressionsKey] + let results: ExpressionContainer[] = [] + const stepOptions = { showAllShowSteps, skipAlphaConvert } - initializeInstructions.forEach(initializeInstruction => { - if ( - initializeInstruction.type === - 'stepForwardUntilPreviouslyChangedExpressionState' - ) { - while ( - currentExpressionContainer.previouslyChangedExpressionState !== - initializeInstruction.state && - !isContainerWithState(currentExpressionContainer, 'done') + initializeInstructions.forEach(initializeInstruction => { + if ( + initializeInstruction.type === + 'stepForwardUntilPreviouslyChangedExpressionState' ) { - currentExpressionContainer = stepExpressionContainer( - currentExpressionContainer, - stepOptions - ) - } - } else if (initializeInstruction.type === 'nextIteration') { - if (!isContainerWithState(currentExpressionContainer, 'done')) { - currentExpressionContainer = stepExpressionContainer( - currentExpressionContainer, - stepOptions - ) while ( currentExpressionContainer.previouslyChangedExpressionState !== - 'default' && + initializeInstruction.state && !isContainerWithState(currentExpressionContainer, 'done') ) { currentExpressionContainer = stepExpressionContainer( @@ -54,63 +40,85 @@ const buildExpressionContainers = ({ stepOptions ) } + } else if (initializeInstruction.type === 'nextIteration') { + if (!isContainerWithState(currentExpressionContainer, 'done')) { + currentExpressionContainer = stepExpressionContainer( + currentExpressionContainer, + stepOptions + ) + while ( + currentExpressionContainer.previouslyChangedExpressionState !== + 'default' && + !isContainerWithState(currentExpressionContainer, 'done') + ) { + currentExpressionContainer = stepExpressionContainer( + currentExpressionContainer, + stepOptions + ) + } + } + } else { + while (!isContainerWithState(currentExpressionContainer, 'done')) { + currentExpressionContainer = stepExpressionContainer( + currentExpressionContainer, + stepOptions + ) + } } - } else { + }) + + results.push(currentExpressionContainer) + + if (hideControls) { + return results + } + + if (skipToTheEnd) { while (!isContainerWithState(currentExpressionContainer, 'done')) { currentExpressionContainer = stepExpressionContainer( currentExpressionContainer, stepOptions ) } + results.push(currentExpressionContainer) + return results } - }) - results.push(currentExpressionContainer) - - if (hideControls) { - return results - } - - if (skipToTheEnd) { + let becameDefaultCount = 0 while (!isContainerWithState(currentExpressionContainer, 'done')) { currentExpressionContainer = stepExpressionContainer( currentExpressionContainer, stepOptions ) - } - results.push(currentExpressionContainer) - return results - } + results.push(currentExpressionContainer) - let becameDefaultCount = 0 - while (!isContainerWithState(currentExpressionContainer, 'done')) { - currentExpressionContainer = stepExpressionContainer( - currentExpressionContainer, - stepOptions - ) - results.push(currentExpressionContainer) + if (hidePlayButton) { + break + } - if (hidePlayButton) { - break - } + if ( + lastAllowedExpressionState && + lastAllowedExpressionState === + currentExpressionContainer.previouslyChangedExpressionState && + (lastAllowedExpressionStateAfterIterations || 0) <= becameDefaultCount + ) { + break + } - if ( - lastAllowedExpressionState && - lastAllowedExpressionState === - currentExpressionContainer.previouslyChangedExpressionState && - (lastAllowedExpressionStateAfterIterations || 0) <= becameDefaultCount - ) { - break + if ( + currentExpressionContainer.previouslyChangedExpressionState === + 'default' + ) { + becameDefaultCount += 1 + } } - if ( - currentExpressionContainer.previouslyChangedExpressionState === 'default' - ) { - becameDefaultCount += 1 - } + return results + } else if (predefinedExpressionsKeys) { + return predefinedExpressionsKeys.map(key => lessonExpressions[key]) + } else { + throw new Error() } - - return results } export default buildExpressionContainers diff --git a/scripts/lib/buildExpressionRunnerConfigFromShorthand.ts b/scripts/lib/buildExpressionRunnerConfigFromShorthand.ts index 44f505a02..805a18246 100644 --- a/scripts/lib/buildExpressionRunnerConfigFromShorthand.ts +++ b/scripts/lib/buildExpressionRunnerConfigFromShorthand.ts @@ -3,8 +3,10 @@ import { expressionRunnerSimpleConfigDefault, expressionRunnerPlayButtonOnlyConfigDefault, expressionRunnerSingleStepConfigDefault, + expressionRunnerPredefinedConfigDefault, isExpressionRunnerSimpleConfig, - isExpressionRunnerPlayButtonOnlyConfig + isExpressionRunnerPlayButtonOnlyConfig, + isExpressionRunnerSingleStepConfig } from 'scripts/lib/expressionRunnerShorthandConfig' import { ExpressionContainer } from 'src/types/ExpressionContainerTypes' import { allMaxWidths } from 'src/lib/theme/maxWidths' @@ -17,7 +19,8 @@ import { HProps } from 'src/types/HTypes' import * as lessonExpressions from 'scripts/lib/lessonExpressions' export interface ExpressionRunnerConfig { - lessonExpressionsKey: keyof typeof lessonExpressions + lessonExpressionsKey?: keyof typeof lessonExpressions + predefinedExpressionsKeys?: readonly (keyof typeof lessonExpressions)[] hidePriorities: ExpressionRunnerContextProps['hidePriorities'] hideBottomRightBadges: ExpressionRunnerContextProps['hideBottomRightBadges'] hideControls: boolean @@ -233,7 +236,7 @@ const buildExpressionRunnerConfigFromShorthand = ( }), superFastForward } - } else { + } else if (isExpressionRunnerSingleStepConfig(config)) { const { lessonExpressionsKey, initialState, @@ -268,6 +271,34 @@ const buildExpressionRunnerConfigFromShorthand = ( initialState }) } + } else { + const { + predefinedExpressionsKeys, + hideFuncUnboundBadgeOnExplanation, + showPriorities, + explanationsVisibility, + showAllShowSteps, + variableSize, + containerSize, + nextIterations, + skipToTheEnd + } = mergeWithDefault< + typeof config, + typeof expressionRunnerPredefinedConfigDefault + >(config, expressionRunnerPredefinedConfigDefault) + + runnerProps = { + predefinedExpressionsKeys, + variableSize, + containerSize, + hidePriorities: !showPriorities, + hideFuncUnboundBadgeOnExplanation, + hidePlayButton: false, + explanationsVisibility, + lastAllowedExpressionStateAfterIterations: nextIterations, + showAllShowSteps, + skipToTheEnd + } } return mergeWithDefault( diff --git a/scripts/lib/expressionRunnerShorthandConfig.ts b/scripts/lib/expressionRunnerShorthandConfig.ts index 39eb1a291..d1d3f97af 100644 --- a/scripts/lib/expressionRunnerShorthandConfig.ts +++ b/scripts/lib/expressionRunnerShorthandConfig.ts @@ -109,7 +109,36 @@ interface ExpressionRunnerSingleStepConfig { showAllShowSteps?: ExpressionRunnerProps['showAllShowSteps'] } +export function isExpressionRunnerPredefinedConfig( + c: ExpressionRunnerShorthandConfig +): c is ExpressionRunnerPredefinedConfig { + return c.runner === 'predefined' +} + +export const expressionRunnerPredefinedConfigDefault = { + hideFuncUnboundBadgeOnExplanation: false, + showPriorities: false, + explanationsVisibility: 'hiddenInitialPausedOnly', + variableSize: 'lg', + skipToTheEnd: true +} + +interface ExpressionRunnerPredefinedConfig { + runner: 'predefined' + predefinedExpressionsKeys: readonly (keyof typeof lessonExpressions)[] + hideFuncUnboundBadgeOnExplanation?: boolean + showPriorities?: boolean + nextIteration?: boolean + nextIterations?: number + variableSize?: ExpressionRunnerProps['variableSize'] + containerSize?: ExpressionRunnerProps['containerSize'] + explanationsVisibility?: ExpressionRunnerProps['explanationsVisibility'] + showAllShowSteps?: ExpressionRunnerProps['showAllShowSteps'] + skipToTheEnd?: boolean +} + export type ExpressionRunnerShorthandConfig = | ExpressionRunnerSimpleConfig | ExpressionRunnerPlayButtonOnlyConfig | ExpressionRunnerSingleStepConfig + | ExpressionRunnerPredefinedConfig diff --git a/scripts/lib/lessonExpressions.ts b/scripts/lib/lessonExpressions.ts index 451402775..99e68c84d 100644 --- a/scripts/lib/lessonExpressions.ts +++ b/scripts/lib/lessonExpressions.ts @@ -13,6 +13,7 @@ import { numberParamsHighlightNumber } from 'scripts/lib/churchEncodingParams' import { magicalVariableName } from 'src/lib/specialVariableNames' +import { ContainerWithState } from 'src/types/ExpressionContainerTypes' export const e1E1 = initializeExpressionContainer([ { @@ -985,3 +986,10 @@ export const v2e1E2 = initializeExpressionContainer([ } ] ]) + +export const v2e1E3: ContainerWithState<'done'> = { + ...initializeExpressionContainer({ + shorthandNumber: 2 + }), + containerState: 'done' +} diff --git a/scripts/lib/runnerConfigs/nlfx.ts b/scripts/lib/runnerConfigs/nlfx.ts new file mode 100644 index 000000000..7285d4a71 --- /dev/null +++ b/scripts/lib/runnerConfigs/nlfx.ts @@ -0,0 +1,8 @@ +import { ExpressionRunnerShorthandConfig } from '../expressionRunnerShorthandConfig' + +const config: ExpressionRunnerShorthandConfig = { + runner: 'predefined', + predefinedExpressionsKeys: ['v2e1E2', 'v2e1E3'] +} + +export default config diff --git a/src/components/Runners/Nlfx.tsx b/src/components/Runners/Nlfx.tsx new file mode 100644 index 000000000..9caa58955 --- /dev/null +++ b/src/components/Runners/Nlfx.tsx @@ -0,0 +1,8 @@ +import React from 'react' +import ExpressionRunnerPrecomputed from 'src/components/ExpressionRunnerPrecomputed' +import config from 'src/lib/runners/nlfx.json' + +// @ts-ignore +const Nlfx = () => + +export default Nlfx diff --git a/src/components/Runners/index.ts b/src/components/Runners/index.ts index 776349319..39d59834d 100644 --- a/src/components/Runners/index.ts +++ b/src/components/Runners/index.ts @@ -172,6 +172,7 @@ export { default as News } from 'src/components/Runners/News' export { default as Nfkp } from 'src/components/Runners/Nfkp' export { default as Ngus } from 'src/components/Runners/Ngus' export { default as Nicg } from 'src/components/Runners/Nicg' +export { default as Nlfx } from 'src/components/Runners/Nlfx' export { default as Nlxe } from 'src/components/Runners/Nlxe' export { default as Nmoc } from 'src/components/Runners/Nmoc' export { default as Nnhc } from 'src/components/Runners/Nnhc' diff --git a/src/contents/1.v2.jp.tsx b/src/contents/1.v2.jp.tsx index 1e84f8a49..7cbcdf7ac 100644 --- a/src/contents/1.v2.jp.tsx +++ b/src/contents/1.v2.jp.tsx @@ -37,7 +37,7 @@ export default () => ( 」と呼ばれる便利な道具がありました。 計算箱さまざまな計算を自動で行ってくれる道具 - です。人々は 難しい計算を行うとき、いつもこの + です。人々は難しい計算を行うとき、いつもこの 計算箱に頼っていました。

@@ -69,6 +69,12 @@ export default () => (

+ +

+ これで {' '} + {' '} + が計算できました!次は、足し算以外の計算箱も見ていきましょう。 +

) } diff --git a/src/lib/date.tsx b/src/lib/date.tsx index 72fcf5ed9..25eef02db 100644 --- a/src/lib/date.tsx +++ b/src/lib/date.tsx @@ -2,8 +2,8 @@ import locale from 'src/lib/locale' import { DateTime } from 'luxon' export const date = { - jp: DateTime.fromISO('2019-06-24T00:00:00Z'), - en: DateTime.fromISO('2019-06-24T00:00:00Z') + jp: DateTime.fromISO('2019-07-08T00:00:00Z'), + en: DateTime.fromISO('2019-07-08T00:00:00Z') }[locale] export const dateString = { diff --git a/src/lib/runners/nlfx.json b/src/lib/runners/nlfx.json new file mode 100644 index 000000000..d1d27308a --- /dev/null +++ b/src/lib/runners/nlfx.json @@ -0,0 +1,96 @@ +{ + "expressionContainers": [ + { + "containerState": "ready", + "previouslyChangedExpressionState": "default", + "expression": { + "arg": { + "arg": { + "name": "shorthandNumber", + "highlightType": "default", + "topLeftBadgeType": "none", + "bottomRightBadgeType": "none", + "type": "variable", + "argPriorityAgg": [ + 1, + 2 + ], + "funcPriorityAgg": [], + "emphasizePriority": false, + "bound": true, + "shorthandNumber": 1 + }, + "func": { + "name": "shorthandBinary", + "highlightType": "default", + "topLeftBadgeType": "none", + "bottomRightBadgeType": "none", + "type": "variable", + "argPriorityAgg": [], + "funcPriorityAgg": [ + 2 + ], + "emphasizePriority": false, + "bound": true, + "shorthandBinary": "add" + }, + "state": "default", + "type": "call", + "priority": 2 + }, + "func": { + "name": "shorthandNumber", + "highlightType": "default", + "topLeftBadgeType": "none", + "bottomRightBadgeType": "none", + "type": "variable", + "argPriorityAgg": [], + "funcPriorityAgg": [ + 1 + ], + "emphasizePriority": false, + "bound": true, + "shorthandNumber": 1 + }, + "state": "default", + "type": "call", + "priority": 1 + } + }, + { + "containerState": "done", + "previouslyChangedExpressionState": "default", + "expression": { + "name": "shorthandNumber", + "highlightType": "default", + "topLeftBadgeType": "none", + "bottomRightBadgeType": "none", + "type": "variable", + "argPriorityAgg": [], + "funcPriorityAgg": [], + "emphasizePriority": false, + "bound": true, + "shorthandNumber": 2 + } + } + ], + "speed": 1, + "showOnlyFocused": false, + "hideControls": false, + "explanationsVisibility": "hiddenInitialPausedOnly", + "hidePriorities": true, + "variableSize": "lg", + "containerSize": "xxs", + "hidePlayButton": false, + "hideBottomRightBadges": false, + "skipToTheEnd": true, + "hideFuncUnboundBadgeOnExplanation": false, + "highlightOverridesCallArgAndFuncUnboundOnly": false, + "bottomRightBadgeOverrides": {}, + "highlightOverrides": {}, + "highlightOverrideActiveAfterStart": false, + "argPriorityAggHighlights": [], + "funcPriorityAggHighlights": [], + "highlightFunctions": false, + "superFastForward": false +} From 9ad37b815a31de8cf7a01aa4dd62b61fbb095b7c Mon Sep 17 00:00:00 2001 From: Shu Uesugi Date: Tue, 25 Jun 2019 17:40:51 -0700 Subject: [PATCH 05/20] Continue with 1 --- scripts/lib/lessonExpressions.ts | 21 +++++++ scripts/lib/runnerConfigs/uaha.ts | 8 +++ src/components/Runners/Uaha.tsx | 8 +++ src/components/Runners/index.ts | 1 + src/contents/1.v2.jp.tsx | 23 ++++++++ src/lib/runners/uaha.json | 96 +++++++++++++++++++++++++++++++ 6 files changed, 157 insertions(+) create mode 100644 scripts/lib/runnerConfigs/uaha.ts create mode 100644 src/components/Runners/Uaha.tsx create mode 100644 src/lib/runners/uaha.json diff --git a/scripts/lib/lessonExpressions.ts b/scripts/lib/lessonExpressions.ts index 99e68c84d..3413c659c 100644 --- a/scripts/lib/lessonExpressions.ts +++ b/scripts/lib/lessonExpressions.ts @@ -993,3 +993,24 @@ export const v2e1E3: ContainerWithState<'done'> = { }), containerState: 'done' } + +export const v2e1E4 = initializeExpressionContainer([ + { + shorthandNumber: 2 + }, + [ + { + shorthandBinary: 'mult' + }, + { + shorthandNumber: 3 + } + ] +]) + +export const v2e1E5: ContainerWithState<'done'> = { + ...initializeExpressionContainer({ + shorthandNumber: 6 + }), + containerState: 'done' +} diff --git a/scripts/lib/runnerConfigs/uaha.ts b/scripts/lib/runnerConfigs/uaha.ts new file mode 100644 index 000000000..3fc1c51dc --- /dev/null +++ b/scripts/lib/runnerConfigs/uaha.ts @@ -0,0 +1,8 @@ +import { ExpressionRunnerShorthandConfig } from '../expressionRunnerShorthandConfig' + +const config: ExpressionRunnerShorthandConfig = { + runner: 'predefined', + predefinedExpressionsKeys: ['v2e1E4', 'v2e1E5'] +} + +export default config diff --git a/src/components/Runners/Uaha.tsx b/src/components/Runners/Uaha.tsx new file mode 100644 index 000000000..1b3463fbc --- /dev/null +++ b/src/components/Runners/Uaha.tsx @@ -0,0 +1,8 @@ +import React from 'react' +import ExpressionRunnerPrecomputed from 'src/components/ExpressionRunnerPrecomputed' +import config from 'src/lib/runners/uaha.json' + +// @ts-ignore +const Uaha = () => + +export default Uaha diff --git a/src/components/Runners/index.ts b/src/components/Runners/index.ts index 39d59834d..9d1cf90be 100644 --- a/src/components/Runners/index.ts +++ b/src/components/Runners/index.ts @@ -241,6 +241,7 @@ export { default as Tkqr } from 'src/components/Runners/Tkqr' export { default as Tntc } from 'src/components/Runners/Tntc' export { default as Ttvy } from 'src/components/Runners/Ttvy' export { default as Tuqr } from 'src/components/Runners/Tuqr' +export { default as Uaha } from 'src/components/Runners/Uaha' export { default as Udic } from 'src/components/Runners/Udic' export { default as Udvh } from 'src/components/Runners/Udvh' export { default as Uemm } from 'src/components/Runners/Uemm' diff --git a/src/contents/1.v2.jp.tsx b/src/contents/1.v2.jp.tsx index 7cbcdf7ac..eaf86677d 100644 --- a/src/contents/1.v2.jp.tsx +++ b/src/contents/1.v2.jp.tsx @@ -77,6 +77,29 @@ export default () => (

) + }, + { + title: <>四則演算, + content: ( + <> +

+ 計算箱は、足し算以外にも引き算・掛け算・割り算、すなわち四則演算のすべてに対応しています。 +

+ +

+ たとえばこちらは、「掛け算ができる計算箱 + 」です。 + + + ボタン + + を押せば、 + ✖️{' '} + を計算してくれます。 +

+ + + ) } ]} /> diff --git a/src/lib/runners/uaha.json b/src/lib/runners/uaha.json new file mode 100644 index 000000000..80216b6d8 --- /dev/null +++ b/src/lib/runners/uaha.json @@ -0,0 +1,96 @@ +{ + "expressionContainers": [ + { + "containerState": "ready", + "previouslyChangedExpressionState": "default", + "expression": { + "arg": { + "arg": { + "name": "shorthandNumber", + "highlightType": "default", + "topLeftBadgeType": "none", + "bottomRightBadgeType": "none", + "type": "variable", + "argPriorityAgg": [ + 1, + 2 + ], + "funcPriorityAgg": [], + "emphasizePriority": false, + "bound": true, + "shorthandNumber": 3 + }, + "func": { + "name": "shorthandBinary", + "highlightType": "default", + "topLeftBadgeType": "none", + "bottomRightBadgeType": "none", + "type": "variable", + "argPriorityAgg": [], + "funcPriorityAgg": [ + 2 + ], + "emphasizePriority": false, + "bound": true, + "shorthandBinary": "mult" + }, + "state": "default", + "type": "call", + "priority": 2 + }, + "func": { + "name": "shorthandNumber", + "highlightType": "default", + "topLeftBadgeType": "none", + "bottomRightBadgeType": "none", + "type": "variable", + "argPriorityAgg": [], + "funcPriorityAgg": [ + 1 + ], + "emphasizePriority": false, + "bound": true, + "shorthandNumber": 2 + }, + "state": "default", + "type": "call", + "priority": 1 + } + }, + { + "containerState": "done", + "previouslyChangedExpressionState": "default", + "expression": { + "name": "shorthandNumber", + "highlightType": "default", + "topLeftBadgeType": "none", + "bottomRightBadgeType": "none", + "type": "variable", + "argPriorityAgg": [], + "funcPriorityAgg": [], + "emphasizePriority": false, + "bound": true, + "shorthandNumber": 6 + } + } + ], + "speed": 1, + "showOnlyFocused": false, + "hideControls": false, + "explanationsVisibility": "hiddenInitialPausedOnly", + "hidePriorities": true, + "variableSize": "lg", + "containerSize": "xxs", + "hidePlayButton": false, + "hideBottomRightBadges": false, + "skipToTheEnd": true, + "hideFuncUnboundBadgeOnExplanation": false, + "highlightOverridesCallArgAndFuncUnboundOnly": false, + "bottomRightBadgeOverrides": {}, + "highlightOverrides": {}, + "highlightOverrideActiveAfterStart": false, + "argPriorityAggHighlights": [], + "funcPriorityAggHighlights": [], + "highlightFunctions": false, + "superFastForward": false +} From 8621ee191425dc414a7e765c8ff7ad7f48236882 Mon Sep 17 00:00:00 2001 From: Shu Uesugi Date: Tue, 25 Jun 2019 21:44:36 -0700 Subject: [PATCH 06/20] Done with slide 3 --- scripts/lib/lessonExpressions.ts | 23 +++++- scripts/lib/runnerConfigs/mjbi.ts | 8 ++ scripts/lib/runnerConfigs/wtax.ts | 8 ++ src/components/H.tsx | 7 ++ src/components/Runners/Mjbi.tsx | 8 ++ src/components/Runners/Wtax.tsx | 8 ++ src/components/Runners/index.ts | 2 + src/components/VariableExpressionBox.tsx | 30 +++++++- src/contents/1.v2.jp.tsx | 56 ++++++++++++-- src/lib/runners/mjbi.json | 80 ++++++++++++++++++++ src/lib/runners/wtax.json | 96 ++++++++++++++++++++++++ src/types/ExpressionTypes.ts | 2 +- src/types/HTypes.ts | 1 + 13 files changed, 316 insertions(+), 13 deletions(-) create mode 100644 scripts/lib/runnerConfigs/mjbi.ts create mode 100644 scripts/lib/runnerConfigs/wtax.ts create mode 100644 src/components/Runners/Mjbi.tsx create mode 100644 src/components/Runners/Wtax.tsx create mode 100644 src/lib/runners/mjbi.json create mode 100644 src/lib/runners/wtax.json diff --git a/scripts/lib/lessonExpressions.ts b/scripts/lib/lessonExpressions.ts index 3413c659c..1b3113e19 100644 --- a/scripts/lib/lessonExpressions.ts +++ b/scripts/lib/lessonExpressions.ts @@ -1000,7 +1000,7 @@ export const v2e1E4 = initializeExpressionContainer([ }, [ { - shorthandBinary: 'mult' + shorthandBinary: 'add' }, { shorthandNumber: 3 @@ -1014,3 +1014,24 @@ export const v2e1E5: ContainerWithState<'done'> = { }), containerState: 'done' } + +export const v2e1E6 = initializeExpressionContainer([ + { + shorthandNumber: 2 + }, + [ + { + shorthandBinary: 'remainder' + }, + { + shorthandNumber: 5 + } + ] +]) + +export const v2e1E7: ContainerWithState<'done'> = { + ...initializeExpressionContainer({ + shorthandNumber: 1 + }), + containerState: 'done' +} diff --git a/scripts/lib/runnerConfigs/mjbi.ts b/scripts/lib/runnerConfigs/mjbi.ts new file mode 100644 index 000000000..748e323a7 --- /dev/null +++ b/scripts/lib/runnerConfigs/mjbi.ts @@ -0,0 +1,8 @@ +import { ExpressionRunnerShorthandConfig } from '../expressionRunnerShorthandConfig' + +const config: ExpressionRunnerShorthandConfig = { + runner: 'simple', + lessonExpressionsKey: 'v2e1E6' +} + +export default config diff --git a/scripts/lib/runnerConfigs/wtax.ts b/scripts/lib/runnerConfigs/wtax.ts new file mode 100644 index 000000000..55020f47a --- /dev/null +++ b/scripts/lib/runnerConfigs/wtax.ts @@ -0,0 +1,8 @@ +import { ExpressionRunnerShorthandConfig } from '../expressionRunnerShorthandConfig' + +const config: ExpressionRunnerShorthandConfig = { + runner: 'predefined', + predefinedExpressionsKeys: ['v2e1E6', 'v2e1E7'] +} + +export default config diff --git a/src/components/H.tsx b/src/components/H.tsx index 2012168f8..0bfcfd92d 100644 --- a/src/components/H.tsx +++ b/src/components/H.tsx @@ -1738,6 +1738,13 @@ const H = ({ args, highlightType, episodeNumberOverrides }: HProps) => { ) } } + if (args.name === 'remainder') { + if (locale === 'en') { + return <>? + } else { + return <>余り + } + } throw new Error() } diff --git a/src/components/Runners/Mjbi.tsx b/src/components/Runners/Mjbi.tsx new file mode 100644 index 000000000..657580f96 --- /dev/null +++ b/src/components/Runners/Mjbi.tsx @@ -0,0 +1,8 @@ +import React from 'react' +import ExpressionRunnerPrecomputed from 'src/components/ExpressionRunnerPrecomputed' +import config from 'src/lib/runners/mjbi.json' + +// @ts-ignore +const Mjbi = () => + +export default Mjbi diff --git a/src/components/Runners/Wtax.tsx b/src/components/Runners/Wtax.tsx new file mode 100644 index 000000000..7be54ba14 --- /dev/null +++ b/src/components/Runners/Wtax.tsx @@ -0,0 +1,8 @@ +import React from 'react' +import ExpressionRunnerPrecomputed from 'src/components/ExpressionRunnerPrecomputed' +import config from 'src/lib/runners/wtax.json' + +// @ts-ignore +const Wtax = () => + +export default Wtax diff --git a/src/components/Runners/index.ts b/src/components/Runners/index.ts index 9d1cf90be..9af2f9155 100644 --- a/src/components/Runners/index.ts +++ b/src/components/Runners/index.ts @@ -163,6 +163,7 @@ export { default as Mhgm } from 'src/components/Runners/Mhgm' export { default as Mhwq } from 'src/components/Runners/Mhwq' export { default as Miez } from 'src/components/Runners/Miez' export { default as Mihy } from 'src/components/Runners/Mihy' +export { default as Mjbi } from 'src/components/Runners/Mjbi' export { default as Mnfh } from 'src/components/Runners/Mnfh' export { default as Mpal } from 'src/components/Runners/Mpal' export { default as Mrky } from 'src/components/Runners/Mrky' @@ -274,6 +275,7 @@ export { default as Wcwd } from 'src/components/Runners/Wcwd' export { default as Wdol } from 'src/components/Runners/Wdol' export { default as Woft } from 'src/components/Runners/Woft' export { default as Wqdb } from 'src/components/Runners/Wqdb' +export { default as Wtax } from 'src/components/Runners/Wtax' export { default as Wunw } from 'src/components/Runners/Wunw' export { default as Wxqy } from 'src/components/Runners/Wxqy' export { default as Xcnu } from 'src/components/Runners/Xcnu' diff --git a/src/components/VariableExpressionBox.tsx b/src/components/VariableExpressionBox.tsx index 586783b23..594214cf1 100644 --- a/src/components/VariableExpressionBox.tsx +++ b/src/components/VariableExpressionBox.tsx @@ -53,11 +53,17 @@ export const variableExpressionBoxFontSize = ( xxs: fontSizes(1) }[size]) -const SecretCodeLabel = ({ number }: { number?: number }) => ( +const SecretCodeLabelWrapper = ({ + children, + operator +}: { + operator?: boolean + children: React.ReactNode +}) => ( ( transform: translateY(-0.1em); `} > + {children} + +) + +const SecretCodeLabel = ({ number }: { number?: number }) => ( + {number && <> – {number}} - + +) + +const RemainderLabel = () => ( + + + ) const shorthandBinary = ( @@ -96,6 +114,12 @@ const VariableEmoji = ({ expression }: VariableExpressionBoxProps) => { ) + } else if (expression.shorthandBinary === 'remainder') { + return ( +
+ +
+ ) } else if (expression.name === 'abbreviated') { return (
diff --git a/src/contents/1.v2.jp.tsx b/src/contents/1.v2.jp.tsx index eaf86677d..7e331ad9e 100644 --- a/src/contents/1.v2.jp.tsx +++ b/src/contents/1.v2.jp.tsx @@ -37,8 +37,8 @@ export default () => ( 」と呼ばれる便利な道具がありました。 計算箱さまざまな計算を自動で行ってくれる道具 - です。人々は難しい計算を行うとき、いつもこの - 計算箱に頼っていました。 + です。人々は計算がとても苦手だったので、いつもこの + 計算箱に頼りっぱなしでした。

@@ -79,15 +79,11 @@ export default () => ( ) }, { - title: <>四則演算, + title: <>足し算以外の計算箱, content: ( <>

- 計算箱は、足し算以外にも引き算・掛け算・割り算、すなわち四則演算のすべてに対応しています。 -

- -

- たとえばこちらは、「掛け算ができる計算箱 + 続いてこちらが、「掛け算ができる計算箱 」です。 @@ -98,6 +94,50 @@ export default () => ( を計算してくれます。

+

+ 計算箱は他にも引き算や割り算もできますが、特に興味深いわけでもないので、時間の都合上省略します。 + 😉 +

+ +

+ 一方、少しだけ興味深いのがこちらの「 + 割ったときの余りがわかる計算箱」です。 +

+ +

+ 上の計算箱は、 「 + + {' '} + で割ったときの余り + + 」を計算してくれます。これを使えば、たとえば「 + 5人のグループを2人ずつに分けたとき、仲間はずれが出るか? + 」が分かるわけです。 +

+ +

+ 「それくらい暗算できるだろう 😡 + 」と思われるかもしれませんが、この物語に出てくる人々は計算がとても苦手だったので、計算箱に頼らないといけなかったのです。 + 😉 +

+

+ では、先ほどの計算箱を + + + してみましょう。 + +

+ +

+ で割ると{' '} + 1️⃣ が余るので、計算箱も同じく 1️⃣{' '} + が残りました! +

+ +

+ ここまでは簡単すぎたかもしれません。次は、もう少し複雑な計算箱を見てみましょう! + 😉 +

) } diff --git a/src/lib/runners/mjbi.json b/src/lib/runners/mjbi.json new file mode 100644 index 000000000..d1b435e22 --- /dev/null +++ b/src/lib/runners/mjbi.json @@ -0,0 +1,80 @@ +{ + "expressionContainers": [ + { + "containerState": "ready", + "previouslyChangedExpressionState": "default", + "expression": { + "arg": { + "arg": { + "name": "shorthandNumber", + "highlightType": "default", + "topLeftBadgeType": "none", + "bottomRightBadgeType": "none", + "type": "variable", + "argPriorityAgg": [ + 1, + 2 + ], + "funcPriorityAgg": [], + "emphasizePriority": false, + "bound": true, + "shorthandNumber": 5 + }, + "func": { + "name": "shorthandBinary", + "highlightType": "default", + "topLeftBadgeType": "none", + "bottomRightBadgeType": "none", + "type": "variable", + "argPriorityAgg": [], + "funcPriorityAgg": [ + 2 + ], + "emphasizePriority": false, + "bound": true, + "shorthandBinary": "remainder" + }, + "state": "default", + "type": "call", + "priority": 2 + }, + "func": { + "name": "shorthandNumber", + "highlightType": "default", + "topLeftBadgeType": "none", + "bottomRightBadgeType": "none", + "type": "variable", + "argPriorityAgg": [], + "funcPriorityAgg": [ + 1 + ], + "emphasizePriority": false, + "bound": true, + "shorthandNumber": 2 + }, + "state": "default", + "type": "call", + "priority": 1 + } + } + ], + "speed": 1, + "showOnlyFocused": false, + "hideControls": true, + "explanationsVisibility": "hidden", + "hidePriorities": true, + "variableSize": "lg", + "containerSize": "xxs", + "hidePlayButton": false, + "hideBottomRightBadges": false, + "skipToTheEnd": false, + "hideFuncUnboundBadgeOnExplanation": false, + "highlightOverridesCallArgAndFuncUnboundOnly": false, + "bottomRightBadgeOverrides": {}, + "highlightOverrides": {}, + "highlightOverrideActiveAfterStart": false, + "argPriorityAggHighlights": [], + "funcPriorityAggHighlights": [], + "highlightFunctions": false, + "superFastForward": false +} diff --git a/src/lib/runners/wtax.json b/src/lib/runners/wtax.json new file mode 100644 index 000000000..fdb8aafe2 --- /dev/null +++ b/src/lib/runners/wtax.json @@ -0,0 +1,96 @@ +{ + "expressionContainers": [ + { + "containerState": "ready", + "previouslyChangedExpressionState": "default", + "expression": { + "arg": { + "arg": { + "name": "shorthandNumber", + "highlightType": "default", + "topLeftBadgeType": "none", + "bottomRightBadgeType": "none", + "type": "variable", + "argPriorityAgg": [ + 1, + 2 + ], + "funcPriorityAgg": [], + "emphasizePriority": false, + "bound": true, + "shorthandNumber": 5 + }, + "func": { + "name": "shorthandBinary", + "highlightType": "default", + "topLeftBadgeType": "none", + "bottomRightBadgeType": "none", + "type": "variable", + "argPriorityAgg": [], + "funcPriorityAgg": [ + 2 + ], + "emphasizePriority": false, + "bound": true, + "shorthandBinary": "remainder" + }, + "state": "default", + "type": "call", + "priority": 2 + }, + "func": { + "name": "shorthandNumber", + "highlightType": "default", + "topLeftBadgeType": "none", + "bottomRightBadgeType": "none", + "type": "variable", + "argPriorityAgg": [], + "funcPriorityAgg": [ + 1 + ], + "emphasizePriority": false, + "bound": true, + "shorthandNumber": 2 + }, + "state": "default", + "type": "call", + "priority": 1 + } + }, + { + "containerState": "done", + "previouslyChangedExpressionState": "default", + "expression": { + "name": "shorthandNumber", + "highlightType": "default", + "topLeftBadgeType": "none", + "bottomRightBadgeType": "none", + "type": "variable", + "argPriorityAgg": [], + "funcPriorityAgg": [], + "emphasizePriority": false, + "bound": true, + "shorthandNumber": 1 + } + } + ], + "speed": 1, + "showOnlyFocused": false, + "hideControls": false, + "explanationsVisibility": "hiddenInitialPausedOnly", + "hidePriorities": true, + "variableSize": "lg", + "containerSize": "xxs", + "hidePlayButton": false, + "hideBottomRightBadges": false, + "skipToTheEnd": true, + "hideFuncUnboundBadgeOnExplanation": false, + "highlightOverridesCallArgAndFuncUnboundOnly": false, + "bottomRightBadgeOverrides": {}, + "highlightOverrides": {}, + "highlightOverrideActiveAfterStart": false, + "argPriorityAggHighlights": [], + "funcPriorityAggHighlights": [], + "highlightFunctions": false, + "superFastForward": false +} diff --git a/src/types/ExpressionTypes.ts b/src/types/ExpressionTypes.ts index d4cf96592..9b635881f 100644 --- a/src/types/ExpressionTypes.ts +++ b/src/types/ExpressionTypes.ts @@ -10,7 +10,7 @@ export interface VariableExpression { readonly emphasizePriority: boolean readonly argPriorityAgg: number[] readonly funcPriorityAgg: number[] - readonly shorthandBinary?: 'mult' | 'add' + readonly shorthandBinary?: 'mult' | 'add' | 'remainder' readonly shorthandNumber?: number readonly shorthandUnary?: 'pred' readonly magical?: boolean diff --git a/src/types/HTypes.ts b/src/types/HTypes.ts index af2bb1c62..46f55f1c2 100644 --- a/src/types/HTypes.ts +++ b/src/types/HTypes.ts @@ -125,4 +125,5 @@ export interface HProps { | { name: 'numberOfAIsSecretCodeCaption' } | { name: 'mentionRightArrow' } | { name: 'addMathBox' } + | { name: 'remainder' } } From 52f345c193d4bb68d736f499afc30271bb76ca50 Mon Sep 17 00:00:00 2001 From: Shu Uesugi Date: Tue, 25 Jun 2019 22:31:20 -0700 Subject: [PATCH 07/20] Clarify modulo --- src/components/H.tsx | 2 +- src/components/VariableExpressionBox.tsx | 4 ++-- src/contents/1.v2.jp.tsx | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/H.tsx b/src/components/H.tsx index 0bfcfd92d..30fdcd32b 100644 --- a/src/components/H.tsx +++ b/src/components/H.tsx @@ -1742,7 +1742,7 @@ const H = ({ args, highlightType, episodeNumberOverrides }: HProps) => { if (locale === 'en') { return <>? } else { - return <>余り + return <>割ったときの余り } } throw new Error() diff --git a/src/components/VariableExpressionBox.tsx b/src/components/VariableExpressionBox.tsx index 594214cf1..38a6edee0 100644 --- a/src/components/VariableExpressionBox.tsx +++ b/src/components/VariableExpressionBox.tsx @@ -62,14 +62,14 @@ const SecretCodeLabelWrapper = ({ }) => ( {children} diff --git a/src/contents/1.v2.jp.tsx b/src/contents/1.v2.jp.tsx index 7e331ad9e..8a83dba3b 100644 --- a/src/contents/1.v2.jp.tsx +++ b/src/contents/1.v2.jp.tsx @@ -117,7 +117,7 @@ export default () => (

「それくらい暗算できるだろう 😡 - 」と思われるかもしれませんが、この物語に出てくる人々は計算がとても苦手だったので、計算箱に頼らないといけなかったのです。 + 」と思われるかもしれません。でも、この物語に出てくる人々は計算がとても苦手だったので、簡単な計算でも計算箱に頼っていたのです。 😉

From 7540395eaef21c273263488f2e404f4eaf8cd8e5 Mon Sep 17 00:00:00 2001 From: Shu Uesugi Date: Tue, 25 Jun 2019 22:36:22 -0700 Subject: [PATCH 08/20] Update 1.v2.jp.tsx --- src/contents/1.v2.jp.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/contents/1.v2.jp.tsx b/src/contents/1.v2.jp.tsx index 8a83dba3b..48434bc8c 100644 --- a/src/contents/1.v2.jp.tsx +++ b/src/contents/1.v2.jp.tsx @@ -131,7 +131,8 @@ export default () => (

で割ると{' '} 1️⃣ が余るので、計算箱も同じく 1️⃣{' '} - が残りました! + が残りました!そしてもちろん、5人のグループを2人ずつに分ければ、ひとりが仲間はずれになります。 + 😭

From 17cde55d7f26cd7bd920ee55b4fe8d028f9206f8 Mon Sep 17 00:00:00 2001 From: Shu Uesugi Date: Wed, 26 Jun 2019 01:11:38 -0700 Subject: [PATCH 09/20] Done with slide 4 --- scripts/lib/lessonExpressions.ts | 24 +++++++- scripts/lib/runnerConfigs/iatt.ts | 8 +++ scripts/lib/runnerConfigs/ymmm.ts | 8 +++ src/components/Runners/Iatt.tsx | 8 +++ src/components/Runners/Ymmm.tsx | 8 +++ src/components/Runners/index.ts | 2 + src/contents/1.v2.jp.tsx | 58 +++++++++++++++---- src/lib/letterEmojiMappingJson.json | 3 +- src/lib/runners/fdek.json | 4 +- src/lib/runners/iatt.json | 89 +++++++++++++++++++++++++++++ src/lib/runners/ymmm.json | 70 +++++++++++++++++++++++ src/types/VariableNames.ts | 1 + 12 files changed, 268 insertions(+), 15 deletions(-) create mode 100644 scripts/lib/runnerConfigs/iatt.ts create mode 100644 scripts/lib/runnerConfigs/ymmm.ts create mode 100644 src/components/Runners/Iatt.tsx create mode 100644 src/components/Runners/Ymmm.tsx create mode 100644 src/lib/runners/iatt.json create mode 100644 src/lib/runners/ymmm.json diff --git a/scripts/lib/lessonExpressions.ts b/scripts/lib/lessonExpressions.ts index 1b3113e19..ed83c79fb 100644 --- a/scripts/lib/lessonExpressions.ts +++ b/scripts/lib/lessonExpressions.ts @@ -964,12 +964,12 @@ export const e16E1 = initializeExpressionContainer([ ]) export const v2e1E1 = initializeExpressionContainer([ - 'question', + 'questionV2', [ { shorthandBinary: 'add' }, - 'question' + 'questionV2' ] ]) @@ -1035,3 +1035,23 @@ export const v2e1E7: ContainerWithState<'done'> = { }), containerState: 'done' } + +export const v2e1E8 = initializeExpressionContainer({ + checkType: 'isZero', + condition: 'questionV2', + trueCase: 'questionV2', + falseCase: 'questionV2' +}) + +export const v2e1E9 = initializeExpressionContainer({ + checkType: 'isZero', + condition: { + shorthandNumber: 2 + }, + trueCase: { + shorthandNumber: 3 + }, + falseCase: { + shorthandNumber: 1 + } +}) diff --git a/scripts/lib/runnerConfigs/iatt.ts b/scripts/lib/runnerConfigs/iatt.ts new file mode 100644 index 000000000..d4f0c1863 --- /dev/null +++ b/scripts/lib/runnerConfigs/iatt.ts @@ -0,0 +1,8 @@ +import { ExpressionRunnerShorthandConfig } from '../expressionRunnerShorthandConfig' + +const config: ExpressionRunnerShorthandConfig = { + runner: 'predefined', + predefinedExpressionsKeys: ['v2e1E9', 'v2e1E7'] +} + +export default config diff --git a/scripts/lib/runnerConfigs/ymmm.ts b/scripts/lib/runnerConfigs/ymmm.ts new file mode 100644 index 000000000..a3e6fd28b --- /dev/null +++ b/scripts/lib/runnerConfigs/ymmm.ts @@ -0,0 +1,8 @@ +import { ExpressionRunnerShorthandConfig } from '../expressionRunnerShorthandConfig' + +const config: ExpressionRunnerShorthandConfig = { + runner: 'simple', + lessonExpressionsKey: 'v2e1E8' +} + +export default config diff --git a/src/components/Runners/Iatt.tsx b/src/components/Runners/Iatt.tsx new file mode 100644 index 000000000..027d80bc5 --- /dev/null +++ b/src/components/Runners/Iatt.tsx @@ -0,0 +1,8 @@ +import React from 'react' +import ExpressionRunnerPrecomputed from 'src/components/ExpressionRunnerPrecomputed' +import config from 'src/lib/runners/iatt.json' + +// @ts-ignore +const Iatt = () => + +export default Iatt diff --git a/src/components/Runners/Ymmm.tsx b/src/components/Runners/Ymmm.tsx new file mode 100644 index 000000000..c70c4e13d --- /dev/null +++ b/src/components/Runners/Ymmm.tsx @@ -0,0 +1,8 @@ +import React from 'react' +import ExpressionRunnerPrecomputed from 'src/components/ExpressionRunnerPrecomputed' +import config from 'src/lib/runners/ymmm.json' + +// @ts-ignore +const Ymmm = () => + +export default Ymmm diff --git a/src/components/Runners/index.ts b/src/components/Runners/index.ts index 9af2f9155..4541ea1d9 100644 --- a/src/components/Runners/index.ts +++ b/src/components/Runners/index.ts @@ -96,6 +96,7 @@ export { default as Hwtu } from 'src/components/Runners/Hwtu' export { default as Hxmk } from 'src/components/Runners/Hxmk' export { default as Hykj } from 'src/components/Runners/Hykj' export { default as Hzlj } from 'src/components/Runners/Hzlj' +export { default as Iatt } from 'src/components/Runners/Iatt' export { default as Idcf } from 'src/components/Runners/Idcf' export { default as Ielw } from 'src/components/Runners/Ielw' export { default as Ifwb } from 'src/components/Runners/Ifwb' @@ -297,6 +298,7 @@ export { default as Xzqu } from 'src/components/Runners/Xzqu' export { default as Yehl } from 'src/components/Runners/Yehl' export { default as Yklt } from 'src/components/Runners/Yklt' export { default as Ylil } from 'src/components/Runners/Ylil' +export { default as Ymmm } from 'src/components/Runners/Ymmm' export { default as Ysji } from 'src/components/Runners/Ysji' export { default as Ytcf } from 'src/components/Runners/Ytcf' export { default as Yvia } from 'src/components/Runners/Yvia' diff --git a/src/contents/1.v2.jp.tsx b/src/contents/1.v2.jp.tsx index 48434bc8c..1d528ba36 100644 --- a/src/contents/1.v2.jp.tsx +++ b/src/contents/1.v2.jp.tsx @@ -6,7 +6,6 @@ import EmojiSeparator from 'src/components/EmojiSeparator' import Emoji from 'src/components/Emoji' import EmojiNumber from 'src/components/EmojiNumber' import * as R from 'src/components/Runners' -import { InlineEmojiBoxesForQuestion } from 'src/components/InlineEmojiBoxes' export default () => ( ( <>

- 当記事は物語調で話を進めていきます。ちなみに、この話はフィクションです。 + 当記事はゆるい物語調 + で話を進めていきます。ちなみに、この話はフィクションです。 😉

@@ -47,13 +47,11 @@ export default () => (

- 一番上と下にハテナマーク - + 一番上と下にハテナマーク {' '} があり、真ん中に足し算の記号 がありますね。

- この - + この {' '} の部分には、それぞれ数字を入れることができます。たとえば{' '} を両方に入れてみましょう。

@@ -117,7 +115,7 @@ export default () => (

「それくらい暗算できるだろう 😡 - 」と思われるかもしれません。でも、この物語に出てくる人々は計算がとても苦手だったので、簡単な計算でも計算箱に頼っていたのです。 + 」と思われるかもしれません。でも、みんな計算がとても苦手だったので、簡単な計算でも計算箱に頼っていたのです。 😉

@@ -129,9 +127,11 @@ export default () => (

- で割ると{' '} - 1️⃣ が余るので、計算箱も同じく 1️⃣{' '} - が残りました!そしてもちろん、5人のグループを2人ずつに分ければ、ひとりが仲間はずれになります。 + {' '} + で割ると「 + 余り + 」になるので、計算箱には余りの 1️⃣{' '} + が残りました。5人のグループを2人ずつに分ければ、ひとりが仲間はずれになりますからね。 😭

@@ -141,6 +141,44 @@ export default () => (

) + }, + { + title: ( + <> + が3つある計算箱 + + ), + content: ( + <> +

次は、こちらの計算箱をご覧ください。

+ +

+ この計算箱にはハテナマーク {' '} + が3つあり、それぞれ左端に違う色と、以下の三種類の印がついています。いったいどんな計算ができるのでしょう? + 🤔 +

+ +

+ とりあえず、{' '} + + それぞれの に適当な数字を入れ、 + + + したらどうなるか見てみましょう。 +

+

+ ここでは試しに、上から順に {' '} + {' '} + を入れてみました。 + +

+ +

+ 答えは {' '} + になりました。では、どうしてこうなったか説明しましょう! +

+ + ) } ]} /> diff --git a/src/lib/letterEmojiMappingJson.json b/src/lib/letterEmojiMappingJson.json index 93233b869..44213d753 100644 --- a/src/lib/letterEmojiMappingJson.json +++ b/src/lib/letterEmojiMappingJson.json @@ -33,5 +33,6 @@ "magical": "🧙‍♀️", "someNumber": "❔", "abbreviated": "❔", - "Amult": "❔" + "Amult": "❔", + "questionV2": "❓" } diff --git a/src/lib/runners/fdek.json b/src/lib/runners/fdek.json index 5c67bc5b4..de3eba0a0 100644 --- a/src/lib/runners/fdek.json +++ b/src/lib/runners/fdek.json @@ -6,7 +6,7 @@ "expression": { "arg": { "arg": { - "name": "question", + "name": "questionV2", "highlightType": "default", "topLeftBadgeType": "none", "bottomRightBadgeType": "none", @@ -38,7 +38,7 @@ "priority": 2 }, "func": { - "name": "question", + "name": "questionV2", "highlightType": "default", "topLeftBadgeType": "none", "bottomRightBadgeType": "none", diff --git a/src/lib/runners/iatt.json b/src/lib/runners/iatt.json new file mode 100644 index 000000000..6d1a9f94c --- /dev/null +++ b/src/lib/runners/iatt.json @@ -0,0 +1,89 @@ +{ + "expressionContainers": [ + { + "containerState": "ready", + "previouslyChangedExpressionState": "default", + "expression": { + "type": "conditional", + "state": "default", + "checkType": "isZero", + "condition": { + "name": "shorthandNumber", + "highlightType": "default", + "topLeftBadgeType": "none", + "bottomRightBadgeType": "none", + "type": "variable", + "argPriorityAgg": [], + "funcPriorityAgg": [], + "emphasizePriority": false, + "bound": true, + "shorthandNumber": 2 + }, + "trueCase": { + "name": "shorthandNumber", + "highlightType": "default", + "topLeftBadgeType": "none", + "bottomRightBadgeType": "none", + "type": "variable", + "argPriorityAgg": [], + "funcPriorityAgg": [ + 1 + ], + "emphasizePriority": false, + "bound": true, + "shorthandNumber": 3 + }, + "falseCase": { + "name": "shorthandNumber", + "highlightType": "default", + "topLeftBadgeType": "none", + "bottomRightBadgeType": "none", + "type": "variable", + "argPriorityAgg": [ + 1 + ], + "funcPriorityAgg": [], + "emphasizePriority": false, + "bound": true, + "shorthandNumber": 1 + }, + "priority": 1 + } + }, + { + "containerState": "done", + "previouslyChangedExpressionState": "default", + "expression": { + "name": "shorthandNumber", + "highlightType": "default", + "topLeftBadgeType": "none", + "bottomRightBadgeType": "none", + "type": "variable", + "argPriorityAgg": [], + "funcPriorityAgg": [], + "emphasizePriority": false, + "bound": true, + "shorthandNumber": 1 + } + } + ], + "speed": 1, + "showOnlyFocused": false, + "hideControls": false, + "explanationsVisibility": "hiddenInitialPausedOnly", + "hidePriorities": true, + "variableSize": "lg", + "containerSize": "xxs", + "hidePlayButton": false, + "hideBottomRightBadges": false, + "skipToTheEnd": true, + "hideFuncUnboundBadgeOnExplanation": false, + "highlightOverridesCallArgAndFuncUnboundOnly": false, + "bottomRightBadgeOverrides": {}, + "highlightOverrides": {}, + "highlightOverrideActiveAfterStart": false, + "argPriorityAggHighlights": [], + "funcPriorityAggHighlights": [], + "highlightFunctions": false, + "superFastForward": false +} diff --git a/src/lib/runners/ymmm.json b/src/lib/runners/ymmm.json new file mode 100644 index 000000000..5a21daca7 --- /dev/null +++ b/src/lib/runners/ymmm.json @@ -0,0 +1,70 @@ +{ + "expressionContainers": [ + { + "containerState": "ready", + "previouslyChangedExpressionState": "default", + "expression": { + "type": "conditional", + "state": "default", + "checkType": "isZero", + "condition": { + "name": "questionV2", + "highlightType": "default", + "topLeftBadgeType": "none", + "bottomRightBadgeType": "none", + "type": "variable", + "argPriorityAgg": [], + "funcPriorityAgg": [], + "emphasizePriority": false, + "bound": true + }, + "trueCase": { + "name": "questionV2", + "highlightType": "default", + "topLeftBadgeType": "none", + "bottomRightBadgeType": "none", + "type": "variable", + "argPriorityAgg": [], + "funcPriorityAgg": [ + 1 + ], + "emphasizePriority": false, + "bound": true + }, + "falseCase": { + "name": "questionV2", + "highlightType": "default", + "topLeftBadgeType": "none", + "bottomRightBadgeType": "none", + "type": "variable", + "argPriorityAgg": [ + 1 + ], + "funcPriorityAgg": [], + "emphasizePriority": false, + "bound": true + }, + "priority": 1 + } + } + ], + "speed": 1, + "showOnlyFocused": false, + "hideControls": true, + "explanationsVisibility": "hidden", + "hidePriorities": true, + "variableSize": "lg", + "containerSize": "xxs", + "hidePlayButton": false, + "hideBottomRightBadges": false, + "skipToTheEnd": false, + "hideFuncUnboundBadgeOnExplanation": false, + "highlightOverridesCallArgAndFuncUnboundOnly": false, + "bottomRightBadgeOverrides": {}, + "highlightOverrides": {}, + "highlightOverrideActiveAfterStart": false, + "argPriorityAggHighlights": [], + "funcPriorityAggHighlights": [], + "highlightFunctions": false, + "superFastForward": false +} diff --git a/src/types/VariableNames.ts b/src/types/VariableNames.ts index abe843ebd..850e80fec 100644 --- a/src/types/VariableNames.ts +++ b/src/types/VariableNames.ts @@ -34,6 +34,7 @@ export type VariableNames = | 'someNumber' | 'abbreviated' | 'Amult' + | 'questionV2' export interface VariableNamesWithAlphaConvertCount { name: VariableNames From 8a512fd0ecff44341c8426175fdfe76036b226d9 Mon Sep 17 00:00:00 2001 From: Shu Uesugi Date: Wed, 26 Jun 2019 01:17:24 -0700 Subject: [PATCH 10/20] Wordsmith --- src/contents/1.v2.jp.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/contents/1.v2.jp.tsx b/src/contents/1.v2.jp.tsx index 1d528ba36..e2b0612ad 100644 --- a/src/contents/1.v2.jp.tsx +++ b/src/contents/1.v2.jp.tsx @@ -93,7 +93,7 @@ export default () => (

- 計算箱は他にも引き算や割り算もできますが、特に興味深いわけでもないので、時間の都合上省略します。 + 計算箱は他にも引き算や割り算ができますが、特に興味深いわけでもないので、時間の都合上省略します。 😉

@@ -115,7 +115,11 @@ export default () => (

「それくらい暗算できるだろう 😡 - 」と思われるかもしれません。でも、みんな計算がとても苦手だったので、簡単な計算でも計算箱に頼っていたのです。 + 」と思われるかもしれません。でも、 + + 計算箱がある世界の人々はみな計算が苦手で、簡単な計算でも計算箱に頼っていた + + のです。 😉

From 942a7c2348110760e174fc1add50c31718e8b6cb Mon Sep 17 00:00:00 2001 From: Shu Uesugi Date: Wed, 26 Jun 2019 01:32:11 -0700 Subject: [PATCH 11/20] Continue with episode 1 --- src/contents/1.v2.jp.tsx | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/src/contents/1.v2.jp.tsx b/src/contents/1.v2.jp.tsx index e2b0612ad..227907c00 100644 --- a/src/contents/1.v2.jp.tsx +++ b/src/contents/1.v2.jp.tsx @@ -92,6 +92,9 @@ export default () => ( を計算してくれます。

+

+ ご覧の通り、答えは になりました。 +

計算箱は他にも引き算や割り算ができますが、特に興味深いわけでもないので、時間の都合上省略します。 😉 @@ -134,8 +137,14 @@ export default () => ( {' '} で割ると「 余り - 」になるので、計算箱には余りの 1️⃣{' '} - が残りました。5人のグループを2人ずつに分ければ、ひとりが仲間はずれになりますからね。 + 」になるので、計算箱には + + 余りの 1️⃣ + {' '} + が残りました。 +

+

+ 先ほどの例に戻ると、5人のグループを2人ずつに分ければ、ひとりが仲間はずれになります。 😭

@@ -157,8 +166,12 @@ export default () => (

次は、こちらの計算箱をご覧ください。

- この計算箱にはハテナマーク {' '} - が3つあり、それぞれ左端に違う色と、以下の三種類の印がついています。いったいどんな計算ができるのでしょう? + この計算箱には + + ハテナマーク {' '} + が3つあり、それぞれ左端に違う色と、以下の三種類の印がついています + + 。いったいどんな計算ができるのでしょう? 🤔

@@ -168,12 +181,12 @@ export default () => ( それぞれの に適当な数字を入れ、 - したらどうなるか見てみましょう。 + したらどうなるか試してみましょう。

- ここでは試しに、上から順に {' '} + 試しに、上から順に {' '} {' '} - を入れてみました。 + を入れてみたので、

@@ -183,6 +196,10 @@ export default () => (

) + }, + { + title: <>ゼロか、ゼロ以外か, + content: <> } ]} /> From 232faf1fe2898364799b65d62b6e8d5fccbe3d9e Mon Sep 17 00:00:00 2001 From: Shu Uesugi Date: Wed, 26 Jun 2019 02:42:47 -0700 Subject: [PATCH 12/20] Continue with 1 --- scripts/lib/lessonExpressions.ts | 20 +++++ scripts/lib/runnerConfigs/plbv.ts | 8 ++ scripts/lib/runnerConfigs/rjfy.ts | 10 +++ scripts/lib/runnerConfigs/toht.ts | 8 ++ scripts/lib/runnerConfigs/vozu.ts | 10 +++ .../ExpressionRunnerExplanation.tsx | 2 +- src/components/Runners/Plbv.tsx | 8 ++ src/components/Runners/Rjfy.tsx | 8 ++ src/components/Runners/Toht.tsx | 8 ++ src/components/Runners/Vozu.tsx | 8 ++ src/components/Runners/index.ts | 4 + src/contents/1.v2.jp.tsx | 56 +++++++++++++- src/lib/runners/plbv.json | 73 ++++++++++++++++++ src/lib/runners/rjfy.json | 74 +++++++++++++++++++ src/lib/runners/toht.json | 39 ++++++++++ src/lib/runners/vozu.json | 74 +++++++++++++++++++ 16 files changed, 406 insertions(+), 4 deletions(-) create mode 100644 scripts/lib/runnerConfigs/plbv.ts create mode 100644 scripts/lib/runnerConfigs/rjfy.ts create mode 100644 scripts/lib/runnerConfigs/toht.ts create mode 100644 scripts/lib/runnerConfigs/vozu.ts create mode 100644 src/components/Runners/Plbv.tsx create mode 100644 src/components/Runners/Rjfy.tsx create mode 100644 src/components/Runners/Toht.tsx create mode 100644 src/components/Runners/Vozu.tsx create mode 100644 src/lib/runners/plbv.json create mode 100644 src/lib/runners/rjfy.json create mode 100644 src/lib/runners/toht.json create mode 100644 src/lib/runners/vozu.json diff --git a/scripts/lib/lessonExpressions.ts b/scripts/lib/lessonExpressions.ts index ed83c79fb..63af3ded5 100644 --- a/scripts/lib/lessonExpressions.ts +++ b/scripts/lib/lessonExpressions.ts @@ -1055,3 +1055,23 @@ export const v2e1E9 = initializeExpressionContainer({ shorthandNumber: 1 } }) + +export const v2e1E10: ContainerWithState<'done'> = { + ...initializeExpressionContainer({ + shorthandNumber: 1 + }), + containerState: 'done' +} + +export const v2e1E11 = initializeExpressionContainer({ + checkType: 'isZero', + condition: { + shorthandNumber: 0 + }, + trueCase: { + shorthandNumber: 5 + }, + falseCase: { + shorthandNumber: 4 + } +}) diff --git a/scripts/lib/runnerConfigs/plbv.ts b/scripts/lib/runnerConfigs/plbv.ts new file mode 100644 index 000000000..c66040c59 --- /dev/null +++ b/scripts/lib/runnerConfigs/plbv.ts @@ -0,0 +1,8 @@ +import { ExpressionRunnerShorthandConfig } from '../expressionRunnerShorthandConfig' + +const config: ExpressionRunnerShorthandConfig = { + runner: 'simple', + lessonExpressionsKey: 'v2e1E11' +} + +export default config diff --git a/scripts/lib/runnerConfigs/rjfy.ts b/scripts/lib/runnerConfigs/rjfy.ts new file mode 100644 index 000000000..6bae5d682 --- /dev/null +++ b/scripts/lib/runnerConfigs/rjfy.ts @@ -0,0 +1,10 @@ +import { ExpressionRunnerShorthandConfig } from '../expressionRunnerShorthandConfig' + +const config: ExpressionRunnerShorthandConfig = { + runner: 'simple', + lessonExpressionsKey: 'v2e1E9', + initialState: 'falseCaseActive', + explanationsVisibility: 'visible' +} + +export default config diff --git a/scripts/lib/runnerConfigs/toht.ts b/scripts/lib/runnerConfigs/toht.ts new file mode 100644 index 000000000..3d2b62457 --- /dev/null +++ b/scripts/lib/runnerConfigs/toht.ts @@ -0,0 +1,8 @@ +import { ExpressionRunnerShorthandConfig } from '../expressionRunnerShorthandConfig' + +const config: ExpressionRunnerShorthandConfig = { + runner: 'simple', + lessonExpressionsKey: 'v2e1E7' +} + +export default config diff --git a/scripts/lib/runnerConfigs/vozu.ts b/scripts/lib/runnerConfigs/vozu.ts new file mode 100644 index 000000000..5dff6bc88 --- /dev/null +++ b/scripts/lib/runnerConfigs/vozu.ts @@ -0,0 +1,10 @@ +import { ExpressionRunnerShorthandConfig } from '../expressionRunnerShorthandConfig' + +const config: ExpressionRunnerShorthandConfig = { + runner: 'simple', + lessonExpressionsKey: 'v2e1E9', + initialState: 'conditionActive', + explanationsVisibility: 'visible' +} + +export default config diff --git a/src/components/ExpressionRunnerExplanation.tsx b/src/components/ExpressionRunnerExplanation.tsx index c8afc45e6..25789bc4c 100644 --- a/src/components/ExpressionRunnerExplanation.tsx +++ b/src/components/ExpressionRunnerExplanation.tsx @@ -331,7 +331,7 @@ const Explanation = ({ type="condition" variableSizeOverrides="sm" />{' '} - が1以上なので{' '} + が ではないので{' '} + +export default Plbv diff --git a/src/components/Runners/Rjfy.tsx b/src/components/Runners/Rjfy.tsx new file mode 100644 index 000000000..9a2cf6a39 --- /dev/null +++ b/src/components/Runners/Rjfy.tsx @@ -0,0 +1,8 @@ +import React from 'react' +import ExpressionRunnerPrecomputed from 'src/components/ExpressionRunnerPrecomputed' +import config from 'src/lib/runners/rjfy.json' + +// @ts-ignore +const Rjfy = () => + +export default Rjfy diff --git a/src/components/Runners/Toht.tsx b/src/components/Runners/Toht.tsx new file mode 100644 index 000000000..aacecff71 --- /dev/null +++ b/src/components/Runners/Toht.tsx @@ -0,0 +1,8 @@ +import React from 'react' +import ExpressionRunnerPrecomputed from 'src/components/ExpressionRunnerPrecomputed' +import config from 'src/lib/runners/toht.json' + +// @ts-ignore +const Toht = () => + +export default Toht diff --git a/src/components/Runners/Vozu.tsx b/src/components/Runners/Vozu.tsx new file mode 100644 index 000000000..4a711dc48 --- /dev/null +++ b/src/components/Runners/Vozu.tsx @@ -0,0 +1,8 @@ +import React from 'react' +import ExpressionRunnerPrecomputed from 'src/components/ExpressionRunnerPrecomputed' +import config from 'src/lib/runners/vozu.json' + +// @ts-ignore +const Vozu = () => + +export default Vozu diff --git a/src/components/Runners/index.ts b/src/components/Runners/index.ts index 4541ea1d9..a777adc20 100644 --- a/src/components/Runners/index.ts +++ b/src/components/Runners/index.ts @@ -193,6 +193,7 @@ export { default as Ozbe } from 'src/components/Runners/Ozbe' export { default as Pbgd } from 'src/components/Runners/Pbgd' export { default as Peoq } from 'src/components/Runners/Peoq' export { default as Pgtx } from 'src/components/Runners/Pgtx' +export { default as Plbv } from 'src/components/Runners/Plbv' export { default as Plts } from 'src/components/Runners/Plts' export { default as Plxd } from 'src/components/Runners/Plxd' export { default as Pnob } from 'src/components/Runners/Pnob' @@ -216,6 +217,7 @@ export { default as Qwke } from 'src/components/Runners/Qwke' export { default as Qxgl } from 'src/components/Runners/Qxgl' export { default as Rceu } from 'src/components/Runners/Rceu' export { default as Repd } from 'src/components/Runners/Repd' +export { default as Rjfy } from 'src/components/Runners/Rjfy' export { default as Rmsd } from 'src/components/Runners/Rmsd' export { default as Rome } from 'src/components/Runners/Rome' export { default as Rqdn } from 'src/components/Runners/Rqdn' @@ -241,6 +243,7 @@ export { default as Tiok } from 'src/components/Runners/Tiok' export { default as Tkbr } from 'src/components/Runners/Tkbr' export { default as Tkqr } from 'src/components/Runners/Tkqr' export { default as Tntc } from 'src/components/Runners/Tntc' +export { default as Toht } from 'src/components/Runners/Toht' export { default as Ttvy } from 'src/components/Runners/Ttvy' export { default as Tuqr } from 'src/components/Runners/Tuqr' export { default as Uaha } from 'src/components/Runners/Uaha' @@ -261,6 +264,7 @@ export { default as Uwma } from 'src/components/Runners/Uwma' export { default as Vegw } from 'src/components/Runners/Vegw' export { default as Vjaa } from 'src/components/Runners/Vjaa' export { default as Vkpm } from 'src/components/Runners/Vkpm' +export { default as Vozu } from 'src/components/Runners/Vozu' export { default as Vpjw } from 'src/components/Runners/Vpjw' export { default as Vpmj } from 'src/components/Runners/Vpmj' export { default as Vqcw } from 'src/components/Runners/Vqcw' diff --git a/src/contents/1.v2.jp.tsx b/src/contents/1.v2.jp.tsx index 227907c00..7335f3be6 100644 --- a/src/contents/1.v2.jp.tsx +++ b/src/contents/1.v2.jp.tsx @@ -6,6 +6,7 @@ import EmojiSeparator from 'src/components/EmojiSeparator' import Emoji from 'src/components/Emoji' import EmojiNumber from 'src/components/EmojiNumber' import * as R from 'src/components/Runners' +import { InlineEmojiBoxesForCondition } from 'src/components/InlineEmojiBoxes' export default () => ( ( 😉

- まずは、物語の主役となる「 + まずは、この物語に登場する「 計算箱」の話をしましょう。

@@ -198,8 +199,57 @@ export default () => ( ) }, { - title: <>ゼロか、ゼロ以外か, - content: <> + title: ( + <> + 真ん中が かどうか + + ), + content: ( + <> +

+ この計算箱はまず、 + + 真ん中の部分 {' '} + に入っている数字が かどうか + + チェックします。 +

+ +

+ 真ん中の部分 {' '} + に入っている数字は なので、{' '} + + ではありません。 + +

+

+ このような場合、 + + 上の {' '} + に入っている数字が最終的に残ります。 + +

+ +

+ だから、 上の {' '} + に入っている が残る、というわけです。 +

+ + + ) + }, + { + title: ( + <> + 真ん中が である場合 + + ), + content: ( + <> +

では、こちらの計算箱の場合はどうでしょう?

+ + + ) } ]} /> diff --git a/src/lib/runners/plbv.json b/src/lib/runners/plbv.json new file mode 100644 index 000000000..6d847fac0 --- /dev/null +++ b/src/lib/runners/plbv.json @@ -0,0 +1,73 @@ +{ + "expressionContainers": [ + { + "containerState": "ready", + "previouslyChangedExpressionState": "default", + "expression": { + "type": "conditional", + "state": "default", + "checkType": "isZero", + "condition": { + "name": "shorthandNumber", + "highlightType": "default", + "topLeftBadgeType": "none", + "bottomRightBadgeType": "none", + "type": "variable", + "argPriorityAgg": [], + "funcPriorityAgg": [], + "emphasizePriority": false, + "bound": true, + "shorthandNumber": 0 + }, + "trueCase": { + "name": "shorthandNumber", + "highlightType": "default", + "topLeftBadgeType": "none", + "bottomRightBadgeType": "none", + "type": "variable", + "argPriorityAgg": [], + "funcPriorityAgg": [ + 1 + ], + "emphasizePriority": false, + "bound": true, + "shorthandNumber": 5 + }, + "falseCase": { + "name": "shorthandNumber", + "highlightType": "default", + "topLeftBadgeType": "none", + "bottomRightBadgeType": "none", + "type": "variable", + "argPriorityAgg": [ + 1 + ], + "funcPriorityAgg": [], + "emphasizePriority": false, + "bound": true, + "shorthandNumber": 4 + }, + "priority": 1 + } + } + ], + "speed": 1, + "showOnlyFocused": false, + "hideControls": true, + "explanationsVisibility": "hidden", + "hidePriorities": true, + "variableSize": "lg", + "containerSize": "xxs", + "hidePlayButton": false, + "hideBottomRightBadges": false, + "skipToTheEnd": false, + "hideFuncUnboundBadgeOnExplanation": false, + "highlightOverridesCallArgAndFuncUnboundOnly": false, + "bottomRightBadgeOverrides": {}, + "highlightOverrides": {}, + "highlightOverrideActiveAfterStart": false, + "argPriorityAggHighlights": [], + "funcPriorityAggHighlights": [], + "highlightFunctions": false, + "superFastForward": false +} diff --git a/src/lib/runners/rjfy.json b/src/lib/runners/rjfy.json new file mode 100644 index 000000000..64804d1ed --- /dev/null +++ b/src/lib/runners/rjfy.json @@ -0,0 +1,74 @@ +{ + "expressionContainers": [ + { + "expression": { + "type": "conditional", + "state": "falseCaseActive", + "checkType": "isZero", + "condition": { + "name": "shorthandNumber", + "highlightType": "default", + "topLeftBadgeType": "none", + "bottomRightBadgeType": "none", + "type": "variable", + "argPriorityAgg": [], + "funcPriorityAgg": [], + "emphasizePriority": false, + "bound": true, + "shorthandNumber": 2 + }, + "trueCase": { + "name": "shorthandNumber", + "highlightType": "default", + "topLeftBadgeType": "none", + "bottomRightBadgeType": "none", + "type": "variable", + "argPriorityAgg": [], + "funcPriorityAgg": [ + 1 + ], + "emphasizePriority": false, + "bound": true, + "shorthandNumber": 3 + }, + "falseCase": { + "name": "shorthandNumber", + "highlightType": "default", + "topLeftBadgeType": "none", + "bottomRightBadgeType": "none", + "type": "variable", + "argPriorityAgg": [ + 1 + ], + "funcPriorityAgg": [], + "emphasizePriority": false, + "bound": true, + "shorthandNumber": 1 + }, + "priority": 1 + }, + "previouslyChangedExpressionState": "falseCaseActive", + "activePriority": 1, + "containerState": "stepped" + } + ], + "speed": 1, + "showOnlyFocused": false, + "hideControls": true, + "explanationsVisibility": "visible", + "hidePriorities": true, + "variableSize": "lg", + "containerSize": "xxs", + "hidePlayButton": false, + "hideBottomRightBadges": false, + "skipToTheEnd": false, + "hideFuncUnboundBadgeOnExplanation": false, + "highlightOverridesCallArgAndFuncUnboundOnly": false, + "bottomRightBadgeOverrides": {}, + "highlightOverrides": {}, + "highlightOverrideActiveAfterStart": false, + "argPriorityAggHighlights": [], + "funcPriorityAggHighlights": [], + "highlightFunctions": false, + "superFastForward": false +} diff --git a/src/lib/runners/toht.json b/src/lib/runners/toht.json new file mode 100644 index 000000000..e803c0014 --- /dev/null +++ b/src/lib/runners/toht.json @@ -0,0 +1,39 @@ +{ + "expressionContainers": [ + { + "containerState": "done", + "previouslyChangedExpressionState": "default", + "expression": { + "name": "shorthandNumber", + "highlightType": "default", + "topLeftBadgeType": "none", + "bottomRightBadgeType": "none", + "type": "variable", + "argPriorityAgg": [], + "funcPriorityAgg": [], + "emphasizePriority": false, + "bound": true, + "shorthandNumber": 1 + } + } + ], + "speed": 1, + "showOnlyFocused": false, + "hideControls": true, + "explanationsVisibility": "hidden", + "hidePriorities": true, + "variableSize": "lg", + "containerSize": "xxs", + "hidePlayButton": false, + "hideBottomRightBadges": false, + "skipToTheEnd": false, + "hideFuncUnboundBadgeOnExplanation": false, + "highlightOverridesCallArgAndFuncUnboundOnly": false, + "bottomRightBadgeOverrides": {}, + "highlightOverrides": {}, + "highlightOverrideActiveAfterStart": false, + "argPriorityAggHighlights": [], + "funcPriorityAggHighlights": [], + "highlightFunctions": false, + "superFastForward": false +} diff --git a/src/lib/runners/vozu.json b/src/lib/runners/vozu.json new file mode 100644 index 000000000..87d46375f --- /dev/null +++ b/src/lib/runners/vozu.json @@ -0,0 +1,74 @@ +{ + "expressionContainers": [ + { + "expression": { + "type": "conditional", + "state": "conditionActive", + "checkType": "isZero", + "condition": { + "name": "shorthandNumber", + "highlightType": "default", + "topLeftBadgeType": "none", + "bottomRightBadgeType": "none", + "type": "variable", + "argPriorityAgg": [], + "funcPriorityAgg": [], + "emphasizePriority": false, + "bound": true, + "shorthandNumber": 2 + }, + "trueCase": { + "name": "shorthandNumber", + "highlightType": "default", + "topLeftBadgeType": "none", + "bottomRightBadgeType": "none", + "type": "variable", + "argPriorityAgg": [], + "funcPriorityAgg": [ + 1 + ], + "emphasizePriority": false, + "bound": true, + "shorthandNumber": 3 + }, + "falseCase": { + "name": "shorthandNumber", + "highlightType": "default", + "topLeftBadgeType": "none", + "bottomRightBadgeType": "none", + "type": "variable", + "argPriorityAgg": [ + 1 + ], + "funcPriorityAgg": [], + "emphasizePriority": false, + "bound": true, + "shorthandNumber": 1 + }, + "priority": 1 + }, + "previouslyChangedExpressionState": "conditionActive", + "activePriority": 1, + "containerState": "stepped" + } + ], + "speed": 1, + "showOnlyFocused": false, + "hideControls": true, + "explanationsVisibility": "visible", + "hidePriorities": true, + "variableSize": "lg", + "containerSize": "xxs", + "hidePlayButton": false, + "hideBottomRightBadges": false, + "skipToTheEnd": false, + "hideFuncUnboundBadgeOnExplanation": false, + "highlightOverridesCallArgAndFuncUnboundOnly": false, + "bottomRightBadgeOverrides": {}, + "highlightOverrides": {}, + "highlightOverrideActiveAfterStart": false, + "argPriorityAggHighlights": [], + "funcPriorityAggHighlights": [], + "highlightFunctions": false, + "superFastForward": false +} From d56d8eda8f9be7ad60018c112cb7a9e5639a0758 Mon Sep 17 00:00:00 2001 From: Shu Uesugi Date: Wed, 26 Jun 2019 02:44:26 -0700 Subject: [PATCH 13/20] Update 1.v2.jp.tsx --- src/contents/1.v2.jp.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/contents/1.v2.jp.tsx b/src/contents/1.v2.jp.tsx index 7335f3be6..e59a14e4d 100644 --- a/src/contents/1.v2.jp.tsx +++ b/src/contents/1.v2.jp.tsx @@ -223,7 +223,7 @@ export default () => (

- このような場合、 + このように真ん中が ではない場合、 上の {' '} に入っている数字が最終的に残ります。 From 4987209220481093dde22f655a1c6ac8dfb76bd4 Mon Sep 17 00:00:00 2001 From: Shu Uesugi Date: Wed, 26 Jun 2019 10:30:28 -0700 Subject: [PATCH 14/20] Continue with 1 --- scripts/lib/runnerConfigs/guhy.ts | 10 +++++ scripts/lib/runnerConfigs/qcmh.ts | 10 +++++ scripts/lib/runnerConfigs/ymmm.ts | 3 +- src/components/H.tsx | 7 +++ src/components/Runners/Guhy.tsx | 8 ++++ src/components/Runners/Qcmh.tsx | 8 ++++ src/components/Runners/index.ts | 2 + src/contents/1.v2.jp.tsx | 39 ++++++++++++---- src/lib/runners/guhy.json | 74 +++++++++++++++++++++++++++++++ src/lib/runners/qcmh.json | 74 +++++++++++++++++++++++++++++++ src/lib/runners/ymmm.json | 3 ++ src/types/HTypes.ts | 1 + 12 files changed, 229 insertions(+), 10 deletions(-) create mode 100644 scripts/lib/runnerConfigs/guhy.ts create mode 100644 scripts/lib/runnerConfigs/qcmh.ts create mode 100644 src/components/Runners/Guhy.tsx create mode 100644 src/components/Runners/Qcmh.tsx create mode 100644 src/lib/runners/guhy.json create mode 100644 src/lib/runners/qcmh.json diff --git a/scripts/lib/runnerConfigs/guhy.ts b/scripts/lib/runnerConfigs/guhy.ts new file mode 100644 index 000000000..effefe19a --- /dev/null +++ b/scripts/lib/runnerConfigs/guhy.ts @@ -0,0 +1,10 @@ +import { ExpressionRunnerShorthandConfig } from '../expressionRunnerShorthandConfig' + +const config: ExpressionRunnerShorthandConfig = { + runner: 'simple', + lessonExpressionsKey: 'v2e1E11', + initialState: 'trueCaseActive', + explanationsVisibility: 'visible' +} + +export default config diff --git a/scripts/lib/runnerConfigs/qcmh.ts b/scripts/lib/runnerConfigs/qcmh.ts new file mode 100644 index 000000000..81ef53f1e --- /dev/null +++ b/scripts/lib/runnerConfigs/qcmh.ts @@ -0,0 +1,10 @@ +import { ExpressionRunnerShorthandConfig } from '../expressionRunnerShorthandConfig' + +const config: ExpressionRunnerShorthandConfig = { + runner: 'simple', + lessonExpressionsKey: 'v2e1E11', + initialState: 'conditionActive', + explanationsVisibility: 'visible' +} + +export default config diff --git a/scripts/lib/runnerConfigs/ymmm.ts b/scripts/lib/runnerConfigs/ymmm.ts index a3e6fd28b..e3db51d37 100644 --- a/scripts/lib/runnerConfigs/ymmm.ts +++ b/scripts/lib/runnerConfigs/ymmm.ts @@ -2,7 +2,8 @@ import { ExpressionRunnerShorthandConfig } from '../expressionRunnerShorthandCon const config: ExpressionRunnerShorthandConfig = { runner: 'simple', - lessonExpressionsKey: 'v2e1E8' + lessonExpressionsKey: 'v2e1E8', + caption: { name: 'conditionalMathBox' } } export default config diff --git a/src/components/H.tsx b/src/components/H.tsx index 30fdcd32b..09d0831df 100644 --- a/src/components/H.tsx +++ b/src/components/H.tsx @@ -1745,6 +1745,13 @@ const H = ({ args, highlightType, episodeNumberOverrides }: HProps) => { return <>割ったときの余り } } + if (args.name === 'conditionalMathBox') { + if (locale === 'en') { + return <>? + } else { + return <>条件分岐の計算箱 + } + } throw new Error() } diff --git a/src/components/Runners/Guhy.tsx b/src/components/Runners/Guhy.tsx new file mode 100644 index 000000000..f0590330a --- /dev/null +++ b/src/components/Runners/Guhy.tsx @@ -0,0 +1,8 @@ +import React from 'react' +import ExpressionRunnerPrecomputed from 'src/components/ExpressionRunnerPrecomputed' +import config from 'src/lib/runners/guhy.json' + +// @ts-ignore +const Guhy = () => + +export default Guhy diff --git a/src/components/Runners/Qcmh.tsx b/src/components/Runners/Qcmh.tsx new file mode 100644 index 000000000..1eb282fcb --- /dev/null +++ b/src/components/Runners/Qcmh.tsx @@ -0,0 +1,8 @@ +import React from 'react' +import ExpressionRunnerPrecomputed from 'src/components/ExpressionRunnerPrecomputed' +import config from 'src/lib/runners/qcmh.json' + +// @ts-ignore +const Qcmh = () => + +export default Qcmh diff --git a/src/components/Runners/index.ts b/src/components/Runners/index.ts index a777adc20..f02377507 100644 --- a/src/components/Runners/index.ts +++ b/src/components/Runners/index.ts @@ -85,6 +85,7 @@ export { default as Gszp } from 'src/components/Runners/Gszp' export { default as Gtdu } from 'src/components/Runners/Gtdu' export { default as Gtnr } from 'src/components/Runners/Gtnr' export { default as Gtwk } from 'src/components/Runners/Gtwk' +export { default as Guhy } from 'src/components/Runners/Guhy' export { default as Guuf } from 'src/components/Runners/Guuf' export { default as Gwtp } from 'src/components/Runners/Gwtp' export { default as Hbgo } from 'src/components/Runners/Hbgo' @@ -203,6 +204,7 @@ export { default as Psqo } from 'src/components/Runners/Psqo' export { default as Pzui } from 'src/components/Runners/Pzui' export { default as Pzvr } from 'src/components/Runners/Pzvr' export { default as Pzwe } from 'src/components/Runners/Pzwe' +export { default as Qcmh } from 'src/components/Runners/Qcmh' export { default as Qdkf } from 'src/components/Runners/Qdkf' export { default as Qgun } from 'src/components/Runners/Qgun' export { default as Qifg } from 'src/components/Runners/Qifg' diff --git a/src/contents/1.v2.jp.tsx b/src/contents/1.v2.jp.tsx index e59a14e4d..988e1b1a7 100644 --- a/src/contents/1.v2.jp.tsx +++ b/src/contents/1.v2.jp.tsx @@ -157,17 +157,17 @@ export default () => ( ) }, { - title: ( - <> - が3つある計算箱 - - ), + title: <>条件分岐の計算箱, content: ( <> -

次は、こちらの計算箱をご覧ください。

+

+ 次は、こちらの計算箱をご覧ください。この計算箱には「 + 条件分岐の計算箱 + 」という名がついており、名前の理由は後ほど説明します。 +

- この計算箱には + 「条件分岐の計算箱」には ハテナマーク {' '} が3つあり、それぞれ左端に違う色と、以下の三種類の印がついています @@ -207,7 +207,7 @@ export default () => ( content: ( <>

- この計算箱はまず、 + 「条件分岐の計算箱」はまず、 真ん中の部分 {' '} に入っている数字が かどうか @@ -246,8 +246,29 @@ export default () => ( ), content: ( <> -

では、こちらの計算箱の場合はどうでしょう?

+

+ では、こちらの「条件分岐の計算箱 + 」の場合はどうでしょう? +

+

+ こちらも、真ん中の数字が {' '} + かどうかチェックします。 +

+ +

+ 今回は真ん中が {' '} + ですね。この場合は前回と逆で、 + + 下の {' '} + に入っている数字が最終的に残ります。 + +

+ +

+ だから、下の {' '} + に入っている が残る、というわけです。 +

) } diff --git a/src/lib/runners/guhy.json b/src/lib/runners/guhy.json new file mode 100644 index 000000000..86ff23cae --- /dev/null +++ b/src/lib/runners/guhy.json @@ -0,0 +1,74 @@ +{ + "expressionContainers": [ + { + "expression": { + "type": "conditional", + "state": "trueCaseActive", + "checkType": "isZero", + "condition": { + "name": "shorthandNumber", + "highlightType": "default", + "topLeftBadgeType": "none", + "bottomRightBadgeType": "none", + "type": "variable", + "argPriorityAgg": [], + "funcPriorityAgg": [], + "emphasizePriority": false, + "bound": true, + "shorthandNumber": 0 + }, + "trueCase": { + "name": "shorthandNumber", + "highlightType": "default", + "topLeftBadgeType": "none", + "bottomRightBadgeType": "none", + "type": "variable", + "argPriorityAgg": [], + "funcPriorityAgg": [ + 1 + ], + "emphasizePriority": false, + "bound": true, + "shorthandNumber": 5 + }, + "falseCase": { + "name": "shorthandNumber", + "highlightType": "default", + "topLeftBadgeType": "none", + "bottomRightBadgeType": "none", + "type": "variable", + "argPriorityAgg": [ + 1 + ], + "funcPriorityAgg": [], + "emphasizePriority": false, + "bound": true, + "shorthandNumber": 4 + }, + "priority": 1 + }, + "previouslyChangedExpressionState": "trueCaseActive", + "activePriority": 1, + "containerState": "stepped" + } + ], + "speed": 1, + "showOnlyFocused": false, + "hideControls": true, + "explanationsVisibility": "visible", + "hidePriorities": true, + "variableSize": "lg", + "containerSize": "xxs", + "hidePlayButton": false, + "hideBottomRightBadges": false, + "skipToTheEnd": false, + "hideFuncUnboundBadgeOnExplanation": false, + "highlightOverridesCallArgAndFuncUnboundOnly": false, + "bottomRightBadgeOverrides": {}, + "highlightOverrides": {}, + "highlightOverrideActiveAfterStart": false, + "argPriorityAggHighlights": [], + "funcPriorityAggHighlights": [], + "highlightFunctions": false, + "superFastForward": false +} diff --git a/src/lib/runners/qcmh.json b/src/lib/runners/qcmh.json new file mode 100644 index 000000000..e53859159 --- /dev/null +++ b/src/lib/runners/qcmh.json @@ -0,0 +1,74 @@ +{ + "expressionContainers": [ + { + "expression": { + "type": "conditional", + "state": "conditionActive", + "checkType": "isZero", + "condition": { + "name": "shorthandNumber", + "highlightType": "default", + "topLeftBadgeType": "none", + "bottomRightBadgeType": "none", + "type": "variable", + "argPriorityAgg": [], + "funcPriorityAgg": [], + "emphasizePriority": false, + "bound": true, + "shorthandNumber": 0 + }, + "trueCase": { + "name": "shorthandNumber", + "highlightType": "default", + "topLeftBadgeType": "none", + "bottomRightBadgeType": "none", + "type": "variable", + "argPriorityAgg": [], + "funcPriorityAgg": [ + 1 + ], + "emphasizePriority": false, + "bound": true, + "shorthandNumber": 5 + }, + "falseCase": { + "name": "shorthandNumber", + "highlightType": "default", + "topLeftBadgeType": "none", + "bottomRightBadgeType": "none", + "type": "variable", + "argPriorityAgg": [ + 1 + ], + "funcPriorityAgg": [], + "emphasizePriority": false, + "bound": true, + "shorthandNumber": 4 + }, + "priority": 1 + }, + "previouslyChangedExpressionState": "conditionActive", + "activePriority": 1, + "containerState": "stepped" + } + ], + "speed": 1, + "showOnlyFocused": false, + "hideControls": true, + "explanationsVisibility": "visible", + "hidePriorities": true, + "variableSize": "lg", + "containerSize": "xxs", + "hidePlayButton": false, + "hideBottomRightBadges": false, + "skipToTheEnd": false, + "hideFuncUnboundBadgeOnExplanation": false, + "highlightOverridesCallArgAndFuncUnboundOnly": false, + "bottomRightBadgeOverrides": {}, + "highlightOverrides": {}, + "highlightOverrideActiveAfterStart": false, + "argPriorityAggHighlights": [], + "funcPriorityAggHighlights": [], + "highlightFunctions": false, + "superFastForward": false +} diff --git a/src/lib/runners/ymmm.json b/src/lib/runners/ymmm.json index 5a21daca7..4c106e8b0 100644 --- a/src/lib/runners/ymmm.json +++ b/src/lib/runners/ymmm.json @@ -50,6 +50,9 @@ ], "speed": 1, "showOnlyFocused": false, + "caption": { + "name": "conditionalMathBox" + }, "hideControls": true, "explanationsVisibility": "hidden", "hidePriorities": true, diff --git a/src/types/HTypes.ts b/src/types/HTypes.ts index 46f55f1c2..40f5f722e 100644 --- a/src/types/HTypes.ts +++ b/src/types/HTypes.ts @@ -126,4 +126,5 @@ export interface HProps { | { name: 'mentionRightArrow' } | { name: 'addMathBox' } | { name: 'remainder' } + | { name: 'conditionalMathBox' } } From 9d67c6871b4a36cc1b73879258059dd0280cab02 Mon Sep 17 00:00:00 2001 From: Shu Uesugi Date: Wed, 26 Jun 2019 10:44:31 -0700 Subject: [PATCH 15/20] Continue with 1 --- src/contents/1.v2.jp.tsx | 62 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 60 insertions(+), 2 deletions(-) diff --git a/src/contents/1.v2.jp.tsx b/src/contents/1.v2.jp.tsx index 988e1b1a7..f9e2bb964 100644 --- a/src/contents/1.v2.jp.tsx +++ b/src/contents/1.v2.jp.tsx @@ -1,5 +1,12 @@ import React from 'react' -import { P, Strong, Em, InlineHeader } from 'src/components/ContentTags' +import { + P, + Strong, + Em, + InlineHeader, + Ul, + UlLi +} from 'src/components/ContentTags' import EpisodeCardList from 'src/components/EpisodeCardList' import H from 'src/components/H' import EmojiSeparator from 'src/components/EmojiSeparator' @@ -175,7 +182,7 @@ export default () => ( 。いったいどんな計算ができるのでしょう? 🤔

- +

とりあえず、{' '} @@ -271,6 +278,57 @@ export default () => (

) + }, + { + type: 'summary', + title: ( + <> + + + ), + content: ( + <> +

+ まとめると、この「条件分岐の計算箱 + 」の法則は以下の通りです。 +

+ +

+ + まず、真ん中の {' '} + の中にある数字が {' '} + かどうかチェックします。 + +

+
    + + + もし なら、 下の{' '} + {' '} + の中にある数字が残ります。 + + + + + もし でなければ、 上の{' '} + {' '} + の中にある数字が残ります。 + + +
+ +

+ 「 + + 真ん中が かどうか? + + 」という「 + 条件」によって、上下に「 + 分岐」するので、「条件分岐 + の計算箱」という名前がついているのです。 +

+ + ) } ]} /> From 326de9126905d4c73a6cd2b2955817ff1f53bded Mon Sep 17 00:00:00 2001 From: Shu Uesugi Date: Wed, 26 Jun 2019 11:05:30 -0700 Subject: [PATCH 16/20] Continue with 1 --- src/contents/1.v2.jp.tsx | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/contents/1.v2.jp.tsx b/src/contents/1.v2.jp.tsx index f9e2bb964..fadf2784a 100644 --- a/src/contents/1.v2.jp.tsx +++ b/src/contents/1.v2.jp.tsx @@ -182,7 +182,7 @@ export default () => ( 。いったいどんな計算ができるのでしょう? 🤔

- +

とりあえず、{' '} @@ -316,7 +316,7 @@ export default () => ( - +

@@ -329,6 +329,21 @@ export default () => (

) + }, + { + title: <>何の役に立つの?, + content: ( + <> +

+ では、 + + この条件分岐の計算箱はいったい何の役に立つのでしょうか? + + 人々は、条件分岐の計算箱をどんな用途で使っていたのでしょう? +

+ + + ) } ]} /> From dd04e9a80002405a22199e39038f1fc262cb0e99 Mon Sep 17 00:00:00 2001 From: Shu Uesugi Date: Wed, 26 Jun 2019 11:35:55 -0700 Subject: [PATCH 17/20] Continue with 1 --- scripts/copyUsedEmojis.ts | 3 ++- src/components/ContentTags/Hr.tsx | 2 +- src/components/Twemoji/1f5d3.tsx | 29 ++++++++++++++++++++++ src/contents/1.v2.jp.tsx | 41 +++++++++++++++++++++++++++++++ src/lib/emojisBundle.tsx | 2 ++ 5 files changed, 75 insertions(+), 2 deletions(-) create mode 100644 src/components/Twemoji/1f5d3.tsx diff --git a/scripts/copyUsedEmojis.ts b/scripts/copyUsedEmojis.ts index 1ab7d717b..77226471b 100644 --- a/scripts/copyUsedEmojis.ts +++ b/scripts/copyUsedEmojis.ts @@ -105,7 +105,8 @@ const allUsedEmojis = uniq([ '🔠', '🐍', '💡', - '🎁' + '🎁', + '🗓' ]) // Copied from Twemoji diff --git a/src/components/ContentTags/Hr.tsx b/src/components/ContentTags/Hr.tsx index 0336b42d5..593ccf723 100644 --- a/src/components/ContentTags/Hr.tsx +++ b/src/components/ContentTags/Hr.tsx @@ -5,7 +5,7 @@ export const Hr = styled.hr` border-top: none; border-left: none; border-right: none; - border-bottom: 3px solid ${colors('white')}; + border-bottom: 5px solid ${colors('white')}; margin: ${spaces(2)} auto ${spaces(2)}; max-width: ${maxWidths('xxxs')}; ` diff --git a/src/components/Twemoji/1f5d3.tsx b/src/components/Twemoji/1f5d3.tsx new file mode 100644 index 000000000..89a5639c3 --- /dev/null +++ b/src/components/Twemoji/1f5d3.tsx @@ -0,0 +1,29 @@ +import * as React from 'react' + +const Svg1F5D3 = (props: React.SVGProps) => ( + + + + + + + + +) + +export default Svg1F5D3 diff --git a/src/contents/1.v2.jp.tsx b/src/contents/1.v2.jp.tsx index fadf2784a..ffd007a42 100644 --- a/src/contents/1.v2.jp.tsx +++ b/src/contents/1.v2.jp.tsx @@ -342,8 +342,49 @@ export default () => ( 人々は、条件分岐の計算箱をどんな用途で使っていたのでしょう?

+

というわけで、条件分岐の計算箱の具体的な使用例を紹介します!

) + }, + { + title: <>2月には何日ある?, + content: ( + <> +

+ 人々は毎年、ある疑問に悩まされていました。それは、「 + 今年の2月には何日あるんだろう?」という疑問です。 +

+ +

答えはもちろん、以下の通りです。

+
    + + + うるう年の場合、2月には29日ある。 + + + + + それ以外の年の場合、2月には28日ある。 + + +
+

+ では、 + + うるう年かどうかを判別するにはどうすればいいでしょう? + +

+ +

+ うるう年は、基本的に「4で割り切れる年 + 」です。たとえば東京オリンピックが行われる2020年は、2020が4で割り切れるのでうるう年となります。ちなみに例外もありますが、後に説明します。 +

+ + ) + }, + { + title: <>計算箱を使うと, + content: <> } ]} /> diff --git a/src/lib/emojisBundle.tsx b/src/lib/emojisBundle.tsx index b53759526..e51d7a2a2 100644 --- a/src/lib/emojisBundle.tsx +++ b/src/lib/emojisBundle.tsx @@ -57,6 +57,7 @@ import Emoji1f50e from 'src/components/Twemoji/1f50e' import Emoji1f520 from 'src/components/Twemoji/1f520' import Emoji1f522 from 'src/components/Twemoji/1f522' import Emoji1f53d from 'src/components/Twemoji/1f53d' +import Emoji1f5d3 from 'src/components/Twemoji/1f5d3' import Emoji1f5fa from 'src/components/Twemoji/1f5fa' import Emoji1f604 from 'src/components/Twemoji/1f604' import Emoji1f605 from 'src/components/Twemoji/1f605' @@ -189,6 +190,7 @@ export default { '1f520': Emoji1f520, '1f522': Emoji1f522, '1f53d': Emoji1f53d, + '1f5d3': Emoji1f5d3, '1f5fa': Emoji1f5fa, '1f604': Emoji1f604, '1f605': Emoji1f605, From fe859d0203ac1a80d51671b53b6e91488f3c2507 Mon Sep 17 00:00:00 2001 From: Shu Uesugi Date: Wed, 26 Jun 2019 12:20:15 -0700 Subject: [PATCH 18/20] Continue with 1 --- scripts/lib/lessonExpressions.ts | 33 ++++++++++++ scripts/lib/runnerConfigs/atkh.ts | 8 +++ scripts/lib/runnerConfigs/gruv.ts | 8 +++ scripts/lib/runnerConfigs/lbua.ts | 8 +++ src/components/Runners/Atkh.tsx | 8 +++ src/components/Runners/Gruv.tsx | 8 +++ src/components/Runners/Lbua.tsx | 8 +++ src/components/Runners/index.ts | 3 ++ src/components/Twemoji/39-20e3.tsx | 16 ++++++ src/contents/1.v2.jp.tsx | 40 ++++++++++++++- src/lib/emojisBundle.tsx | 4 +- src/lib/numberEmojiMapping.ts | 4 +- src/lib/numberEmojiMappingJson.json | 3 +- src/lib/runners/atkh.json | 79 ++++++++++++++++++++++++++++ src/lib/runners/gruv.json | 80 +++++++++++++++++++++++++++++ src/lib/runners/lbua.json | 39 ++++++++++++++ 16 files changed, 345 insertions(+), 4 deletions(-) create mode 100644 scripts/lib/runnerConfigs/atkh.ts create mode 100644 scripts/lib/runnerConfigs/gruv.ts create mode 100644 scripts/lib/runnerConfigs/lbua.ts create mode 100644 src/components/Runners/Atkh.tsx create mode 100644 src/components/Runners/Gruv.tsx create mode 100644 src/components/Runners/Lbua.tsx create mode 100644 src/components/Twemoji/39-20e3.tsx create mode 100644 src/lib/runners/atkh.json create mode 100644 src/lib/runners/gruv.json create mode 100644 src/lib/runners/lbua.json diff --git a/scripts/lib/lessonExpressions.ts b/scripts/lib/lessonExpressions.ts index 63af3ded5..87fdddba3 100644 --- a/scripts/lib/lessonExpressions.ts +++ b/scripts/lib/lessonExpressions.ts @@ -1075,3 +1075,36 @@ export const v2e1E11 = initializeExpressionContainer({ shorthandNumber: 4 } }) + +export const v2e1E12 = initializeExpressionContainer([ + { + shorthandNumber: 4 + }, + [ + { + shorthandBinary: 'remainder' + }, + 'questionV2' + ] +]) + +export const v2e1E13 = initializeExpressionContainer([ + { + shorthandNumber: 4 + }, + [ + { + shorthandBinary: 'remainder' + }, + { + shorthandNumber: 2020 + } + ] +]) + +export const v2e1E14: ContainerWithState<'done'> = { + ...initializeExpressionContainer({ + shorthandNumber: 0 + }), + containerState: 'done' +} diff --git a/scripts/lib/runnerConfigs/atkh.ts b/scripts/lib/runnerConfigs/atkh.ts new file mode 100644 index 000000000..481ca9fe0 --- /dev/null +++ b/scripts/lib/runnerConfigs/atkh.ts @@ -0,0 +1,8 @@ +import { ExpressionRunnerShorthandConfig } from '../expressionRunnerShorthandConfig' + +const config: ExpressionRunnerShorthandConfig = { + runner: 'simple', + lessonExpressionsKey: 'v2e1E12' +} + +export default config diff --git a/scripts/lib/runnerConfigs/gruv.ts b/scripts/lib/runnerConfigs/gruv.ts new file mode 100644 index 000000000..dc51abc70 --- /dev/null +++ b/scripts/lib/runnerConfigs/gruv.ts @@ -0,0 +1,8 @@ +import { ExpressionRunnerShorthandConfig } from '../expressionRunnerShorthandConfig' + +const config: ExpressionRunnerShorthandConfig = { + runner: 'simple', + lessonExpressionsKey: 'v2e1E13' +} + +export default config diff --git a/scripts/lib/runnerConfigs/lbua.ts b/scripts/lib/runnerConfigs/lbua.ts new file mode 100644 index 000000000..4992d5b28 --- /dev/null +++ b/scripts/lib/runnerConfigs/lbua.ts @@ -0,0 +1,8 @@ +import { ExpressionRunnerShorthandConfig } from '../expressionRunnerShorthandConfig' + +const config: ExpressionRunnerShorthandConfig = { + runner: 'simple', + lessonExpressionsKey: 'v2e1E14' +} + +export default config diff --git a/src/components/Runners/Atkh.tsx b/src/components/Runners/Atkh.tsx new file mode 100644 index 000000000..67dd2047d --- /dev/null +++ b/src/components/Runners/Atkh.tsx @@ -0,0 +1,8 @@ +import React from 'react' +import ExpressionRunnerPrecomputed from 'src/components/ExpressionRunnerPrecomputed' +import config from 'src/lib/runners/atkh.json' + +// @ts-ignore +const Atkh = () => + +export default Atkh diff --git a/src/components/Runners/Gruv.tsx b/src/components/Runners/Gruv.tsx new file mode 100644 index 000000000..e3b22aca3 --- /dev/null +++ b/src/components/Runners/Gruv.tsx @@ -0,0 +1,8 @@ +import React from 'react' +import ExpressionRunnerPrecomputed from 'src/components/ExpressionRunnerPrecomputed' +import config from 'src/lib/runners/gruv.json' + +// @ts-ignore +const Gruv = () => + +export default Gruv diff --git a/src/components/Runners/Lbua.tsx b/src/components/Runners/Lbua.tsx new file mode 100644 index 000000000..096b6030e --- /dev/null +++ b/src/components/Runners/Lbua.tsx @@ -0,0 +1,8 @@ +import React from 'react' +import ExpressionRunnerPrecomputed from 'src/components/ExpressionRunnerPrecomputed' +import config from 'src/lib/runners/lbua.json' + +// @ts-ignore +const Lbua = () => + +export default Lbua diff --git a/src/components/Runners/index.ts b/src/components/Runners/index.ts index f02377507..9173e1ab5 100644 --- a/src/components/Runners/index.ts +++ b/src/components/Runners/index.ts @@ -6,6 +6,7 @@ export { default as Ahsd } from 'src/components/Runners/Ahsd' export { default as Aimh } from 'src/components/Runners/Aimh' export { default as Ainx } from 'src/components/Runners/Ainx' export { default as Angp } from 'src/components/Runners/Angp' +export { default as Atkh } from 'src/components/Runners/Atkh' export { default as Awxz } from 'src/components/Runners/Awxz' export { default as Badn } from 'src/components/Runners/Badn' export { default as Bcae } from 'src/components/Runners/Bcae' @@ -80,6 +81,7 @@ export { default as Gcnt } from 'src/components/Runners/Gcnt' export { default as Gmcn } from 'src/components/Runners/Gmcn' export { default as Goif } from 'src/components/Runners/Goif' export { default as Gopk } from 'src/components/Runners/Gopk' +export { default as Gruv } from 'src/components/Runners/Gruv' export { default as Gswd } from 'src/components/Runners/Gswd' export { default as Gszp } from 'src/components/Runners/Gszp' export { default as Gtdu } from 'src/components/Runners/Gtdu' @@ -145,6 +147,7 @@ export { default as Ktyt } from 'src/components/Runners/Ktyt' export { default as Kupy } from 'src/components/Runners/Kupy' export { default as Kvso } from 'src/components/Runners/Kvso' export { default as Laea } from 'src/components/Runners/Laea' +export { default as Lbua } from 'src/components/Runners/Lbua' export { default as Ldox } from 'src/components/Runners/Ldox' export { default as Ldts } from 'src/components/Runners/Ldts' export { default as Lial } from 'src/components/Runners/Lial' diff --git a/src/components/Twemoji/39-20e3.tsx b/src/components/Twemoji/39-20e3.tsx new file mode 100644 index 000000000..a7210fbe8 --- /dev/null +++ b/src/components/Twemoji/39-20e3.tsx @@ -0,0 +1,16 @@ +import * as React from 'react' + +const Svg3920E3 = (props: React.SVGProps) => ( + + + + +) + +export default Svg3920E3 diff --git a/src/contents/1.v2.jp.tsx b/src/contents/1.v2.jp.tsx index ffd007a42..da176decc 100644 --- a/src/contents/1.v2.jp.tsx +++ b/src/contents/1.v2.jp.tsx @@ -10,6 +10,7 @@ import { import EpisodeCardList from 'src/components/EpisodeCardList' import H from 'src/components/H' import EmojiSeparator from 'src/components/EmojiSeparator' +import ExpressionRunnerSeparator from 'src/components/ExpressionRunnerSeparator' import Emoji from 'src/components/Emoji' import EmojiNumber from 'src/components/EmojiNumber' import * as R from 'src/components/Runners' @@ -384,7 +385,44 @@ export default () => ( }, { title: <>計算箱を使うと, - content: <> + content: ( + <> +

+ + 人々は計算が苦手だったので、計算箱を使って「 + 2月に何日あるか」を計算しようと試みました + + 。🤔 +

+ +

+ まず、「 + 年の数を、4で割った余り + 」を計算する計算箱はこちらです。 +

+ +

+ たとえば、 の部分に {' '} + を入れて + + すると、 + で割り切れるので、 + が残ります。 +

+ + + +

+ 次に、「 + 年の数を、4で割った余り + 」を計算する計算箱を、 + + 条件分岐の計算箱の真ん中の部分{' '} + に入れます。 + +

+ + ) } ]} /> diff --git a/src/lib/emojisBundle.tsx b/src/lib/emojisBundle.tsx index e51d7a2a2..d2cebdcfc 100644 --- a/src/lib/emojisBundle.tsx +++ b/src/lib/emojisBundle.tsx @@ -130,6 +130,7 @@ import Emoji34ZZ20e3 from 'src/components/Twemoji/34-20e3' import Emoji35ZZ20e3 from 'src/components/Twemoji/35-20e3' import Emoji36ZZ20e3 from 'src/components/Twemoji/36-20e3' import Emoji38ZZ20e3 from 'src/components/Twemoji/38-20e3' +import Emoji39ZZ20e3 from 'src/components/Twemoji/39-20e3' export default { '1f170': Emoji1f170, @@ -262,5 +263,6 @@ export default { '34-20e3': Emoji34ZZ20e3, '35-20e3': Emoji35ZZ20e3, '36-20e3': Emoji36ZZ20e3, - '38-20e3': Emoji38ZZ20e3 + '38-20e3': Emoji38ZZ20e3, + '39-20e3': Emoji39ZZ20e3 } diff --git a/src/lib/numberEmojiMapping.ts b/src/lib/numberEmojiMapping.ts index e496b3354..291c99316 100644 --- a/src/lib/numberEmojiMapping.ts +++ b/src/lib/numberEmojiMapping.ts @@ -5,7 +5,9 @@ const numberEmojiMapping: Record = jsonMapping export const numberEmojiMappingMultipleDigits: Record = { 24: ['2️⃣', '4️⃣'], 16: ['1️⃣', '6️⃣'], - 120: ['1️⃣', '2️⃣', '0️⃣'] + 120: ['1️⃣', '2️⃣', '0️⃣'], + 2019: ['2️⃣', '0️⃣', '1️⃣', '9️⃣'], + 2020: ['2️⃣', '0️⃣', '2️⃣', '0️⃣'] } export default numberEmojiMapping diff --git a/src/lib/numberEmojiMappingJson.json b/src/lib/numberEmojiMappingJson.json index adec3a0fa..a78069c12 100644 --- a/src/lib/numberEmojiMappingJson.json +++ b/src/lib/numberEmojiMappingJson.json @@ -6,5 +6,6 @@ "4": "4️⃣", "5": "5️⃣", "6": "6️⃣", - "8": "8️⃣" + "8": "8️⃣", + "9": "9️⃣" } diff --git a/src/lib/runners/atkh.json b/src/lib/runners/atkh.json new file mode 100644 index 000000000..a71411edc --- /dev/null +++ b/src/lib/runners/atkh.json @@ -0,0 +1,79 @@ +{ + "expressionContainers": [ + { + "containerState": "ready", + "previouslyChangedExpressionState": "default", + "expression": { + "arg": { + "arg": { + "name": "questionV2", + "highlightType": "default", + "topLeftBadgeType": "none", + "bottomRightBadgeType": "none", + "type": "variable", + "argPriorityAgg": [ + 1, + 2 + ], + "funcPriorityAgg": [], + "emphasizePriority": false, + "bound": true + }, + "func": { + "name": "shorthandBinary", + "highlightType": "default", + "topLeftBadgeType": "none", + "bottomRightBadgeType": "none", + "type": "variable", + "argPriorityAgg": [], + "funcPriorityAgg": [ + 2 + ], + "emphasizePriority": false, + "bound": true, + "shorthandBinary": "remainder" + }, + "state": "default", + "type": "call", + "priority": 2 + }, + "func": { + "name": "shorthandNumber", + "highlightType": "default", + "topLeftBadgeType": "none", + "bottomRightBadgeType": "none", + "type": "variable", + "argPriorityAgg": [], + "funcPriorityAgg": [ + 1 + ], + "emphasizePriority": false, + "bound": true, + "shorthandNumber": 4 + }, + "state": "default", + "type": "call", + "priority": 1 + } + } + ], + "speed": 1, + "showOnlyFocused": false, + "hideControls": true, + "explanationsVisibility": "hidden", + "hidePriorities": true, + "variableSize": "lg", + "containerSize": "xxs", + "hidePlayButton": false, + "hideBottomRightBadges": false, + "skipToTheEnd": false, + "hideFuncUnboundBadgeOnExplanation": false, + "highlightOverridesCallArgAndFuncUnboundOnly": false, + "bottomRightBadgeOverrides": {}, + "highlightOverrides": {}, + "highlightOverrideActiveAfterStart": false, + "argPriorityAggHighlights": [], + "funcPriorityAggHighlights": [], + "highlightFunctions": false, + "superFastForward": false +} diff --git a/src/lib/runners/gruv.json b/src/lib/runners/gruv.json new file mode 100644 index 000000000..c0f5a2fc9 --- /dev/null +++ b/src/lib/runners/gruv.json @@ -0,0 +1,80 @@ +{ + "expressionContainers": [ + { + "containerState": "ready", + "previouslyChangedExpressionState": "default", + "expression": { + "arg": { + "arg": { + "name": "shorthandNumber", + "highlightType": "default", + "topLeftBadgeType": "none", + "bottomRightBadgeType": "none", + "type": "variable", + "argPriorityAgg": [ + 1, + 2 + ], + "funcPriorityAgg": [], + "emphasizePriority": false, + "bound": true, + "shorthandNumber": 2020 + }, + "func": { + "name": "shorthandBinary", + "highlightType": "default", + "topLeftBadgeType": "none", + "bottomRightBadgeType": "none", + "type": "variable", + "argPriorityAgg": [], + "funcPriorityAgg": [ + 2 + ], + "emphasizePriority": false, + "bound": true, + "shorthandBinary": "remainder" + }, + "state": "default", + "type": "call", + "priority": 2 + }, + "func": { + "name": "shorthandNumber", + "highlightType": "default", + "topLeftBadgeType": "none", + "bottomRightBadgeType": "none", + "type": "variable", + "argPriorityAgg": [], + "funcPriorityAgg": [ + 1 + ], + "emphasizePriority": false, + "bound": true, + "shorthandNumber": 4 + }, + "state": "default", + "type": "call", + "priority": 1 + } + } + ], + "speed": 1, + "showOnlyFocused": false, + "hideControls": true, + "explanationsVisibility": "hidden", + "hidePriorities": true, + "variableSize": "lg", + "containerSize": "xxs", + "hidePlayButton": false, + "hideBottomRightBadges": false, + "skipToTheEnd": false, + "hideFuncUnboundBadgeOnExplanation": false, + "highlightOverridesCallArgAndFuncUnboundOnly": false, + "bottomRightBadgeOverrides": {}, + "highlightOverrides": {}, + "highlightOverrideActiveAfterStart": false, + "argPriorityAggHighlights": [], + "funcPriorityAggHighlights": [], + "highlightFunctions": false, + "superFastForward": false +} diff --git a/src/lib/runners/lbua.json b/src/lib/runners/lbua.json new file mode 100644 index 000000000..4d464b4ee --- /dev/null +++ b/src/lib/runners/lbua.json @@ -0,0 +1,39 @@ +{ + "expressionContainers": [ + { + "containerState": "done", + "previouslyChangedExpressionState": "default", + "expression": { + "name": "shorthandNumber", + "highlightType": "default", + "topLeftBadgeType": "none", + "bottomRightBadgeType": "none", + "type": "variable", + "argPriorityAgg": [], + "funcPriorityAgg": [], + "emphasizePriority": false, + "bound": true, + "shorthandNumber": 0 + } + } + ], + "speed": 1, + "showOnlyFocused": false, + "hideControls": true, + "explanationsVisibility": "hidden", + "hidePriorities": true, + "variableSize": "lg", + "containerSize": "xxs", + "hidePlayButton": false, + "hideBottomRightBadges": false, + "skipToTheEnd": false, + "hideFuncUnboundBadgeOnExplanation": false, + "highlightOverridesCallArgAndFuncUnboundOnly": false, + "bottomRightBadgeOverrides": {}, + "highlightOverrides": {}, + "highlightOverrideActiveAfterStart": false, + "argPriorityAggHighlights": [], + "funcPriorityAggHighlights": [], + "highlightFunctions": false, + "superFastForward": false +} From 35ac621323cf06e5ed8e9cd8748d4d93f02bc71b Mon Sep 17 00:00:00 2001 From: Shu Uesugi Date: Thu, 27 Jun 2019 13:36:41 -0700 Subject: [PATCH 19/20] Finish new episode 1 --- scripts/lib/lessonExpressions.ts | 20 ++ scripts/lib/runnerConfigs/novg.ts | 8 + scripts/lib/runnerConfigs/qscy.ts | 10 + scripts/lib/runnerConfigs/sewk.ts | 8 + scripts/lib/runnerConfigs/sffm.ts | 8 + src/components/H.tsx | 21 ++ src/components/Runners/Novg.tsx | 8 + src/components/Runners/Qscy.tsx | 8 + src/components/Runners/Sewk.tsx | 8 + src/components/Runners/Sffm.tsx | 8 + src/components/Runners/index.ts | 4 + src/components/VariableExpressionBox.tsx | 2 +- src/contents/1.v2.jp.tsx | 113 +++--- src/contents/2.v2.jp.tsx | 438 +++-------------------- src/lib/numberEmojiMapping.ts | 2 + src/lib/runners/novg.json | 39 ++ src/lib/runners/qscy.json | 74 ++++ src/lib/runners/sewk.json | 89 +++++ src/lib/runners/sffm.json | 73 ++++ src/types/HTypes.ts | 2 + 20 files changed, 498 insertions(+), 445 deletions(-) create mode 100644 scripts/lib/runnerConfigs/novg.ts create mode 100644 scripts/lib/runnerConfigs/qscy.ts create mode 100644 scripts/lib/runnerConfigs/sewk.ts create mode 100644 scripts/lib/runnerConfigs/sffm.ts create mode 100644 src/components/Runners/Novg.tsx create mode 100644 src/components/Runners/Qscy.tsx create mode 100644 src/components/Runners/Sewk.tsx create mode 100644 src/components/Runners/Sffm.tsx create mode 100644 src/lib/runners/novg.json create mode 100644 src/lib/runners/qscy.json create mode 100644 src/lib/runners/sewk.json create mode 100644 src/lib/runners/sffm.json diff --git a/scripts/lib/lessonExpressions.ts b/scripts/lib/lessonExpressions.ts index 87fdddba3..0d2953e94 100644 --- a/scripts/lib/lessonExpressions.ts +++ b/scripts/lib/lessonExpressions.ts @@ -1108,3 +1108,23 @@ export const v2e1E14: ContainerWithState<'done'> = { }), containerState: 'done' } + +export const v2e1E15 = initializeExpressionContainer({ + checkType: 'isZero', + condition: { + shorthandNumber: 0 + }, + trueCase: { + shorthandNumber: 29 + }, + falseCase: { + shorthandNumber: 28 + } +}) + +export const v2e1E16: ContainerWithState<'done'> = { + ...initializeExpressionContainer({ + shorthandNumber: 28 + }), + containerState: 'done' +} diff --git a/scripts/lib/runnerConfigs/novg.ts b/scripts/lib/runnerConfigs/novg.ts new file mode 100644 index 000000000..df3da2c75 --- /dev/null +++ b/scripts/lib/runnerConfigs/novg.ts @@ -0,0 +1,8 @@ +import { ExpressionRunnerShorthandConfig } from '../expressionRunnerShorthandConfig' + +const config: ExpressionRunnerShorthandConfig = { + runner: 'simple', + lessonExpressionsKey: 'v2e1E16' +} + +export default config diff --git a/scripts/lib/runnerConfigs/qscy.ts b/scripts/lib/runnerConfigs/qscy.ts new file mode 100644 index 000000000..f7565af9f --- /dev/null +++ b/scripts/lib/runnerConfigs/qscy.ts @@ -0,0 +1,10 @@ +import { ExpressionRunnerShorthandConfig } from '../expressionRunnerShorthandConfig' + +const config: ExpressionRunnerShorthandConfig = { + runner: 'simple', + lessonExpressionsKey: 'v2e1E15', + explanationsVisibility: 'visible', + initialState: 'trueCaseActive' +} + +export default config diff --git a/scripts/lib/runnerConfigs/sewk.ts b/scripts/lib/runnerConfigs/sewk.ts new file mode 100644 index 000000000..419ec5281 --- /dev/null +++ b/scripts/lib/runnerConfigs/sewk.ts @@ -0,0 +1,8 @@ +import { ExpressionRunnerShorthandConfig } from '../expressionRunnerShorthandConfig' + +const config: ExpressionRunnerShorthandConfig = { + runner: 'playButtonOnly', + lessonExpressionsKey: 'v2e1E15' +} + +export default config diff --git a/scripts/lib/runnerConfigs/sffm.ts b/scripts/lib/runnerConfigs/sffm.ts new file mode 100644 index 000000000..cdd65dd22 --- /dev/null +++ b/scripts/lib/runnerConfigs/sffm.ts @@ -0,0 +1,8 @@ +import { ExpressionRunnerShorthandConfig } from '../expressionRunnerShorthandConfig' + +const config: ExpressionRunnerShorthandConfig = { + runner: 'simple', + lessonExpressionsKey: 'v2e1E15' +} + +export default config diff --git a/src/components/H.tsx b/src/components/H.tsx index 09d0831df..555939b24 100644 --- a/src/components/H.tsx +++ b/src/components/H.tsx @@ -753,6 +753,13 @@ const H = ({ args, highlightType, episodeNumberOverrides }: HProps) => { return <>こちらの弁当箱をご覧ください } } + if (args.name === 'lookAtThisMathBox') { + if (locale === 'en') { + return <>… + } else { + return <>こちらの計算箱をご覧ください + } + } if (args.name === 'pauseIfLost') { if (locale === 'en') { return <>… @@ -1752,6 +1759,20 @@ const H = ({ args, highlightType, episodeNumberOverrides }: HProps) => { return <>条件分岐の計算箱 } } + if (args.name === 'whatHappensAtTheEndMathBoxQuestion') { + if (locale === 'en') { + return <>? + } else { + return ( + <> + 上の計算箱を + + すると、最終的に下のようになるでしょうか?{' '} + 🤔 + + ) + } + } throw new Error() } diff --git a/src/components/Runners/Novg.tsx b/src/components/Runners/Novg.tsx new file mode 100644 index 000000000..7ddee883d --- /dev/null +++ b/src/components/Runners/Novg.tsx @@ -0,0 +1,8 @@ +import React from 'react' +import ExpressionRunnerPrecomputed from 'src/components/ExpressionRunnerPrecomputed' +import config from 'src/lib/runners/novg.json' + +// @ts-ignore +const Novg = () => + +export default Novg diff --git a/src/components/Runners/Qscy.tsx b/src/components/Runners/Qscy.tsx new file mode 100644 index 000000000..bb9eae689 --- /dev/null +++ b/src/components/Runners/Qscy.tsx @@ -0,0 +1,8 @@ +import React from 'react' +import ExpressionRunnerPrecomputed from 'src/components/ExpressionRunnerPrecomputed' +import config from 'src/lib/runners/qscy.json' + +// @ts-ignore +const Qscy = () => + +export default Qscy diff --git a/src/components/Runners/Sewk.tsx b/src/components/Runners/Sewk.tsx new file mode 100644 index 000000000..b4a9ac558 --- /dev/null +++ b/src/components/Runners/Sewk.tsx @@ -0,0 +1,8 @@ +import React from 'react' +import ExpressionRunnerPrecomputed from 'src/components/ExpressionRunnerPrecomputed' +import config from 'src/lib/runners/sewk.json' + +// @ts-ignore +const Sewk = () => + +export default Sewk diff --git a/src/components/Runners/Sffm.tsx b/src/components/Runners/Sffm.tsx new file mode 100644 index 000000000..f90793bec --- /dev/null +++ b/src/components/Runners/Sffm.tsx @@ -0,0 +1,8 @@ +import React from 'react' +import ExpressionRunnerPrecomputed from 'src/components/ExpressionRunnerPrecomputed' +import config from 'src/lib/runners/sffm.json' + +// @ts-ignore +const Sffm = () => + +export default Sffm diff --git a/src/components/Runners/index.ts b/src/components/Runners/index.ts index 9173e1ab5..9b2f18e90 100644 --- a/src/components/Runners/index.ts +++ b/src/components/Runners/index.ts @@ -182,6 +182,7 @@ export { default as Nlfx } from 'src/components/Runners/Nlfx' export { default as Nlxe } from 'src/components/Runners/Nlxe' export { default as Nmoc } from 'src/components/Runners/Nmoc' export { default as Nnhc } from 'src/components/Runners/Nnhc' +export { default as Novg } from 'src/components/Runners/Novg' export { default as Npfx } from 'src/components/Runners/Npfx' export { default as Nric } from 'src/components/Runners/Nric' export { default as Oiwu } from 'src/components/Runners/Oiwu' @@ -216,6 +217,7 @@ export { default as Qmof } from 'src/components/Runners/Qmof' export { default as Qoms } from 'src/components/Runners/Qoms' export { default as Qpjt } from 'src/components/Runners/Qpjt' export { default as Qpkm } from 'src/components/Runners/Qpkm' +export { default as Qscy } from 'src/components/Runners/Qscy' export { default as Qsfp } from 'src/components/Runners/Qsfp' export { default as Qvxe } from 'src/components/Runners/Qvxe' export { default as Qwke } from 'src/components/Runners/Qwke' @@ -229,6 +231,8 @@ export { default as Rqdn } from 'src/components/Runners/Rqdn' export { default as Rqjo } from 'src/components/Runners/Rqjo' export { default as Rreb } from 'src/components/Runners/Rreb' export { default as Rzbq } from 'src/components/Runners/Rzbq' +export { default as Sewk } from 'src/components/Runners/Sewk' +export { default as Sffm } from 'src/components/Runners/Sffm' export { default as Sfop } from 'src/components/Runners/Sfop' export { default as Sgfj } from 'src/components/Runners/Sgfj' export { default as Sisn } from 'src/components/Runners/Sisn' diff --git a/src/components/VariableExpressionBox.tsx b/src/components/VariableExpressionBox.tsx index 38a6edee0..69b01b853 100644 --- a/src/components/VariableExpressionBox.tsx +++ b/src/components/VariableExpressionBox.tsx @@ -63,7 +63,7 @@ const SecretCodeLabelWrapper = ({ ( (

- ここまでは簡単すぎたかもしれません。次は、もう少し複雑な計算箱を見てみましょう! + ここまでは、単純な計算ができる計算箱を紹介してきました。次は、もう少し複雑な計算箱を見てみましょう! 😉

@@ -332,95 +333,77 @@ export default () => ( ) }, { - title: <>何の役に立つの?, + type: 'yesNoQuiz', + title: ( + <> + + + ), content: ( <>

- では、 - - この条件分岐の計算箱はいったい何の役に立つのでしょうか? - - 人々は、条件分岐の計算箱をどんな用途で使っていたのでしょう? + ちゃんと理解できたかどうか、 + + で確かめてみましょう。 + :

- -

というわけで、条件分岐の計算箱の具体的な使用例を紹介します!

+ +

+ +

+ + ) }, { - title: <>2月には何日ある?, + title: ( + <> + + + ), content: ( <>

- 人々は毎年、ある疑問に悩まされていました。それは、「 - 今年の2月には何日あるんだろう?」という疑問です。 + +

- -

答えはもちろん、以下の通りです。

-
    - - - うるう年の場合、2月には29日ある。 - - - - - それ以外の年の場合、2月には28日ある。 - - -
+

- では、 - - うるう年かどうかを判別するにはどうすればいいでしょう? - + つまり ではなく、 + になりました。

-

- うるう年は、基本的に「4で割り切れる年 - 」です。たとえば東京オリンピックが行われる2020年は、2020が4で割り切れるのでうるう年となります。ちなみに例外もありますが、後に説明します。 + の中には{' '} + が入っているので、下の + の中にある{' '} + が残るのです。 +

+ +

+ 以上、条件分岐の計算箱の紹介でした!😉

) }, { - title: <>計算箱を使うと, + title: <>何の役に立つの?, content: ( <>

- - 人々は計算が苦手だったので、計算箱を使って「 - 2月に何日あるか」を計算しようと試みました - - 。🤔 -

- -

- まず、「 - 年の数を、4で割った余り - 」を計算する計算箱はこちらです。 -

- -

- たとえば、 の部分に {' '} - を入れて - - すると、 - で割り切れるので、 - が残ります。 -

- - - -

- 次に、「 - 年の数を、4で割った余り - 」を計算する計算箱を、 + では、 - 条件分岐の計算箱の真ん中の部分{' '} - に入れます。 + この条件分岐の計算箱はいったい何の役に立つのでしょうか? + 人々は、条件分岐の計算箱をどんな用途で使っていたのでしょう? + 🤔 +

+ +

+ というわけで次の回では、条件分岐の計算箱の具体的な使用例 + を紹介します!

+ ) } diff --git a/src/contents/2.v2.jp.tsx b/src/contents/2.v2.jp.tsx index 49b841533..3b92c3539 100644 --- a/src/contents/2.v2.jp.tsx +++ b/src/contents/2.v2.jp.tsx @@ -1,418 +1,98 @@ import React from 'react' -import { P, Em, Strong, InlineHeader } from 'src/components/ContentTags' +import { + P, + Em, + Strong, + InlineHeader, + Ul, + UlLi +} from 'src/components/ContentTags' import Emoji from 'src/components/Emoji' import EmojiSeparator from 'src/components/EmojiSeparator' -import BottomRightBadge from 'src/components/BottomRightBadge' -import NextLessonButton from 'src/components/NextLessonButton' -import EmojiWithText from 'src/components/EmojiWithText' -import YesNoButtons from 'src/components/YesNoButtons' +import EmojiNumber from 'src/components/EmojiNumber' import EpisodeCardList from 'src/components/EpisodeCardList' import H from 'src/components/H' -import episodeEmojis from 'src/lib/episodeEmojis' +import { InlineEmojiBoxesForCondition } from 'src/components/InlineEmojiBoxes' import ExpressionRunnerSeparator from 'src/components/ExpressionRunnerSeparator' import * as R from 'src/components/Runners' -export const BasicRules = ({ - includeFuncUnbound -}: { - includeFuncUnbound: boolean -}) => ( - <> -

- 1. 印をつける:{' '} - {' '} - {' '} - {includeFuncUnbound && ( - <> - {' '} - - )} - -

- -

- 2. 一致チェック:{' '} - {' '} - {' '} - -

- -

- 3. コピーする:{' '} - {' '} - ↘️{' '} - -

- -

- 4. 消す: 💥{' '} - {' '} - -

- - - - -) - -BasicRules.defaultProps = { - includeFuncUnbound: false -} - export default () => ( -

- - さっそく前回紹介した - - の法則 🤫 を紹介していきましょう。 -

-

- ここでは、前回のはじめに登場した弁当箱(例その1 - )を使って説明します: -

- - - - - ) - }, - { - title: '法則その1: 印をつける', - content: ( - <> -

- まず、 - - 上の料理には{' '} - - 、左の料理には - - 、右の料理には - - の印をつけます。 - -

- , - , - - ]} - /> -

- -

- -

- に - - の印が、下の - - ふたつにそれぞれ - と - - の印がつきました。 -

- - ) - }, - { - title: <>法則その2: 一致チェック, - content: ( - <> -

- 続いて、 - - と - - が一致するかチェックし、一致した料理には、 - を付けます。 - -

- , - , - - ]} - /> -

- -

- -

- と - の - - しました。 -

- - ) - }, - { - title: <>法則その3: コピーする, - content: ( - <> -

- 続いて、 - - - の料理を、 - - した - - の部分にコピーします。 - -

- , - ↘️, - - ]} - /> -

- -

- -

- の - が - に - - されました。 -

- - ) - }, - { - title: <>法則その4: 消す, - content: ( - <> -

- 最後に、 - - と - - が消えます。 - -

- 💥, - , - - ]} - /> -

- -

- -

- そして、最終的に - - だけになります。 -

- -

以上です!簡単だったでしょう?

- - ) - }, - { - title: ( - <> - - - ), - type: 'summary', - content: ( - <> - - - ) - }, - { - title: <>一致しなかったら?, + title: <>2月には何日ある?, content: ( <>

+ 人々は毎年、ある疑問に悩まされていました。それは、「 + 今年の2月には何日あるんだろう?」という疑問です。 +

+ +

答えはもちろん、以下の通りです。

+
    + + + うるう年の場合、2月には29日ある。 + + + + + それ以外の年の場合、2月には28日ある。 + + +
+

+ では、 - もし - と - - が一致しなかったらどうするのでしょうか? + うるう年かどうかを判別するにはどうすればいいでしょう?

- , - , - - ]} - /> +

- たとえば、前回にもあったマクドナルド風の弁当箱は、 - と - - が一致しません。 - + うるう年は、基本的に「4で割り切れる年 + 」です。たとえば東京オリンピックが行われる2020年は、2020が4で割り切れるのでうるう年となります。ちなみに例外もありますが、後に説明します。

- -

こういう場合どうするかというと…(下に続く)

) }, { - title: <>コピーはせず、消すだけ!, + title: <>計算箱を使うと, content: ( <>

- - コピー ( - {' '} - ↘️{' '} - - )はせずに、ただ - と - - を消すだけです。 - + + 人々は計算が苦手だったので、計算箱を使って「 + 2月に何日あるか」を計算しようと試みました + + 。🤔

+

- + まず、「 + 年の数を、4で割った余り + 」を計算する計算箱はこちらです。

- +

- そして、最終的に - - だけになります。 + たとえば、 の部分に {' '} + を入れて + + すると、 + で割り切れるので、 + が残ります。

- - - ) - }, - { - title: ( - <> - : 一致しなかった場合 - - ), - type: 'summary', - content: ( - <> + + +

- 一致しなかった場合、 + 次に、「 + 年の数を、4で割った余り + 」を計算する計算箱を、 - コピー ( - {' '} - ↘️{' '} - - )はせずに、ただ - と - - を消す + 条件分岐の計算箱の真ん中の部分{' '} + に入れます。 - 。 -

- - - - - ) - }, - { - title: ( - <> - - で見てみましょう - - ), - content: ( - <> -

- 締めくくりに、それぞれ最初から最後まで - - で見てみましょう。 - - を使うと、最後まで自動で進めることができます。 -

- -

- -

- -

- こちらも - -

- -

法則を覚えたら、次に進みましょう!

- - ) - }, - { - title: <>予告: 4品の弁当箱, - content: ( - <> -

- 次のページからは4品の料理が入った - - が登場します。 -

- -

- たとえばこちらをご覧ください。 - 上に2マス、下にも2マス - ありますね。この場合はどうなるのでしょうか? -

- - - ) - }, - { - type: 'yesNoQuiz', - title: ( - <> - - - ), - content: ( - <> -

- 次のページで詳しく説明しますが、先に - - をやってみましょう。勘で答えてみてください。 -

- -

- -

- - - - ) - }, - { - title: ( - <> - - - ), - content: ( - <> -

- -

- -

どんな法則でこうなるのかは、次のページで説明します!

- ) } diff --git a/src/lib/numberEmojiMapping.ts b/src/lib/numberEmojiMapping.ts index 291c99316..6553f3400 100644 --- a/src/lib/numberEmojiMapping.ts +++ b/src/lib/numberEmojiMapping.ts @@ -5,6 +5,8 @@ const numberEmojiMapping: Record = jsonMapping export const numberEmojiMappingMultipleDigits: Record = { 24: ['2️⃣', '4️⃣'], 16: ['1️⃣', '6️⃣'], + 28: ['2️⃣', '8️⃣'], + 29: ['2️⃣', '9️⃣'], 120: ['1️⃣', '2️⃣', '0️⃣'], 2019: ['2️⃣', '0️⃣', '1️⃣', '9️⃣'], 2020: ['2️⃣', '0️⃣', '2️⃣', '0️⃣'] diff --git a/src/lib/runners/novg.json b/src/lib/runners/novg.json new file mode 100644 index 000000000..3a61beee7 --- /dev/null +++ b/src/lib/runners/novg.json @@ -0,0 +1,39 @@ +{ + "expressionContainers": [ + { + "containerState": "done", + "previouslyChangedExpressionState": "default", + "expression": { + "name": "shorthandNumber", + "highlightType": "default", + "topLeftBadgeType": "none", + "bottomRightBadgeType": "none", + "type": "variable", + "argPriorityAgg": [], + "funcPriorityAgg": [], + "emphasizePriority": false, + "bound": true, + "shorthandNumber": 28 + } + } + ], + "speed": 1, + "showOnlyFocused": false, + "hideControls": true, + "explanationsVisibility": "hidden", + "hidePriorities": true, + "variableSize": "lg", + "containerSize": "xxs", + "hidePlayButton": false, + "hideBottomRightBadges": false, + "skipToTheEnd": false, + "hideFuncUnboundBadgeOnExplanation": false, + "highlightOverridesCallArgAndFuncUnboundOnly": false, + "bottomRightBadgeOverrides": {}, + "highlightOverrides": {}, + "highlightOverrideActiveAfterStart": false, + "argPriorityAggHighlights": [], + "funcPriorityAggHighlights": [], + "highlightFunctions": false, + "superFastForward": false +} diff --git a/src/lib/runners/qscy.json b/src/lib/runners/qscy.json new file mode 100644 index 000000000..26a6d9700 --- /dev/null +++ b/src/lib/runners/qscy.json @@ -0,0 +1,74 @@ +{ + "expressionContainers": [ + { + "expression": { + "type": "conditional", + "state": "trueCaseActive", + "checkType": "isZero", + "condition": { + "name": "shorthandNumber", + "highlightType": "default", + "topLeftBadgeType": "none", + "bottomRightBadgeType": "none", + "type": "variable", + "argPriorityAgg": [], + "funcPriorityAgg": [], + "emphasizePriority": false, + "bound": true, + "shorthandNumber": 0 + }, + "trueCase": { + "name": "shorthandNumber", + "highlightType": "default", + "topLeftBadgeType": "none", + "bottomRightBadgeType": "none", + "type": "variable", + "argPriorityAgg": [], + "funcPriorityAgg": [ + 1 + ], + "emphasizePriority": false, + "bound": true, + "shorthandNumber": 29 + }, + "falseCase": { + "name": "shorthandNumber", + "highlightType": "default", + "topLeftBadgeType": "none", + "bottomRightBadgeType": "none", + "type": "variable", + "argPriorityAgg": [ + 1 + ], + "funcPriorityAgg": [], + "emphasizePriority": false, + "bound": true, + "shorthandNumber": 28 + }, + "priority": 1 + }, + "previouslyChangedExpressionState": "trueCaseActive", + "activePriority": 1, + "containerState": "stepped" + } + ], + "speed": 1, + "showOnlyFocused": false, + "hideControls": true, + "explanationsVisibility": "visible", + "hidePriorities": true, + "variableSize": "lg", + "containerSize": "xxs", + "hidePlayButton": false, + "hideBottomRightBadges": false, + "skipToTheEnd": false, + "hideFuncUnboundBadgeOnExplanation": false, + "highlightOverridesCallArgAndFuncUnboundOnly": false, + "bottomRightBadgeOverrides": {}, + "highlightOverrides": {}, + "highlightOverrideActiveAfterStart": false, + "argPriorityAggHighlights": [], + "funcPriorityAggHighlights": [], + "highlightFunctions": false, + "superFastForward": false +} diff --git a/src/lib/runners/sewk.json b/src/lib/runners/sewk.json new file mode 100644 index 000000000..f1d68c522 --- /dev/null +++ b/src/lib/runners/sewk.json @@ -0,0 +1,89 @@ +{ + "expressionContainers": [ + { + "containerState": "ready", + "previouslyChangedExpressionState": "default", + "expression": { + "type": "conditional", + "state": "default", + "checkType": "isZero", + "condition": { + "name": "shorthandNumber", + "highlightType": "default", + "topLeftBadgeType": "none", + "bottomRightBadgeType": "none", + "type": "variable", + "argPriorityAgg": [], + "funcPriorityAgg": [], + "emphasizePriority": false, + "bound": true, + "shorthandNumber": 0 + }, + "trueCase": { + "name": "shorthandNumber", + "highlightType": "default", + "topLeftBadgeType": "none", + "bottomRightBadgeType": "none", + "type": "variable", + "argPriorityAgg": [], + "funcPriorityAgg": [ + 1 + ], + "emphasizePriority": false, + "bound": true, + "shorthandNumber": 29 + }, + "falseCase": { + "name": "shorthandNumber", + "highlightType": "default", + "topLeftBadgeType": "none", + "bottomRightBadgeType": "none", + "type": "variable", + "argPriorityAgg": [ + 1 + ], + "funcPriorityAgg": [], + "emphasizePriority": false, + "bound": true, + "shorthandNumber": 28 + }, + "priority": 1 + } + }, + { + "containerState": "done", + "previouslyChangedExpressionState": "default", + "expression": { + "name": "shorthandNumber", + "highlightType": "default", + "topLeftBadgeType": "none", + "bottomRightBadgeType": "none", + "type": "variable", + "argPriorityAgg": [], + "funcPriorityAgg": [], + "emphasizePriority": false, + "bound": true, + "shorthandNumber": 29 + } + } + ], + "speed": 1, + "showOnlyFocused": false, + "hideControls": false, + "explanationsVisibility": "hiddenInitialPausedOnly", + "hidePriorities": true, + "variableSize": "lg", + "containerSize": "xxs", + "hidePlayButton": false, + "hideBottomRightBadges": false, + "skipToTheEnd": true, + "hideFuncUnboundBadgeOnExplanation": true, + "highlightOverridesCallArgAndFuncUnboundOnly": false, + "bottomRightBadgeOverrides": {}, + "highlightOverrides": {}, + "highlightOverrideActiveAfterStart": false, + "argPriorityAggHighlights": [], + "funcPriorityAggHighlights": [], + "highlightFunctions": false, + "superFastForward": false +} diff --git a/src/lib/runners/sffm.json b/src/lib/runners/sffm.json new file mode 100644 index 000000000..c7a363bc1 --- /dev/null +++ b/src/lib/runners/sffm.json @@ -0,0 +1,73 @@ +{ + "expressionContainers": [ + { + "containerState": "ready", + "previouslyChangedExpressionState": "default", + "expression": { + "type": "conditional", + "state": "default", + "checkType": "isZero", + "condition": { + "name": "shorthandNumber", + "highlightType": "default", + "topLeftBadgeType": "none", + "bottomRightBadgeType": "none", + "type": "variable", + "argPriorityAgg": [], + "funcPriorityAgg": [], + "emphasizePriority": false, + "bound": true, + "shorthandNumber": 0 + }, + "trueCase": { + "name": "shorthandNumber", + "highlightType": "default", + "topLeftBadgeType": "none", + "bottomRightBadgeType": "none", + "type": "variable", + "argPriorityAgg": [], + "funcPriorityAgg": [ + 1 + ], + "emphasizePriority": false, + "bound": true, + "shorthandNumber": 29 + }, + "falseCase": { + "name": "shorthandNumber", + "highlightType": "default", + "topLeftBadgeType": "none", + "bottomRightBadgeType": "none", + "type": "variable", + "argPriorityAgg": [ + 1 + ], + "funcPriorityAgg": [], + "emphasizePriority": false, + "bound": true, + "shorthandNumber": 28 + }, + "priority": 1 + } + } + ], + "speed": 1, + "showOnlyFocused": false, + "hideControls": true, + "explanationsVisibility": "hidden", + "hidePriorities": true, + "variableSize": "lg", + "containerSize": "xxs", + "hidePlayButton": false, + "hideBottomRightBadges": false, + "skipToTheEnd": false, + "hideFuncUnboundBadgeOnExplanation": false, + "highlightOverridesCallArgAndFuncUnboundOnly": false, + "bottomRightBadgeOverrides": {}, + "highlightOverrides": {}, + "highlightOverrideActiveAfterStart": false, + "argPriorityAggHighlights": [], + "funcPriorityAggHighlights": [], + "highlightFunctions": false, + "superFastForward": false +} diff --git a/src/types/HTypes.ts b/src/types/HTypes.ts index 40f5f722e..24c8fdba8 100644 --- a/src/types/HTypes.ts +++ b/src/types/HTypes.ts @@ -127,4 +127,6 @@ export interface HProps { | { name: 'addMathBox' } | { name: 'remainder' } | { name: 'conditionalMathBox' } + | { name: 'lookAtThisMathBox' } + | { name: 'whatHappensAtTheEndMathBoxQuestion' } } From 770ac2d96a45d4581e4644463587279377f7c0f0 Mon Sep 17 00:00:00 2001 From: Shu Uesugi Date: Thu, 27 Jun 2019 15:18:41 -0700 Subject: [PATCH 20/20] Start episode 2 --- src/contents/2.v2.jp.tsx | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/src/contents/2.v2.jp.tsx b/src/contents/2.v2.jp.tsx index 3b92c3539..24497bfa1 100644 --- a/src/contents/2.v2.jp.tsx +++ b/src/contents/2.v2.jp.tsx @@ -5,7 +5,8 @@ import { Strong, InlineHeader, Ul, - UlLi + UlLi, + Hr } from 'src/components/ContentTags' import Emoji from 'src/components/Emoji' import EmojiSeparator from 'src/components/EmojiSeparator' @@ -24,8 +25,17 @@ export default () => ( content: ( <>

- 人々は毎年、ある疑問に悩まされていました。それは、「 - 今年の2月には何日あるんだろう?」という疑問です。 + 今回は、 + + 前回紹介した計算箱で解くことができる問題を紹介します + + 。それは、以下のような問題です。 +

+
+

+ 人々は毎年、「 + 今年の2月には何日あるんだろう? + 」という疑問に悩まされていました。

答えはもちろん、以下の通りです。

@@ -50,10 +60,25 @@ export default () => (

うるう年は、基本的に「4で割り切れる年 - 」です。たとえば東京オリンピックが行われる2020年は、2020が4で割り切れるのでうるう年となります。ちなみに例外もありますが、後に説明します。 + 」です。たとえば東京オリンピックが行われる2020年は、2020が4で割り切れるのでうるう年となります。

- ) + ), + footer: { + content: ( + <> +

+ ちなみに: 例外として、「 + 100で割り切れて、400で割り切れない年 + 」はうるう年ではありません。たとえば2100年は、100で割り切れて400で割り切れないので、うるう年ではありません。 +

+

+ ただ都合上、この例外はここでは無視することにします。 + 😉 +

+ + ) + } }, { title: <>計算箱を使うと,