From 3eb7a5e4a68b9ace3081b9a991fae1ea9e69aece Mon Sep 17 00:00:00 2001 From: EllAchE <26192612+EllAchE@users.noreply.github.com> Date: Sat, 4 Nov 2023 01:49:52 -0700 Subject: [PATCH] rename to UAS --- cjsmin/src/chess.ts | 20 ++++++++++---------- src/metrics/captures.ts | 4 ++-- src/metrics/distances.ts | 12 ++++++------ src/types.ts | 6 +++--- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/cjsmin/src/chess.ts b/cjsmin/src/chess.ts index c62a57a..c19e8c1 100644 --- a/cjsmin/src/chess.ts +++ b/cjsmin/src/chess.ts @@ -50,10 +50,10 @@ export type PrettyMove = { capture?: Capture | undefined; promotion?: PieceType | undefined; flags: string; - uas: UAPSymbol; + uas: UASymbol; }; -export type UAPSymbol = +export type UASymbol = | 'RA' | 'NB' | 'BC' @@ -146,7 +146,7 @@ export const ALL_SQUARES: Square[] = [ ] // prettier-ignore -export const ALL_UNAMBIGUOUS_PIECE_SYMBOLS: UAPSymbol[] = [ +export const ALL_UNAMBIGUOUS_PIECE_SYMBOLS: UASymbol[] = [ "RA", "NB", "BC", "Q", "K", "BF", "NG", "RH", "PA", "PB", "PC", "PD", "PE", "PF", "PG", "PH", "ra", "nb", "bc", "q", "k", "bf", "ng", "rh", @@ -159,12 +159,12 @@ export const DEFAULT_POSITION = export type Piece = { color: Color; type: PieceType; - uas: UAPSymbol; + uas: UASymbol; }; type Capture = { type: PieceType; - uas: UAPSymbol; + uas: UASymbol; }; export type InternalMove = { @@ -172,7 +172,7 @@ export type InternalMove = { from: number; to: number; piece: PieceType; - uas: UAPSymbol; + uas: UASymbol; capture?: Capture; promotion?: PieceType; flags: number; @@ -197,7 +197,7 @@ export type Move = { capture?: Capture; promotion?: PieceType; flags: string; - umabiguousSymbol: UAPSymbol; + umabiguousSymbol: UASymbol; // san: string; // lan: string; // before: string; @@ -612,7 +612,7 @@ function addMove( from: number, to: number, piece: PieceType, - uas: UAPSymbol, + uas: UASymbol, capture: Capture | undefined = undefined, flags: number = BITS.NORMAL ) { @@ -867,7 +867,7 @@ export class Chess { square: Square ) { //@ts-ignore this breaks for non init - const uas = SQUARE_TO_STARTING_POSITION_MAP[square] as UAPSymbol; + const uas = SQUARE_TO_STARTING_POSITION_MAP[square] as UASymbol; // check for piece if (SYMBOLS.indexOf(type.toLowerCase()) === -1) { @@ -1304,7 +1304,7 @@ export class Chess { this._board[from].uas, { type: PAWN, - uas: uas as UAPSymbol, + uas: uas as UASymbol, }, BITS.EP_CAPTURE ); diff --git a/src/metrics/captures.ts b/src/metrics/captures.ts index 4e2c56d..9a23877 100644 --- a/src/metrics/captures.ts +++ b/src/metrics/captures.ts @@ -1,4 +1,4 @@ -import { Piece, PrettyMove, UAPSymbol } from '../../cjsmin/src/chess'; +import { Piece, PrettyMove, UASymbol } from '../../cjsmin/src/chess'; import { UAPMap } from '../types'; import { createUAPMap } from '../utils'; import { Metric } from './metric'; @@ -24,7 +24,7 @@ export class KillStreakMetric implements Metric { ) { let i = startingIndex; let streakLength = 0; - let streakPiece: UAPSymbol; + let streakPiece: UASymbol; while (i < game.length) { const move = game[i].move; diff --git a/src/metrics/distances.ts b/src/metrics/distances.ts index 710daf2..bae674f 100644 --- a/src/metrics/distances.ts +++ b/src/metrics/distances.ts @@ -1,4 +1,4 @@ -import { Chess, Piece, PrettyMove, UAPSymbol } from '../../cjsmin/src/chess'; +import { Chess, Piece, PrettyMove, UASymbol } from '../../cjsmin/src/chess'; import { FileReaderGame, UAPMap } from '../types'; import { createUAPMap } from '../utils'; import { Metric } from './metric'; @@ -13,7 +13,7 @@ export async function getMoveDistanceSingleGame(game: FileReaderGame) { // Initialize variables to keep track of the maximum distance and the piece let maxDistance = -1; - let maxDistancePiece: UAPSymbol; + let maxDistancePiece: UASymbol; let singleGameDistanceTotal = 0; // evaluate each move, update the correct unambiguous piece's distance @@ -165,8 +165,8 @@ export async function getMoveDistanceSetOfGames(games: FileReaderGame[]) { export class AverageDistanceMetric implements Metric { distanceMap: UAPMap<{ totalDistance: number }>; - pieceWithHighestAvg: UAPSymbol; - pieceWithLowestAvg: UAPSymbol; + pieceWithHighestAvg: UASymbol; + pieceWithLowestAvg: UASymbol; maxAvgDistance: number; minAvgDistance: number; totalDistance: number; @@ -182,11 +182,11 @@ export class AverageDistanceMetric implements Metric { const avgDistance = this.distanceMap[piece].totalDistance / gameCount; if (avgDistance > this.maxAvgDistance) { this.maxAvgDistance = avgDistance; - this.pieceWithHighestAvg = piece as UAPSymbol; + this.pieceWithHighestAvg = piece as UASymbol; } if (avgDistance < this.minAvgDistance) { this.minAvgDistance = avgDistance; - this.pieceWithLowestAvg = piece as UAPSymbol; + this.pieceWithLowestAvg = piece as UASymbol; } } } diff --git a/src/types.ts b/src/types.ts index 004a0ea..b8bfc0c 100644 --- a/src/types.ts +++ b/src/types.ts @@ -1,4 +1,4 @@ -import { Square, UAPSymbol } from '../cjsmin/src/chess'; +import { Square, UASymbol } from '../cjsmin/src/chess'; export interface FileReaderGame { moves: string; @@ -6,12 +6,12 @@ export interface FileReaderGame { } export type UAPMap = { - [key in UAPSymbol]: T; + [key in UASymbol]: T; }; export type BoardMap = { [key in Square]: { - [key in UAPSymbol]: { + [key in UASymbol]: { captured: number; captures: number; revengeKills: number;