Just another update
This commit is contained in:
parent
a25938f123
commit
00a190b0a6
6591 changed files with 94363 additions and 23227 deletions
|
|
@ -1,7 +1,7 @@
|
|||
enum side = 8;
|
||||
__gshared int[side] board;
|
||||
|
||||
bool isUnsafe(in int y) nothrow {
|
||||
bool isUnsafe(in int y) nothrow @nogc {
|
||||
immutable int x = board[y];
|
||||
foreach (immutable i; 1 .. y + 1) {
|
||||
immutable int t = board[y - i];
|
||||
|
|
@ -12,7 +12,7 @@ bool isUnsafe(in int y) nothrow {
|
|||
return false;
|
||||
}
|
||||
|
||||
void showBoard() nothrow {
|
||||
void showBoard() nothrow @nogc {
|
||||
import core.stdc.stdio;
|
||||
|
||||
static int s = 1;
|
||||
|
|
@ -24,7 +24,7 @@ void showBoard() nothrow {
|
|||
}
|
||||
}
|
||||
|
||||
void main() nothrow {
|
||||
void main() nothrow @nogc {
|
||||
int y = 0;
|
||||
board[0] = -1;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
ulong nQueens(in uint nn) pure nothrow
|
||||
ulong nQueens(in uint nn) pure nothrow @nogc @safe
|
||||
in {
|
||||
assert(nn > 0 && nn <= 27,
|
||||
"'side' value must be in 1 .. 27.");
|
||||
|
|
@ -38,7 +38,7 @@ in {
|
|||
// Because !d is often faster than d != n.
|
||||
while (d) {
|
||||
// immutable uint pos = 1U << bits.bsf; // Slower.
|
||||
immutable uint pos = -(cast(int)bits) & bits;
|
||||
immutable uint pos = -int(bits) & bits;
|
||||
|
||||
// Mark bit used. Only put current bits on
|
||||
// stack if not zero, so backtracking will
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue