こちらはプラレールを作って作られた、小さい数のかけ算ができるレイアウトです。
具体的には、
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 下層の電車 | |
// 1周目 | |
if (A == 0) { | |
R0 = 0; | |
} else if (A == 1) { | |
R1 = 0; | |
} | |
// 2周目 | |
if (A == 0) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wrote_R0: | |
if (A == 0) { | |
T0 = !T0; // 自動ターンアウトレールなのでトグルする | |
if (T0 == 1) { // 1回目 | |
R0 = 0; goto wrote_R0; | |
} else { // 2回目 | |
R1 = 0; goto wrote_R1; | |
} | |
} else { | |
T1 = !T1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (B == 0) { | |
if (A == 0) { // (*) | |
X = 0; goto wrote_X; | |
} else { | |
X = 1; goto wrote_X; | |
} | |
} else { | |
if (A == 0) { // (*) | |
X = 1; goto wrote_X; | |
} else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (B == 0) { | |
X = 0; goto wrote_X; | |
} else { | |
if (A == 0) { | |
X = 0; goto wrote_X; | |
} else { | |
X = 1; goto wrote_X; | |
} | |
} | |
wrote_X: ; |