Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,13 @@
|
|||
void main() {
|
||||
import std.stdio, std.range, std.algorithm, std.string, permutations2;
|
||||
|
||||
const pieces = "KQRrBbNN";
|
||||
alias I = indexOf;
|
||||
auto starts = pieces.dup.permutations.filter!(p =>
|
||||
I(p, 'B') % 2 != I(p, 'b') % 2 && // Bishop constraint.
|
||||
// King constraint.
|
||||
((I(p, 'r') < I(p, 'K') && I(p, 'K') < I(p, 'R')) ||
|
||||
(I(p, 'R') < I(p, 'K') && I(p, 'K') < I(p, 'r'))))
|
||||
.map!toUpper.array.sort().uniq;
|
||||
writeln(starts.walkLength, "\n", starts.front);
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
void main() {
|
||||
import std.stdio, std.regex, std.range, std.algorithm, permutations2;
|
||||
|
||||
immutable pieces = "KQRRBBNN";
|
||||
immutable bish = r"B(|..|....|......)B";
|
||||
immutable king = r"R.*K.*R";
|
||||
auto starts3 = permutations(pieces.dup)
|
||||
.filter!(p => p.match(bish) && p.match(king))
|
||||
.array.sort().uniq;
|
||||
writeln(starts3.walkLength, "\n", starts3.front);
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
void main() {
|
||||
import std.stdio, std.random, std.array, std.range;
|
||||
|
||||
// Subsequent order unchanged by insertions.
|
||||
auto start = "RKR".dup;
|
||||
foreach (immutable piece; "QNN")
|
||||
start.insertInPlace(uniform(0, start.length), piece);
|
||||
|
||||
immutable bishpos = uniform(0, start.length);
|
||||
start.insertInPlace(bishpos, 'B');
|
||||
start.insertInPlace(iota(bishpos % 2, start.length, 2)[uniform(0,$)], 'B');
|
||||
start.writeln;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue