Quantcast
Channel: Rock-Paper-Scissors-Lizard-Spock Challenge - Code Review Stack Exchange
Browsing all 5 articles
Browse latest View live

Answer by Rafe for Rock-Paper-Scissors-Lizard-Spock Challenge

I'm somewhat old-school in that I don't think OO is the right answer to every problem. Here's my effort:void Main(){ foreach (var left in Enumerable.Range(0, (int)A.Count).Cast<A>()) { foreach...

View Article



Answer by svick for Rock-Paper-Scissors-Lizard-Spock Challenge

this sounded like IComparable<T>But it's not. The documentation of Compare() states that the relation has to be transitive:If A.CompareTo(B) returns a value x that is not equal to zero, and...

View Article

Answer by ChrisWue for Rock-Paper-Scissors-Lizard-Spock Challenge

Let's look at your code from an extensibility point of view:If Sheldon decides to add a new item to the game then you have to go to n classes to adjust the comparisons and winning verbs. I usually try...

View Article

Answer by dreza for Rock-Paper-Scissors-Lizard-Spock Challenge

We could perhaps do away with the bulk of the children class code by implementing a bit of logic in the base class.A starting point for discussion would be something along the lines of:public abstract...

View Article

Rock-Paper-Scissors-Lizard-Spock Challenge

"Scissors cuts paper, paper covers rock, rock crushes lizard, lizard poisons Spock, Spock smashes scissors, scissors decapitate lizard, lizard eats paper, paper disproves Spock, Spock vaporizes rock....

View Article

Browsing all 5 articles
Browse latest View live




Latest Images