Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Replace ugly switch statement in hub with dictionary
- Loading branch information
1 parent
991aa37
commit 4baca02
Showing
3 changed files
with
25 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using Yahtzee.Framework; | ||
|
||
namespace Website.HubHelpers | ||
{ | ||
public static class LowerSectionScorer | ||
{ | ||
public static Dictionary<string, Func<IScoreSheet, IDiceCup, int?>> Score = new Dictionary<string, Func<IScoreSheet, IDiceCup, int?>> | ||
{ | ||
{"threeofakind", (scoreSheet, diceCup) => scoreSheet.RecordThreeOfAKind(diceCup)}, | ||
{"fourofakind", (scoreSheet, diceCup) =>scoreSheet.RecordFourOfAKind(diceCup)}, | ||
{"fullhouse", (scoreSheet, diceCup)=> scoreSheet.RecordFullHouse(diceCup)}, | ||
{"smallstraight", (scoreSheet, diceCup) => scoreSheet.RecordSmallStraight(diceCup)}, | ||
{"largestraight", (scoreSheet, diceCup) => scoreSheet.RecordLargeStraight(diceCup)}, | ||
{"yahtzee", (scoreSheet, diceCup)=> scoreSheet.RecordYahtzee(diceCup)}, | ||
{"chance", (scoreSheet, diceCup) => scoreSheet.RecordChance(diceCup)} | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters