34 lines
506 B
Dart
34 lines
506 B
Dart
part of 'generator.dart';
|
|
|
|
int randomOrientation(math.Random random) {
|
|
return random.nextInt(8);
|
|
}
|
|
|
|
Vault reorientVault(Vault o, int r) {
|
|
assert(r >= 0 && r < 8);
|
|
|
|
while (r >= 2) {
|
|
o = o.rotateRight();
|
|
r -= 2;
|
|
}
|
|
if (r == 1) {
|
|
o = o.flip();
|
|
r -= 1;
|
|
}
|
|
return o;
|
|
}
|
|
|
|
Requirement unReorientRequirement(Requirement o, int r) {
|
|
assert(r >= 0 && r < 8);
|
|
|
|
if (r % 2 == 1) {
|
|
o = o.flip();
|
|
r -= 1;
|
|
}
|
|
while (r >= 2) {
|
|
o = o.rotateLeft();
|
|
r -= 2;
|
|
}
|
|
return o;
|
|
}
|