Time for an 2014 update…

This commit is contained in:
Ingy döt Net 2014-01-17 05:32:22 +00:00
parent 372c577f83
commit 09687c4926
2520 changed files with 34227 additions and 7318 deletions

View file

@ -3,7 +3,7 @@ import std.stdio, std.string, std.math, std.array;
struct boxTheCompass {
immutable static string[32] points;
/*pure nothrow*/ static this() {
pure nothrow static this() {
immutable cardinal = ["north", "east", "south", "west"];
immutable desc = ["1", "1 by 2", "1-C", "C by 1", "C",
"C by 2", "2-C", "2 by 1"];
@ -15,13 +15,13 @@ struct boxTheCompass {
(s1 ~ s2) : (s2 ~ s1);
foreach (immutable j; 0 .. 8)
points[i * 8 + j] = desc[j].replace("1", s1).
replace("2", s2).replace("C",sc);
replace("2", s2).replace("C", sc);
}
}
static string opCall(in double degrees) /*pure nothrow*/ {
static string opCall(in double degrees) pure /*nothrow*/ {
immutable testD = (degrees / 11.25) + 0.5;
return capitalize(points[cast(int)floor(testD % 32)]);
return points[cast(int)floor(testD % 32)].capitalize;
}
}