// Module 8 Expansion Drop: PULL. The scenario is in expansion/README.md. import { expect, test } from "vitest"; import { newBaba } from "../src/harness"; test("test_08x_pull_follows", () => { const b = newBaba({ width: 5, height: 3, objects: [] }); for (const [word, x] of [ ["BABA", 0], ["IS", 1], ["YOU", 2], ] as const) { b.place(`text:${word}`, x, 0); } for (const [word, x] of [ ["ROCK", 0], ["IS", 1], ["PULL", 2], ] as const) { b.place(`text:${word}`, x, 1); } const farRock = b.place("rock", 0, 2); const nearRock = b.place("rock", 1, 2); const baba = b.place("baba", 2, 2); b.move("right"); expect(b.posOf(baba)).toEqual([3, 2]); expect(b.posOf(nearRock)).toEqual([2, 2]); expect(b.posOf(farRock)).toEqual([1, 2]); b.move("left"); expect(b.posOf(baba)).toEqual([3, 2]); expect(b.posOf(nearRock)).toEqual([2, 2]); expect(b.posOf(farRock)).toEqual([1, 2]); });