diff --git a/TODO.md b/TODO.md index f1ea820..5af828c 100644 --- a/TODO.md +++ b/TODO.md @@ -1,6 +1,4 @@ -[cps] [subway] `defineStation` - -[cps] [subway] `defineLine` -- take a ordered list of stations +[cps] [subway] `defineLine` -- take an ordered list of stations [cps] [subway] define `bostonSubway` diff --git a/src/cps/subway/Subway.ts b/src/cps/subway/Subway.ts index 8c1a886..12ca818 100644 --- a/src/cps/subway/Subway.ts +++ b/src/cps/subway/Subway.ts @@ -1,7 +1,7 @@ export type LineId = string export type StationId = string -export type Position = string +export type Position = { x: number; y: number } export type Line = { id: LineId @@ -27,3 +27,12 @@ export function createSubway(name: string): Subway { stationMap: new Map(), } } + +export function defineStation( + subway: Subway, + stationId: StationId, + lineIds: Array, + position: Position, +): void { + /// +} diff --git a/src/cps/subways/bostonSubway.ts b/src/cps/subways/bostonSubway.ts index dfe57ca..73754af 100644 --- a/src/cps/subways/bostonSubway.ts +++ b/src/cps/subways/bostonSubway.ts @@ -1,4 +1,4 @@ -import { createSubway } from "../subway/index.js" +import { createSubway, defineStation } from "../subway/index.js" export const bostonSubway = createSubway("boston-subway") @@ -7,20 +7,23 @@ export const bostonSubway = createSubway("boston-subway") // defineLine(bostonSubway, "orange-line") // defineLine(bostonSubway, "blue-line") -// defineStation(bostonSubway, "airport", ["blue-line"], 4.0, 1.0)) -// defineStation(bostonSubway, "aquarium", ["blue-line"], 3.75, 0.1)) -// defineStation(bostonSubway, "wood-island", ["blue-line"], 5.0, 2.0)) -// defineStation(bostonSubway, "state", ["blue-line", "orange-line"], 3.1, -0.75)) +// prettier-ignore +{ + defineStation(bostonSubway, "airport", ["blue-line"], {x: 4.0, y: 1.0}) + defineStation(bostonSubway, "aquarium", ["blue-line"], {x: 3.75, y: 0.1}) + defineStation(bostonSubway, "wood-island", ["blue-line"], {x: 5.0, y: 2.0}) + defineStation(bostonSubway, "state", ["blue-line", "orange-line"], {x:3.1, y:-0.75}) -// defineStation(bostonSubway, "park-street", ["green-line", "red-line"], 2.5, -0.5)) -// defineStation(bostonSubway, "government-center", ["green-line", "blue-line"], 2.9, -0.25)) -// defineStation(bostonSubway, "copley-square", ["green-line",], 1.0, -1.0)) -// defineStation(bostonSubway, "boston-u", ["green-line",], -1.0, -1.0)) -// defineStation(bostonSubway, "north-station", ["green-line", "orange-line"], 2.5, 0.75)) -// defineStation(bostonSubway, "haymarket", ["orange-line" "green-line",], 2.75, 0.5)) + defineStation(bostonSubway, "park-street", ["green-line", "red-line"], {x: 2.5, y:-0.5}) + defineStation(bostonSubway, "government-center", ["green-line", "blue-line"], {x:2.9,y: -0.25}) + defineStation(bostonSubway, "copley-square", ["green-line",], {x:1.0, y: -1.0}) + defineStation(bostonSubway, "boston-u", ["green-line",], {x:-1.0, y:-1.0}) + defineStation(bostonSubway, "north-station", ["green-line", "orange-line"], {x:2.5, y:0.75}) + defineStation(bostonSubway, "haymarket", ["orange-line" ,"green-line",], {x: 2.75, y:0.5}) -// defineStation(bostonSubway, "south-station", ["red-line"], 3.0, -1.0) -// defineStation(bostonSubway, "washington", ["red-line", "orange-line"], 2.75, -0.75) -// defineStation(bostonSubway, "kendall-square", ["red-line"], 1.0, 0.0) -// defineStation(bostonSubway, "central-square", ["red-line"], -1.0, 0.0) -// defineStation(bostonSubway, "harvard-square", ["red-line"], -2.0, 1.0) + defineStation(bostonSubway, "south-station", ["red-line"], {x: 3.0, y:-1.0}) + defineStation(bostonSubway, "washington", ["red-line", "orange-line"], {x:2.75, y:-0.75}) + defineStation(bostonSubway, "kendall-square", ["red-line"], {x:1.0, y:0.0}) + defineStation(bostonSubway, "central-square", ["red-line"], {x:-1.0, y:0.0}) + defineStation(bostonSubway, "harvard-square", ["red-line"], {x:-2.0, y:1.0}) +}