Add pure-Dart engine core: RNG, grid, placement, line clear, scoring, piece generator
PCG32 seeded RNG; immutable 8x8 GridState with occupancy bitmask; placement legality + anyPlacementExists; simultaneous row/col clears with single-count gem credit; combo scoring with one-move grace; weighted-bag generator with pity bias and depth-3 solvability nudge. All TDD, 51 tests green. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
enum CellType { empty, filled, gem }
|
||||
|
||||
class Cell {
|
||||
const Cell(this.type, {this.colorId = 0});
|
||||
|
||||
final CellType type;
|
||||
final int colorId;
|
||||
|
||||
static const empty = Cell(CellType.empty);
|
||||
|
||||
bool get isOccupied => type != CellType.empty;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
other is Cell && other.type == type && other.colorId == colorId;
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(type, colorId);
|
||||
|
||||
@override
|
||||
String toString() => 'Cell(${type.name}, color: $colorId)';
|
||||
}
|
||||
Reference in New Issue
Block a user