We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/wmoten/ice-puzzle-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server
import { describe, expect, it } from 'vitest';
import {
buildUnsolvableDiagnostics,
computeDirectionBalance,
exploreReachability,
suggestStopPoints,
traceMovePositions,
} from './design-assist.js';
import { solve } from './solver.js';
import type { PuzzleData } from './types.js';
function makeBasicPuzzle(overrides?: Partial<PuzzleData>): PuzzleData {
return {
id: 'test',
name: 'Assist Test',
theme: 'ice',
width: 8,
height: 6,
par: 0,
start: { x: 1, y: 4 },
goal: { x: 6, y: 1 },
obstacles: [],
...overrides,
};
}
describe('design-assist utilities', () => {
it('computes direction balance', () => {
const balance = computeDirectionBalance(['up', 'right', 'right', 'down']);
expect(balance.up).toBe(1);
expect(balance.right).toBe(2);
expect(balance.left).toBe(0);
});
it('explores reachable landing positions from start', () => {
const puzzle = makeBasicPuzzle({
start: { x: 1, y: 1 },
goal: { x: 6, y: 1 },
});
const report = exploreReachability(puzzle);
expect(report.positions.length).toBeGreaterThan(0);
expect(report.goalReachable).toBe(true);
});
it('traces move stop positions', () => {
const puzzle = makeBasicPuzzle({
start: { x: 1, y: 1 },
goal: { x: 6, y: 1 },
});
const trace = traceMovePositions(puzzle, ['right']);
expect(trace.positions[0]).toEqual({ x: 1, y: 1 });
expect(trace.positions[trace.positions.length - 1]).toEqual({ x: 6, y: 1 });
});
it('suggests stop points along a slide direction', () => {
const puzzle = makeBasicPuzzle({
start: { x: 1, y: 1 },
goal: { x: 6, y: 4 },
});
const report = suggestStopPoints(puzzle, { x: 1, y: 1 }, 'right');
expect(report.currentLanding.x).toBe(6);
expect(report.suggestions.length).toBeGreaterThan(0);
});
it('produces unsolvable diagnostics reasons', () => {
const puzzle = makeBasicPuzzle({
start: { x: 2, y: 2 },
goal: { x: 3, y: 1 },
obstacles: [
{ x: 1, y: 2, type: 'rock' },
{ x: 3, y: 2, type: 'rock' },
{ x: 2, y: 1, type: 'rock' },
{ x: 2, y: 3, type: 'rock' },
],
});
const result = solve(puzzle);
expect(result.solvable).toBe(false);
const diagnostics = buildUnsolvableDiagnostics(puzzle, result);
expect(diagnostics.reasons.length).toBeGreaterThan(0);
expect(diagnostics.suggestions.length).toBeGreaterThan(0);
});
});