mirror of
https://github.com/coding-horror/basic-computer-games.git
synced 2025-12-23 15:37:51 -08:00
Add string resources
This commit is contained in:
0
75_Roulette/csharp/Resources/AgainPrompt.txt
Normal file
0
75_Roulette/csharp/Resources/AgainPrompt.txt
Normal file
1
75_Roulette/csharp/Resources/BetAlready.txt
Normal file
1
75_Roulette/csharp/Resources/BetAlready.txt
Normal file
@@ -0,0 +1 @@
|
||||
You made that bet once already,dum-dum
|
||||
1
75_Roulette/csharp/Resources/BetPrompt.txt
Normal file
1
75_Roulette/csharp/Resources/BetPrompt.txt
Normal file
@@ -0,0 +1 @@
|
||||
Number {0}
|
||||
1
75_Roulette/csharp/Resources/BrokeHouse.txt
Normal file
1
75_Roulette/csharp/Resources/BrokeHouse.txt
Normal file
@@ -0,0 +1 @@
|
||||
You broke the house!
|
||||
14
75_Roulette/csharp/Resources/Check.txt
Normal file
14
75_Roulette/csharp/Resources/Check.txt
Normal file
@@ -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!
|
||||
1
75_Roulette/csharp/Resources/CheckPrompt.txt
Normal file
1
75_Roulette/csharp/Resources/CheckPrompt.txt
Normal file
@@ -0,0 +1 @@
|
||||
To whom shall I make the check
|
||||
1
75_Roulette/csharp/Resources/HowManyBetsPrompt.txt
Normal file
1
75_Roulette/csharp/Resources/HowManyBetsPrompt.txt
Normal file
@@ -0,0 +1 @@
|
||||
How many bets
|
||||
48
75_Roulette/csharp/Resources/Instructions.txt
Normal file
48
75_Roulette/csharp/Resources/Instructions.txt
Normal file
@@ -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.
|
||||
|
||||
1
75_Roulette/csharp/Resources/InstructionsPrompt.txt
Normal file
1
75_Roulette/csharp/Resources/InstructionsPrompt.txt
Normal file
@@ -0,0 +1 @@
|
||||
Do you want instructions
|
||||
1
75_Roulette/csharp/Resources/LastDollar.txt
Normal file
1
75_Roulette/csharp/Resources/LastDollar.txt
Normal file
@@ -0,0 +1 @@
|
||||
Oops! you just spent your last dollar!
|
||||
1
75_Roulette/csharp/Resources/Outcome.txt
Normal file
1
75_Roulette/csharp/Resources/Outcome.txt
Normal file
@@ -0,0 +1 @@
|
||||
You {0} {1} dollars on bet {2}
|
||||
59
75_Roulette/csharp/Resources/Resource.cs
Normal file
59
75_Roulette/csharp/Resources/Resource.cs
Normal file
@@ -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}'.");
|
||||
}
|
||||
2
75_Roulette/csharp/Resources/Slot.txt
Normal file
2
75_Roulette/csharp/Resources/Slot.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
{0} {1}
|
||||
|
||||
3
75_Roulette/csharp/Resources/Spinning.txt
Normal file
3
75_Roulette/csharp/Resources/Spinning.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
SPINNING
|
||||
|
||||
|
||||
3
75_Roulette/csharp/Resources/Thanks.txt
Normal file
3
75_Roulette/csharp/Resources/Thanks.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
Thanks for you money.
|
||||
I'll use it to buy a solid gold roulette WHEEL
|
||||
|
||||
7
75_Roulette/csharp/Resources/Title.txt
Normal file
7
75_Roulette/csharp/Resources/Title.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
Roulette
|
||||
Creative Computing Morristown, New Jersey
|
||||
|
||||
|
||||
|
||||
Welcome to the roulette table
|
||||
|
||||
2
75_Roulette/csharp/Resources/Totals.txt
Normal file
2
75_Roulette/csharp/Resources/Totals.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
Totals Me You
|
||||
{0,-14}{1}
|
||||
Reference in New Issue
Block a user