🔨 rename package compute -> solver
This commit is contained in:
@@ -39,3 +39,7 @@ npm install
|
||||
|
||||
npm run dev:demo
|
||||
```
|
||||
|
||||
## Implementation
|
||||
|
||||
[solver algorithm](./packages/solver/README.md)
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { getGithubUserContribution } from "@snk/github-user-contribution";
|
||||
import { userContributionToGrid } from "./userContributionToGrid";
|
||||
import { getBestRoute } from "@snk/compute/getBestRoute";
|
||||
import { getBestRoute } from "@snk/solver/getBestRoute";
|
||||
import { createGif } from "@snk/gif-creator";
|
||||
import { createSvg } from "../svg-creator";
|
||||
import { snake4 } from "@snk/types/__fixtures__/snake";
|
||||
import { getPathToPose } from "@snk/compute/getPathToPose";
|
||||
import { getPathToPose } from "@snk/solver/getPathToPose";
|
||||
|
||||
export const generateContributionSnake = async (
|
||||
userName: string,
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import "./menu";
|
||||
import { createCanvas } from "./canvas";
|
||||
import { getBestRoute } from "@snk/compute/getBestRoute";
|
||||
import { getBestRoute } from "@snk/solver/getBestRoute";
|
||||
import { Color, copyGrid } from "@snk/types/grid";
|
||||
import { grid, snake } from "./sample";
|
||||
import { step } from "@snk/compute/step";
|
||||
import { step } from "@snk/solver/step";
|
||||
|
||||
const chain = getBestRoute(grid, snake)!;
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@ import { createCanvas } from "./canvas";
|
||||
import { getSnakeLength } from "@snk/types/snake";
|
||||
import { grid, snake } from "./sample";
|
||||
import { getColor } from "@snk/types/grid";
|
||||
import { getBestTunnel } from "@snk/compute/getBestTunnel";
|
||||
import { createOutside } from "@snk/compute/outside";
|
||||
import { getBestTunnel } from "@snk/solver/getBestTunnel";
|
||||
import { createOutside } from "@snk/solver/outside";
|
||||
import type { Color } from "@snk/types/grid";
|
||||
import type { Point } from "@snk/types/point";
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import "./menu";
|
||||
import { createCanvas } from "./canvas";
|
||||
import { copySnake, snakeToCells } from "@snk/types/snake";
|
||||
import { grid, snake as snake0 } from "./sample";
|
||||
import { getPathTo } from "@snk/compute/getPathTo";
|
||||
import { getPathTo } from "@snk/solver/getPathTo";
|
||||
|
||||
const { canvas, ctx, draw, getPointedCell, highlightCell } = createCanvas(grid);
|
||||
canvas.style.pointerEvents = "auto";
|
||||
|
||||
@@ -2,7 +2,7 @@ import "./menu";
|
||||
import { createCanvas } from "./canvas";
|
||||
import { createSnakeFromCells, snakeToCells } from "@snk/types/snake";
|
||||
import { grid, snake } from "./sample";
|
||||
import { getPathToPose } from "@snk/compute/getPathToPose";
|
||||
import { getPathToPose } from "@snk/solver/getPathToPose";
|
||||
|
||||
const { canvas, ctx, draw, highlightCell } = createCanvas(grid);
|
||||
canvas.style.pointerEvents = "auto";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { getBestRoute } from "@snk/compute/getBestRoute";
|
||||
import { getBestRoute } from "@snk/solver/getBestRoute";
|
||||
import { Color, copyGrid, Grid } from "@snk/types/grid";
|
||||
import { step } from "@snk/compute/step";
|
||||
import { step } from "@snk/solver/step";
|
||||
import { isStableAndBound, stepSpring } from "./springUtils";
|
||||
import { Res } from "@snk/github-user-contribution";
|
||||
import { Snake } from "@snk/types/snake";
|
||||
@@ -11,7 +11,7 @@ import {
|
||||
} from "@snk/draw/drawWorld";
|
||||
import { userContributionToGrid } from "../action/userContributionToGrid";
|
||||
import { snake4 as snake } from "@snk/types/__fixtures__/snake";
|
||||
import { getPathToPose } from "@snk/compute/getPathToPose";
|
||||
import { getPathToPose } from "@snk/solver/getPathToPose";
|
||||
import { createSvg } from "../svg-creator";
|
||||
|
||||
const createForm = ({
|
||||
|
||||
@@ -2,7 +2,7 @@ import "./menu";
|
||||
import { createCanvas } from "./canvas";
|
||||
import { grid } from "./sample";
|
||||
import type { Color } from "@snk/types/grid";
|
||||
import { createOutside, isOutside } from "@snk/compute/outside";
|
||||
import { createOutside, isOutside } from "@snk/solver/outside";
|
||||
|
||||
const { canvas, ctx, draw, highlightCell } = createCanvas(grid);
|
||||
document.body.appendChild(canvas);
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import "./menu";
|
||||
import { getBestRoute } from "@snk/compute/getBestRoute";
|
||||
import { getBestRoute } from "@snk/solver/getBestRoute";
|
||||
import { createSvg } from "../svg-creator";
|
||||
import { grid, snake } from "./sample";
|
||||
import { drawOptions } from "./canvas";
|
||||
import { getPathToPose } from "@snk/compute/getPathToPose";
|
||||
import { getPathToPose } from "@snk/solver/getPathToPose";
|
||||
|
||||
const chain = getBestRoute(grid, snake);
|
||||
chain.push(...getPathToPose(chain.slice(-1)[0], snake)!);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"name": "@snk/demo",
|
||||
"version": "1.0.0",
|
||||
"dependencies": {
|
||||
"@snk/compute": "1.0.0",
|
||||
"@snk/solver": "1.0.0",
|
||||
"@snk/draw": "1.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -2,6 +2,6 @@
|
||||
"name": "@snk/draw",
|
||||
"version": "1.0.0",
|
||||
"dependencies": {
|
||||
"@snk/compute": "1.0.0"
|
||||
"@snk/solver": "1.0.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import { createGif } from "..";
|
||||
import * as grids from "@snk/types/__fixtures__/grid";
|
||||
import { snake3 as snake } from "@snk/types/__fixtures__/snake";
|
||||
import { createSnakeFromCells, nextSnake } from "@snk/types/snake";
|
||||
import { getBestRoute } from "@snk/compute/getBestRoute";
|
||||
import { getBestRoute } from "@snk/solver/getBestRoute";
|
||||
|
||||
jest.setTimeout(20 * 1000);
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
drawLerpWorld,
|
||||
getCanvasWorldSize,
|
||||
} from "@snk/draw/drawWorld";
|
||||
import { step } from "@snk/compute/step";
|
||||
import { step } from "@snk/solver/step";
|
||||
import tmp from "tmp";
|
||||
import execa from "execa";
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"name": "@snk/gif-creator",
|
||||
"version": "1.0.0",
|
||||
"dependencies": {
|
||||
"@snk/compute": "1.0.0",
|
||||
"@snk/solver": "1.0.0",
|
||||
"@snk/draw": "1.0.0",
|
||||
"canvas": "2.6.1",
|
||||
"execa": "4.1.0",
|
||||
|
||||
@@ -3,20 +3,6 @@
|
||||
exports[`should match snapshot for year=2019 1`] = `
|
||||
Object {
|
||||
"cells": Array [
|
||||
Object {
|
||||
"color": "#9be9a8",
|
||||
"count": 4,
|
||||
"date": "2018-12-30",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
},
|
||||
Object {
|
||||
"color": "#9be9a8",
|
||||
"count": 1,
|
||||
"date": "2018-12-31",
|
||||
"x": 0,
|
||||
"y": 1,
|
||||
},
|
||||
Object {
|
||||
"color": "#ebedf0",
|
||||
"count": 0,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# @snk/compute
|
||||
# @snk/solver
|
||||
|
||||
Contains the algorithm to compute the best route given a grid and a starting position for the snake.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "@snk/compute",
|
||||
"name": "@snk/solver",
|
||||
"version": "1.0.0",
|
||||
"devDependencies": {
|
||||
"park-miller": "1.1.0"
|
||||
@@ -3,7 +3,7 @@ import * as path from "path";
|
||||
import { createSvg } from "..";
|
||||
import * as grids from "@snk/types/__fixtures__/grid";
|
||||
import { snake3 as snake } from "@snk/types/__fixtures__/snake";
|
||||
import { getBestRoute } from "@snk/compute/getBestRoute";
|
||||
import { getBestRoute } from "@snk/solver/getBestRoute";
|
||||
|
||||
const drawOptions = {
|
||||
sizeBorderRadius: 2,
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"name": "@snk/svg-creator",
|
||||
"version": "1.0.0",
|
||||
"dependencies": {
|
||||
"@snk/compute": "1.0.0",
|
||||
"@snk/solver": "1.0.0",
|
||||
"csso": "4.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
Reference in New Issue
Block a user