diff --git a/75_Roulette/csharp/Resources/AgainPrompt.txt b/75_Roulette/csharp/Resources/AgainPrompt.txt new file mode 100644 index 00000000..e69de29b diff --git a/75_Roulette/csharp/Resources/BetAlready.txt b/75_Roulette/csharp/Resources/BetAlready.txt new file mode 100644 index 00000000..be86cbea --- /dev/null +++ b/75_Roulette/csharp/Resources/BetAlready.txt @@ -0,0 +1 @@ +You made that bet once already,dum-dum \ No newline at end of file diff --git a/75_Roulette/csharp/Resources/BetPrompt.txt b/75_Roulette/csharp/Resources/BetPrompt.txt new file mode 100644 index 00000000..50039840 --- /dev/null +++ b/75_Roulette/csharp/Resources/BetPrompt.txt @@ -0,0 +1 @@ +Number {0} \ No newline at end of file diff --git a/75_Roulette/csharp/Resources/BrokeHouse.txt b/75_Roulette/csharp/Resources/BrokeHouse.txt new file mode 100644 index 00000000..638dafb4 --- /dev/null +++ b/75_Roulette/csharp/Resources/BrokeHouse.txt @@ -0,0 +1 @@ +You broke the house! diff --git a/75_Roulette/csharp/Resources/Check.txt b/75_Roulette/csharp/Resources/Check.txt new file mode 100644 index 00000000..f2be95cd --- /dev/null +++ b/75_Roulette/csharp/Resources/Check.txt @@ -0,0 +1,14 @@ +------------------------------------------------------------------------Check No. {0} + + {1:mmmm d',' yyyy} + + +Pay to the order of-----{2}-----$ {3} + + + The Memory Bank of New YORK + + The Computer + ----------X----- + +--------------------------------------------------------------Come back soon! diff --git a/75_Roulette/csharp/Resources/CheckPrompt.txt b/75_Roulette/csharp/Resources/CheckPrompt.txt new file mode 100644 index 00000000..16321fe9 --- /dev/null +++ b/75_Roulette/csharp/Resources/CheckPrompt.txt @@ -0,0 +1 @@ +To whom shall I make the check \ No newline at end of file diff --git a/75_Roulette/csharp/Resources/HowManyBetsPrompt.txt b/75_Roulette/csharp/Resources/HowManyBetsPrompt.txt new file mode 100644 index 00000000..0b6abdfa --- /dev/null +++ b/75_Roulette/csharp/Resources/HowManyBetsPrompt.txt @@ -0,0 +1 @@ +How many bets \ No newline at end of file diff --git a/75_Roulette/csharp/Resources/Instructions.txt b/75_Roulette/csharp/Resources/Instructions.txt new file mode 100644 index 00000000..8ced724b --- /dev/null +++ b/75_Roulette/csharp/Resources/Instructions.txt @@ -0,0 +1,48 @@ + +This is the betting layout + (*=RED) + + 1* 2 3* + 4 5* 6 + 7* 8 9* +10 11 12* +--------------- +13 14* 15 +16* 17 18* +19* 20 21* +22 23* 24 +--------------- +25* 26 27* +28 29 30* +31 32* 33 +34* 35 36* +--------------- + 00 0 + +Types of bets + +The numbers 1 to 36 signify a straight bet +on that number. +These pay off 35:1 + +The 2:1 bets are: + 37) 1-12 40) First column + 38) 13-24 41) Second column + 39) 25-36 42) Third column + +The even money bets are: + 43) 1-18 46) Odd + 44) 19-36 47) Red + 45) Even 48) Black + +49)0 and 50)00 pay off 35:1 +Note: 0 and 00 do not count under any + bets except their own. + +When I ask for each bet, type the number +and the amount, separated by a comma. +For example: to bet $500 on Black, type 48,500 +when I ask for a bet. + +The minimum bet is $5, the maximum is $500. + diff --git a/75_Roulette/csharp/Resources/InstructionsPrompt.txt b/75_Roulette/csharp/Resources/InstructionsPrompt.txt new file mode 100644 index 00000000..0d311b60 --- /dev/null +++ b/75_Roulette/csharp/Resources/InstructionsPrompt.txt @@ -0,0 +1 @@ +Do you want instructions \ No newline at end of file diff --git a/75_Roulette/csharp/Resources/LastDollar.txt b/75_Roulette/csharp/Resources/LastDollar.txt new file mode 100644 index 00000000..632516de --- /dev/null +++ b/75_Roulette/csharp/Resources/LastDollar.txt @@ -0,0 +1 @@ +Oops! you just spent your last dollar! diff --git a/75_Roulette/csharp/Resources/Outcome.txt b/75_Roulette/csharp/Resources/Outcome.txt new file mode 100644 index 00000000..7926cb87 --- /dev/null +++ b/75_Roulette/csharp/Resources/Outcome.txt @@ -0,0 +1 @@ +You {0} {1} dollars on bet {2} \ No newline at end of file diff --git a/75_Roulette/csharp/Resources/Resource.cs b/75_Roulette/csharp/Resources/Resource.cs new file mode 100644 index 00000000..aca0aaf5 --- /dev/null +++ b/75_Roulette/csharp/Resources/Resource.cs @@ -0,0 +1,59 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using Games.Common.Randomness; + +namespace Roulette.Resources; + +internal static class Resource +{ + internal static class Streams + { + public static Stream Title => GetStream(); + public static Stream Instructions => GetStream(); + public static Stream BetAlready => GetStream(); + public static Stream Spinning => GetStream(); + public static Stream LastDollar => GetStream(); + public static Stream BrokeHouse => GetStream(); + public static Stream Thanks => GetStream(); + } + + internal static class Strings + { + public static string Black(int number) => Slot(number); + public static string Red(int number) => Slot(number); + private static string Slot(int number, [CallerMemberName] string? colour = null) + => string.Format(GetString(), number, colour); + + public static string Lose(int amount, int bet) => Outcome(amount, bet); + public static string Win(int amount, int bet) => Outcome(amount, bet); + private static string Outcome(int amount, int bet, [CallerMemberName] string? winlose = null) + => string.Format(GetString(), winlose, amount, bet); + + public static string Totals(int me, int you) => string.Format(GetString(), me, you); + + public static string Check(IRandom random, string payee, int amount) + => string.Format(GetString(), random.Next(100), DateTime.Now, payee, amount); + } + + internal static class Prompts + { + public static string Instructions => GetPrompt(); + public static string HowManyBets => GetPrompt(); + public static string Bet(int number) => string.Format(GetPrompt(), number); + public static string Again => GetPrompt(); + public static string Check => GetPrompt(); + } + + private static string GetPrompt([CallerMemberName] string? name = null) => GetString($"{name}Prompt"); + + private static string GetString([CallerMemberName] string? name = null) + { + using var stream = GetStream(name); + using var reader = new StreamReader(stream); + return reader.ReadToEnd(); + } + + private static Stream GetStream([CallerMemberName] string? name = null) => + Assembly.GetExecutingAssembly().GetManifestResourceStream($"{typeof(Resource).Namespace}.{name}.txt") + ?? throw new Exception($"Could not find embedded resource stream '{name}'."); +} \ No newline at end of file diff --git a/75_Roulette/csharp/Resources/Slot.txt b/75_Roulette/csharp/Resources/Slot.txt new file mode 100644 index 00000000..d45e103b --- /dev/null +++ b/75_Roulette/csharp/Resources/Slot.txt @@ -0,0 +1,2 @@ + {0} {1} + \ No newline at end of file diff --git a/75_Roulette/csharp/Resources/Spinning.txt b/75_Roulette/csharp/Resources/Spinning.txt new file mode 100644 index 00000000..13514a0a --- /dev/null +++ b/75_Roulette/csharp/Resources/Spinning.txt @@ -0,0 +1,3 @@ +SPINNING + + diff --git a/75_Roulette/csharp/Resources/Thanks.txt b/75_Roulette/csharp/Resources/Thanks.txt new file mode 100644 index 00000000..0b835237 --- /dev/null +++ b/75_Roulette/csharp/Resources/Thanks.txt @@ -0,0 +1,3 @@ +Thanks for you money. +I'll use it to buy a solid gold roulette WHEEL + diff --git a/75_Roulette/csharp/Resources/Title.txt b/75_Roulette/csharp/Resources/Title.txt new file mode 100644 index 00000000..0d53f1a8 --- /dev/null +++ b/75_Roulette/csharp/Resources/Title.txt @@ -0,0 +1,7 @@ + Roulette + Creative Computing Morristown, New Jersey + + + +Welcome to the roulette table + diff --git a/75_Roulette/csharp/Resources/Totals.txt b/75_Roulette/csharp/Resources/Totals.txt new file mode 100644 index 00000000..26f35724 --- /dev/null +++ b/75_Roulette/csharp/Resources/Totals.txt @@ -0,0 +1,2 @@ +Totals Me You + {0,-14}{1}