diff --git a/app/lib/icemake.ts b/app/lib/icemake.ts
index 5c439bd..7611145 100644
--- a/app/lib/icemake.ts
+++ b/app/lib/icemake.ts
@@ -101,13 +101,10 @@ function runGraphExecution(
if (children != null && typeof children !== "number") {
let condition = false;
if (component.type === "if") {
- const cond: ConeColor | Flavor | Flavor[] | number =
+ const cond: ConeColor | Flavor[] | number =
component.condition;
if (typeof cond === "string") {
- if (coneColors.includes(cond as ConeColor))
- condition = color === cond;
- else if (flavors.includes(cond as Flavor))
- condition = stack.length > 0 && stack[stack.length - 1] === cond;
+ condition = color === cond;
} else if (Array.isArray(cond)) {
for (let i = 0; i <= stack.length - cond.length; i++) {
if (
diff --git a/app/routes/selectStage.tsx b/app/routes/selectStage.tsx
index 9fb5a9b..bc3dd71 100644
--- a/app/routes/selectStage.tsx
+++ b/app/routes/selectStage.tsx
@@ -1,7 +1,7 @@
import { useNavigate } from "react-router";
import { bubbles } from "~/bubbles";
-const TOTAL_STAGES = 24;
+const TOTAL_STAGES = 20;
const PATH_WIDTH = 1100;
const CENTER_X = PATH_WIDTH / 2;
@@ -103,58 +103,66 @@ const personDecorations = [
{
src: "/if_false.png",
alt: "If False Character",
- top: "50rem",
- right: "4rem",
+ stageIndex: 8,
width: 76,
+ offsetX: 50,
+ offsetY: -100,
},
{
src: "/if_true.png",
alt: "If True Character",
- top: "47%",
- left: "18rem",
+ stageIndex: 19,
width: 76,
+ offsetX: 40,
+ offsetY: -150,
},
{
src: "/pop_vanilla.png",
alt: "Pop Vanilla Character",
- top: "37rem",
- left: "30rem",
+ stageIndex: 0,
width: 64,
+ offsetX: 40,
+ offsetY: -80,
},
{
src: "/pop_strawberry.png",
alt: "Pop Strawberry Character",
- top: "14rem",
- right: "4rem",
+ stageIndex: 16,
width: 64,
+ offsetX: 40,
+ offsetY: -120,
},
{
src: "/pop_chocolate.png",
alt: "Pop Chocolate Character",
- bottom: "27rem",
- left: "35%",
+ stageIndex: 10,
width: 64,
+ offsetX: 40,
+ offsetY: -120,
},
{
src: "/push_vanilla.png",
alt: "Push Vanilla Character",
- top: "25rem",
- left: "22rem",
+ stageIndex: 13,
width: 72,
+ offsetX: 40,
+ offsetY: -120,
},
{
src: "/push_strawberry.png",
alt: "Push Strawberry Character",
- bottom: "45rem",
- left: "45%",
+ stageIndex: 3,
width: 72,
+ offsetX: 20,
+ offsetY: -150,
},
{
src: "/push_chocolate.png",
alt: "Push Chocolate Character",
- bottom: "37rem",
- right: "5rem",
+ stageIndex: 6,
width: 64,
+ offsetX: 40,
+ offsetY: -120,
},
];
@@ -182,21 +190,6 @@ export default function SelectStage() {
}
/>
))}
- {personDecorations.map((decor, index) => (
-
- ))}
{/* Back button */}
@@ -240,6 +233,24 @@ export default function SelectStage() {
/>
+ {personDecorations.map((decor, index) => {
+ const pos = stagePositions[decor.stageIndex];
+ return (
+

+ );
+ })}
+
{stagePositions.map((pos, i) => {
const stageNum = i + 1;
return (
diff --git a/app/routes/stage.$id.tsx b/app/routes/stage.$id.tsx
index 7cc6886..328f554 100644
--- a/app/routes/stage.$id.tsx
+++ b/app/routes/stage.$id.tsx
@@ -93,13 +93,6 @@ function getComponentSrc(
) {
return { src: baseSrc, overlaySrc: `/cone_${condition}.png` };
}
- // Flavor
- if (
- typeof condition === "string" &&
- ["vanilla", "chocolate", "strawberry"].includes(condition)
- ) {
- return { src: baseSrc, overlaySrc: `/ice_${condition}.png` };
- }
// Flavor[]
if (Array.isArray(condition)) {
const overlayImages = condition.map((flavor) => `/ice_${flavor}.png`);
diff --git a/app/stages.ts b/app/stages.ts
index 4f72c4d..cc04d50 100644
--- a/app/stages.ts
+++ b/app/stages.ts
@@ -3,7 +3,7 @@ export type Flavor = "vanilla" | "chocolate" | "strawberry";
export type Component =
| { type: "start" }
| { type: "push"; flavor: Flavor }
- | { type: "if"; condition: ConeColor | Flavor | Flavor[] | number }
+ | { type: "if"; condition: ConeColor | Flavor[] | number }
| { type: "pop"; flavor: Flavor | undefined };
export type StageData = {
mission: Partial
>;
@@ -158,69 +158,40 @@ export const STAGES: Record = {
{type: "if", condition: 5},
]
},
- 21: {
+ 20: {
mission: {
- red: ["chocolate", "vanilla", "strawberry", "chocolate", "vanilla", "strawberry"],
- yellow: ["vanilla", "strawberry", "chocolate", "vanilla", "strawberry", "chocolate"],
- brown: ["strawberry", "chocolate", "vanilla", "strawberry", "chocolate", "vanilla"],
+ red: ["vanilla", "chocolate", "strawberry", "vanilla", "chocolate", "strawberry", "chocolate", "vanilla"],
+ yellow: ["strawberry", "vanilla", "chocolate", "strawberry", "chocolate", "vanilla", "strawberry", "chocolate", "vanilla"],
+ brown: ["vanilla", "strawberry", "vanilla", "chocolate", "strawberry", "chocolate", "vanilla", "strawberry", "chocolate", "vanilla"],
},
components: [
- { type: "if", condition: "yellow" },
- { type: "if", condition: "red" },
- { type: "if", condition: 6 },
- { type: "if", condition: 7 },
- { type: "push", flavor: "chocolate" },
- { type: "push", flavor: "strawberry" },
- { type: "push", flavor: "vanilla" },
- { type: "pop", flavor: "chocolate" },
- { type: "pop", flavor: "vanilla" },
- ],
- },
- 22: {
- mission: {
- red: ["chocolate", "vanilla", "strawberry", "vanilla"],
- yellow: ["strawberry", "vanilla", "chocolate", "vanilla"],
- },
- components: [
- { type: "if", condition: "yellow" },
- { type: "if", condition: 3 },
- { type: "if", condition: ["strawberry", "vanilla"] },
- { type: "push", flavor: "chocolate" },
- { type: "push", flavor: "strawberry" },
- { type: "push", flavor: "vanilla" },
- ],
- },
- 23: {
- mission: {
- red: ["chocolate", "vanilla", "chocolate", "strawberry"],
- yellow: ["vanilla","strawberry", "chocolate"],
- },
- components: [
- { type: "if", condition: "red" },
- { type: "if", condition: 3 },
- { type: "if", condition: ["chocolate", "vanilla"] },
- { type: "push", flavor: "chocolate" },
- { type: "push", flavor: "chocolate" },
- { type: "push", flavor: "chocolate" },
- { type: "push", flavor: "strawberry" },
- { type: "push", flavor: "vanilla" },
- ],
- },
- 24: {
+ {type: "push", flavor: "vanilla"},
+ {type: "push", flavor: "chocolate"},
+ {type: "push", flavor: "vanilla"},
+ {type: "push", flavor: "chocolate"},
+ {type: "push", flavor: "strawberry"},
+ {type: "if", condition: "red"},
+ {type: "if", condition: "yellow"},
+ {type: "if", condition: 4},
+ {type: "if", condition: 8},
+ ]
+},
+21: {
mission: {
- red: ["chocolate", "vanilla", "chocolate", "vanilla", "chocolate", "vanilla", "chocolate", "vanilla", "strawberry"],
- yellow: ["vanilla", "vanilla", "vanilla", "vanilla", "vanilla", "vanilla", "vanilla", "strawberry", "strawberry"],
- brown: ["vanilla", "chocolate", "vanilla", "vanilla", "chocolate", "vanilla", "vanilla", "chocolate", "vanilla",],
+ red: ["vanilla", "strawberry", "chocolate", "vanilla", "chocolate", "strawberry", "vanilla", "chocolate", "strawberry"],
+ yellow: ["chocolate", "vanilla", "strawberry", "chocolate", "strawberry", "vanilla", "chocolate", "strawberry"],
+ brown: ["strawberry", "chocolate", "vanilla", "chocolate", "strawberry", "vanilla", "chocolate", "strawberry"],
},
components: [
- { type: "if", condition: "red" },
- { type: "if", condition: "brown" },
- { type: "if", condition: 7 },
- { type: "if", condition: 9 },
- { type: "push", flavor: "chocolate" },
- { type: "push", flavor: "strawberry" },
- { type: "push", flavor: "vanilla" },
- { type: "push", flavor: "vanilla" },
- ],
- },
+ {type: "push", flavor: "vanilla"},
+ {type: "push", flavor: "chocolate"},
+ {type: "push", flavor: "strawberry"},
+ {type: "if", condition: "red"},
+ {type: "if", condition: "yellow"},
+ {type: "if", condition: 3},
+ {type: "if", condition: 4},
+ {type: "if", condition: 5},
+ {type: "if", condition: 8},
+ ]
+},
};