Anonymous user
Execute a Markov algorithm: Difference between revisions
Simplified D code
(Improved D code) |
(Simplified D code) |
||
Line 946:
=={{header|D}}==
{{trans|Perl}}
<lang d>import std.stdio, std.array, std.file, std.regex, std.string;
void main() {▼
string[][]
foreach (a; split(cast(string)read(fn), newline ~ newline))
▲void main() {
▲ auto rules = readBlocks("markov_rules.txt");
auto tests = splitlines(cast(string)read("markov_tests.txt"));
Line 973 ⟶ 966:
auto copy = tests[i];
foreach (c; capt) {
tests[i] =
if (c[1] == ".") break;
if (tests[i] != copy)
}
|