import 'piece.dart'; /// The fixed-orientation polyomino set (no play-time rotation, genre /// convention). Base weights skew small pieces common; stage generator /// profiles rescale per difficulty. class PieceLibrary { static const double _small = 1.2; static const double _mid = 1.0; static const double _large = 0.7; static const List all = [ // --- size 1-2 --- Piece(id: 'mono', colorId: 0, weight: _small, tier: 1, offsets: [(0, 0)]), Piece( id: 'domino_h', colorId: 1, weight: _small, tier: 1, offsets: [(0, 0), (1, 0)]), Piece( id: 'domino_v', colorId: 1, weight: _small, tier: 1, offsets: [(0, 0), (0, 1)]), // --- trominoes --- Piece( id: 'line3_h', colorId: 2, weight: _small, tier: 1, offsets: [(0, 0), (1, 0), (2, 0)]), Piece( id: 'line3_v', colorId: 2, weight: _small, tier: 1, offsets: [(0, 0), (0, 1), (0, 2)]), Piece( id: 'corner3_tl', colorId: 3, weight: _small, tier: 1, offsets: [(0, 0), (1, 0), (0, 1)]), Piece( id: 'corner3_tr', colorId: 3, weight: _small, tier: 1, offsets: [(0, 0), (1, 0), (1, 1)]), Piece( id: 'corner3_bl', colorId: 3, weight: _small, tier: 1, offsets: [(0, 0), (0, 1), (1, 1)]), Piece( id: 'corner3_br', colorId: 3, weight: _small, tier: 1, offsets: [(1, 0), (0, 1), (1, 1)]), // --- tetrominoes --- Piece( id: 'line4_h', colorId: 4, weight: _mid, tier: 2, offsets: [(0, 0), (1, 0), (2, 0), (3, 0)]), Piece( id: 'line4_v', colorId: 4, weight: _mid, tier: 2, offsets: [(0, 0), (0, 1), (0, 2), (0, 3)]), Piece( id: 'square2', colorId: 5, weight: _mid, tier: 1, offsets: [(0, 0), (1, 0), (0, 1), (1, 1)]), Piece( id: 't4_up', colorId: 6, weight: _mid, tier: 2, offsets: [(0, 0), (1, 0), (2, 0), (1, 1)]), Piece( id: 't4_down', colorId: 6, weight: _mid, tier: 2, offsets: [(1, 0), (0, 1), (1, 1), (2, 1)]), Piece( id: 't4_left', colorId: 6, weight: _mid, tier: 2, offsets: [(1, 0), (0, 1), (1, 1), (1, 2)]), Piece( id: 't4_right', colorId: 6, weight: _mid, tier: 2, offsets: [(0, 0), (0, 1), (1, 1), (0, 2)]), Piece( id: 's4_h', colorId: 7, weight: _mid, tier: 2, offsets: [(1, 0), (2, 0), (0, 1), (1, 1)]), Piece( id: 's4_v', colorId: 7, weight: _mid, tier: 2, offsets: [(0, 0), (0, 1), (1, 1), (1, 2)]), Piece( id: 'z4_h', colorId: 7, weight: _mid, tier: 2, offsets: [(0, 0), (1, 0), (1, 1), (2, 1)]), Piece( id: 'z4_v', colorId: 7, weight: _mid, tier: 2, offsets: [(1, 0), (0, 1), (1, 1), (0, 2)]), Piece( id: 'l4_0', colorId: 0, weight: _mid, tier: 2, offsets: [(0, 0), (0, 1), (0, 2), (1, 2)]), Piece( id: 'l4_90', colorId: 0, weight: _mid, tier: 2, offsets: [(0, 0), (1, 0), (2, 0), (0, 1)]), Piece( id: 'l4_180', colorId: 0, weight: _mid, tier: 2, offsets: [(0, 0), (1, 0), (1, 1), (1, 2)]), Piece( id: 'l4_270', colorId: 0, weight: _mid, tier: 2, offsets: [(2, 0), (0, 1), (1, 1), (2, 1)]), Piece( id: 'j4_0', colorId: 1, weight: _mid, tier: 2, offsets: [(1, 0), (1, 1), (0, 2), (1, 2)]), Piece( id: 'j4_90', colorId: 1, weight: _mid, tier: 2, offsets: [(0, 0), (0, 1), (1, 1), (2, 1)]), Piece( id: 'j4_180', colorId: 1, weight: _mid, tier: 2, offsets: [(0, 0), (1, 0), (0, 1), (0, 2)]), Piece( id: 'j4_270', colorId: 1, weight: _mid, tier: 2, offsets: [(0, 0), (1, 0), (2, 0), (2, 1)]), // --- size 5-6 --- Piece( id: 'line5_h', colorId: 2, weight: _large, tier: 3, offsets: [(0, 0), (1, 0), (2, 0), (3, 0), (4, 0)]), Piece( id: 'line5_v', colorId: 2, weight: _large, tier: 3, offsets: [(0, 0), (0, 1), (0, 2), (0, 3), (0, 4)]), Piece( id: 'rect2x3', colorId: 3, weight: _large, tier: 2, offsets: [(0, 0), (1, 0), (0, 1), (1, 1), (0, 2), (1, 2)]), Piece( id: 'rect3x2', colorId: 3, weight: _large, tier: 2, offsets: [(0, 0), (1, 0), (2, 0), (0, 1), (1, 1), (2, 1)]), Piece( id: 'bigl_tl', colorId: 4, weight: _large, tier: 3, offsets: [(0, 0), (1, 0), (2, 0), (0, 1), (0, 2)]), Piece( id: 'bigl_tr', colorId: 4, weight: _large, tier: 3, offsets: [(0, 0), (1, 0), (2, 0), (2, 1), (2, 2)]), Piece( id: 'bigl_bl', colorId: 4, weight: _large, tier: 3, offsets: [(0, 0), (0, 1), (0, 2), (1, 2), (2, 2)]), Piece( id: 'bigl_br', colorId: 4, weight: _large, tier: 3, offsets: [(2, 0), (2, 1), (0, 2), (1, 2), (2, 2)]), // --- size 9 --- Piece( id: 'square3', colorId: 5, weight: 0.5, tier: 3, offsets: [ (0, 0), (1, 0), (2, 0), (0, 1), (1, 1), (2, 1), (0, 2), (1, 2), (2, 2), ]), ]; static Piece byId(String id) => all.firstWhere((p) => p.id == id); }