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,27 @@
|
||||
/// A polyomino with fixed orientation (no rotation at play time, genre
|
||||
/// convention). Offsets are normalized cell positions relative to the
|
||||
/// top-left anchor.
|
||||
class Piece {
|
||||
const Piece({
|
||||
required this.id,
|
||||
required this.offsets,
|
||||
required this.colorId,
|
||||
this.weight = 1.0,
|
||||
this.tier = 1,
|
||||
});
|
||||
|
||||
final String id;
|
||||
final List<(int, int)> offsets;
|
||||
final int colorId;
|
||||
|
||||
/// Base draw weight; stage generator profiles scale this.
|
||||
final double weight;
|
||||
|
||||
/// Difficulty tier 1 (easy to fit) .. 3 (demanding).
|
||||
final int tier;
|
||||
|
||||
int get size => offsets.length;
|
||||
|
||||
@override
|
||||
String toString() => 'Piece($id)';
|
||||
}
|
||||
Reference in New Issue
Block a user