Christoph Wagner 5ad0700b41 refactor: Consolidate repository structure - flatten from workspace pattern
Restructured project from nested workspace pattern to flat single-repo layout.
This eliminates redundant nesting and consolidates all project files under version control.

## Migration Summary

**Before:**
```
alex/ (workspace, not versioned)
├── chess-game/ (git repo)
│   ├── js/, css/, tests/
│   └── index.html
└── docs/ (planning, not versioned)
```

**After:**
```
alex/ (git repo, everything versioned)
├── js/, css/, tests/
├── index.html
├── docs/ (project documentation)
├── planning/ (historical planning docs)
├── .gitea/ (CI/CD)
└── CLAUDE.md (configuration)
```

## Changes Made

### Structure Consolidation
- Moved all chess-game/ contents to root level
- Removed redundant chess-game/ subdirectory
- Flattened directory structure (eliminated one nesting level)

### Documentation Organization
- Moved chess-game/docs/ → docs/ (project documentation)
- Moved alex/docs/ → planning/ (historical planning documents)
- Added CLAUDE.md (workspace configuration)
- Added IMPLEMENTATION_PROMPT.md (original project prompt)

### Version Control Improvements
- All project files now under version control
- Planning documents preserved in planning/ folder
- Merged .gitignore files (workspace + project)
- Added .claude/ agent configurations

### File Updates
- Updated .gitignore to include both workspace and project excludes
- Moved README.md to root level
- All import paths remain functional (relative paths unchanged)

## Benefits

 **Simpler Structure** - One level of nesting removed
 **Complete Versioning** - All documentation now in git
 **Standard Layout** - Matches open-source project conventions
 **Easier Navigation** - Direct access to all project files
 **CI/CD Compatible** - All workflows still functional

## Technical Validation

-  Node.js environment verified
-  Dependencies installed successfully
-  Dev server starts and responds
-  All core files present and accessible
-  Git repository functional

## Files Preserved

**Implementation Files:**
- js/ (3,517 lines of code)
- css/ (4 stylesheets)
- tests/ (87 test cases)
- index.html
- package.json

**CI/CD Pipeline:**
- .gitea/workflows/ci.yml
- .gitea/workflows/release.yml

**Documentation:**
- docs/ (12+ documentation files)
- planning/ (historical planning materials)
- README.md

**Configuration:**
- jest.config.js, babel.config.cjs, playwright.config.js
- .gitignore (merged)
- CLAUDE.md

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-23 10:05:26 +01:00

187 lines
4.2 KiB
JavaScript

/**
* @file Constants.js
* @description Game-wide constants for the chess game
* @author Implementation Team
*/
/**
* Board dimensions
*/
export const BOARD_SIZE = 8;
/**
* Board boundaries
*/
export const BOARD_BOUNDS = Object.freeze({
MIN_ROW: 0,
MAX_ROW: 7,
MIN_COL: 0,
MAX_COL: 7
});
/**
* Player colors
*/
export const COLORS = Object.freeze({
WHITE: 'white',
BLACK: 'black'
});
/**
* Piece types
*/
export const PIECE_TYPES = Object.freeze({
PAWN: 'pawn',
ROOK: 'rook',
KNIGHT: 'knight',
BISHOP: 'bishop',
QUEEN: 'queen',
KING: 'king'
});
/**
* Game status
*/
export const GAME_STATUS = Object.freeze({
ACTIVE: 'active',
CHECK: 'check',
CHECKMATE: 'checkmate',
STALEMATE: 'stalemate',
DRAW: 'draw'
});
/**
* Unicode symbols for chess pieces
* Used for visual representation when not using images
*/
export const PIECE_SYMBOLS = Object.freeze({
'white-king': '♔',
'white-queen': '♕',
'white-rook': '♖',
'white-bishop': '♗',
'white-knight': '♘',
'white-pawn': '♙',
'black-king': '♚',
'black-queen': '♛',
'black-rook': '♜',
'black-bishop': '♝',
'black-knight': '♞',
'black-pawn': '♟'
});
/**
* Initial piece positions in algebraic notation
* Format: [piece_type, position]
*/
export const INITIAL_POSITIONS = Object.freeze({
white: [
// Pawns
['pawn', 'a2'], ['pawn', 'b2'], ['pawn', 'c2'], ['pawn', 'd2'],
['pawn', 'e2'], ['pawn', 'f2'], ['pawn', 'g2'], ['pawn', 'h2'],
// Pieces
['rook', 'a1'], ['knight', 'b1'], ['bishop', 'c1'], ['queen', 'd1'],
['king', 'e1'], ['bishop', 'f1'], ['knight', 'g1'], ['rook', 'h1']
],
black: [
// Pawns
['pawn', 'a7'], ['pawn', 'b7'], ['pawn', 'c7'], ['pawn', 'd7'],
['pawn', 'e7'], ['pawn', 'f7'], ['pawn', 'g7'], ['pawn', 'h7'],
// Pieces
['rook', 'a8'], ['knight', 'b8'], ['bishop', 'c8'], ['queen', 'd8'],
['king', 'e8'], ['bishop', 'f8'], ['knight', 'g8'], ['rook', 'h8']
]
});
/**
* Piece values for AI evaluation
*/
export const PIECE_VALUES = Object.freeze({
[PIECE_TYPES.PAWN]: 1,
[PIECE_TYPES.KNIGHT]: 3,
[PIECE_TYPES.BISHOP]: 3,
[PIECE_TYPES.ROOK]: 5,
[PIECE_TYPES.QUEEN]: 9,
[PIECE_TYPES.KING]: 1000 // Infinite value (game over if lost)
});
/**
* Event names for EventBus
*/
export const EVENTS = Object.freeze({
PIECE_SELECTED: 'piece:selected',
PIECE_DESELECTED: 'piece:deselected',
PIECE_MOVED: 'piece:moved',
PIECE_CAPTURED: 'piece:captured',
PIECE_PROMOTED: 'piece:promoted',
GAME_CHECK: 'game:check',
GAME_CHECKMATE: 'game:checkmate',
GAME_STALEMATE: 'game:stalemate',
GAME_DRAW: 'game:draw',
GAME_OVER: 'game:over',
TURN_CHANGED: 'turn:changed',
MOVE_INVALID: 'move:invalid'
});
/**
* CSS class names
*/
export const CSS_CLASSES = Object.freeze({
SQUARE_LIGHT: 'square--light',
SQUARE_DARK: 'square--dark',
SQUARE_SELECTED: 'square--selected',
SQUARE_VALID_MOVE: 'square--valid-move',
SQUARE_CHECK: 'square--check',
SQUARE_LAST_MOVE: 'square--last-move',
PIECE_DRAGGING: 'piece--dragging'
});
/**
* AI difficulty levels
*/
export const AI_LEVELS = Object.freeze({
EASY: { depth: 1, name: 'Easy' },
MEDIUM: { depth: 2, name: 'Medium' },
HARD: { depth: 3, name: 'Hard' },
EXPERT: { depth: 4, name: 'Expert' }
});
/**
* Direction vectors for piece movement
* Used by sliding pieces (rook, bishop, queen)
*/
export const DIRECTIONS = Object.freeze({
ORTHOGONAL: [
{ row: -1, col: 0 }, // Up
{ row: 1, col: 0 }, // Down
{ row: 0, col: -1 }, // Left
{ row: 0, col: 1 } // Right
],
DIAGONAL: [
{ row: -1, col: -1 }, // Up-left
{ row: -1, col: 1 }, // Up-right
{ row: 1, col: -1 }, // Down-left
{ row: 1, col: 1 } // Down-right
],
KNIGHT: [
{ row: -2, col: -1 }, { row: -2, col: 1 },
{ row: -1, col: -2 }, { row: -1, col: 2 },
{ row: 1, col: -2 }, { row: 1, col: 2 },
{ row: 2, col: -1 }, { row: 2, col: 1 }
]
});
/**
* Files (columns) mapping
*/
export const FILES = Object.freeze({
a: 0, b: 1, c: 2, d: 3, e: 4, f: 5, g: 6, h: 7
});
/**
* Ranks (rows) mapping
* Note: rank 1 is row 7 in our array (bottom of board)
*/
export const RANKS = Object.freeze({
1: 7, 2: 6, 3: 5, 4: 4, 5: 3, 6: 2, 7: 1, 8: 0
});