Go Fish/D: Difference between revisions

m
Fixed syntax highlighting.
(Two small improvements in D entry)
m (Fixed syntax highlighting.)
 
(One intermediate revision by one other user not shown)
Line 4:
 
In D strings are only partially reference types, unlike in Python, so I have used a small class to keep the shared deck. I have also used an abstract class to simplify and reduce the code compared to the Python entry that has some code duplication.
<langsyntaxhighlight lang="d">import std.stdio, std.random, std.range, std.string, std.array,
std.algorithm;
 
alias replicate = std.array.replicate; //
 
class EndGameException : Exception {
Line 224 ⟶ 222:
} catch (EndGameException)
writeln("Game finished.");
}</langsyntaxhighlight>
9,482

edits