create binary repr of map

This commit is contained in:
evanpelle
2024-08-23 12:08:57 -07:00
parent ac556ee073
commit 98cf1b6beb
7 changed files with 17 additions and 5 deletions
+1
View File
@@ -42,6 +42,7 @@ export interface Tile {
isShore(): boolean
isWater(): boolean
isShorelineWater(): boolean
magnitude(): number
owner(): Player | TerraNullius
hasOwner(): boolean
isBorder(): boolean
+3
View File
@@ -19,6 +19,9 @@ class TileImpl implements Tile {
private readonly _cell: Cell,
private readonly _terrain: Terrain
) { }
magnitude(): number {
return this._terrain.magnitude
}
isShore(): boolean {
return this.isLand() && this._terrain.shoreline
}
+1 -1
View File
@@ -1,5 +1,5 @@
import {Cell} from './Game';
import binAsString from "!!binary-loader!../../resources/WorldSmall.bin";
import binAsString from "!!binary-loader!../../resources/World.bin";
export class TerrainMap {
constructor(public readonly tiles: Terrain[][]) { }
+6
View File
@@ -1,6 +1,7 @@
import {Colord, colord} from "colord";
import {PlayerID, Tile} from "../Game";
import {Theme} from "./Config";
import {time} from "console";
export const pastelTheme = new class implements Theme {
private background = colord({r: 100, g: 100, b: 100});
@@ -89,6 +90,11 @@ export const pastelTheme = new class implements Theme {
if (tile.isShorelineWater()) {
return this.shorelineWater
}
return colord({
r: Math.min(20, 255),
g: Math.min(20, 255),
b: Math.min(20 + tile.magnitude(), 255)
})
return this.water;
}
}