A unique chess variant played on a 3D cube where pieces can move across faces, with selective rotation mechanics and full mobile support.
- Traditional Rules: Standard chess movement rules apply within each face
- Edge Transitions: Pieces can seamlessly move to adjacent faces when their movement reaches an edge
- Spatial Continuity: Face adjacency is mapped to maintain logical spatial relationships
- Supported Pieces: Currently implemented for Rooks and Pawns, extensible to other pieces
Front Face:
↑ Top | ↓ Bottom | ← Left | → Right
Back Face:
↑ Top | ↓ Bottom | ← Right | → Left
Top Face:
↑ Back | ↓ Front | ← Left | → Right
Bottom Face:
↑ Front | ↓ Back | ← Left | → Right
Left Face:
↑ Top | ↓ Bottom | ← Back | → Front
Right Face:
↑ Top | ↓ Bottom | ← Front | → Back
Players can rotate individual rows or columns instead of the entire cube:
- Rotate the entire cube view with mouse drag or touch
- Zoom with scroll wheel or pinch gesture
- Does not affect piece positions
- Select a specific row (0-7)
- Rotate pieces horizontally around the cube
- Moves through: Front → Left → Back → Right → Front
- Useful for strategic repositioning
- Select a specific column (0-7)
- Rotate pieces vertically around the cube
- Moves through: Front → Top → Back → Bottom → Front
- Enables vertical tactical maneuvers
- Breakpoints at 768px (tablet) and 480px (mobile)
- Adaptive layout that maximizes playable area
- Touch-optimized button sizes and spacing
- Tap: Select pieces and make moves
- Drag: Rotate cube view (in view rotation mode)
- Pinch: Zoom in/out
- Two-finger gestures: Supported for zoom
- Hamburger menu button on mobile devices
- Slide-up animation for controls panel
- Keeps the game board unobstructed
- Easy access to all game options
- All traditional piece movements (within faces)
- Check and checkmate detection
- Turn-based gameplay
- AI opponent (simple random move selection)
- Rubik's Twist: Rotate the entire cube after a move
- Visual indicators for selected pieces (blue highlight)
- Valid move indicators (green squares)
- Check warnings
- Rotate View: Click + drag on the cube
- Zoom: Scroll wheel
- Select Piece: Click on a piece
- Move: Click on a valid (green) square
- Menu: Tap the hamburger icon (☰) to access controls
- Rotate View: Touch + drag on the cube
- Zoom: Pinch gesture
- Select Piece: Tap on a piece
- Move: Tap on a valid (green) square
cubechess.html: Entry point with basic HTML structurecubechess.js: Game logic, 3D rendering, and event handlingcubechess.css: Styling, responsive design, and animations
getAdjacentFacePosition(face, row, col, direction)
// Returns the corresponding position on an adjacent face
// Handles edge-to-edge transitions for cross-face movement
getValidMoves(faces, face, row, col)
// Calculates valid moves including cross-face options
// Respects traditional chess rules plus cube mechanicsrotateRow(rowIndex, clockwise)
// Rotates a horizontal row around the cube
// Cycles pieces through 4 faces
rotateColumn(colIndex, clockwise)
// Rotates a vertical column around the cube
// Handles coordinate transformations for back face- Canvas 2D with pseudo-3D projection
- Depth sorting for proper face visibility
- Back-face culling for performance
- Responsive canvas sizing
- Modern browsers with ES6 support
- Canvas 2D support required
- Touch events for mobile devices
- Tested on Chrome, Firefox, Safari, and Edge
Potential additions for future versions:
- Complete cross-face movement for all piece types (Knight, Bishop, Queen, King)
- Multi-path movement options when crossing faces
- Enhanced AI with strategic cube rotation
- Multiplayer support
- Move history and undo functionality
- Custom cube themes and piece styles
- Game save/load functionality
- Self-contained IIFE pattern
- No external dependencies
- Event-driven architecture
- Modular function organization
- Efficient canvas clearing and redrawing
- Depth sorting only when needed
- Touch event passive listeners where appropriate
- Minimal DOM manipulation
- Semantic HTML structure
- ARIA labels on interactive elements
- Keyboard-friendly button controls
- High contrast visual indicators
Developed as part of the SalSoftware project.