mirror of
https://github.com/coding-horror/basic-computer-games.git
synced 2026-01-06 10:05:45 -08:00
CSHARP-53 Create program sturcture
This commit is contained in:
1
53_King/csharp/Resources/Instructions_Prompt.txt
Normal file
1
53_King/csharp/Resources/Instructions_Prompt.txt
Normal file
@@ -0,0 +1 @@
|
||||
Do you want instructions
|
||||
17
53_King/csharp/Resources/Instructions_Text.txt
Normal file
17
53_King/csharp/Resources/Instructions_Text.txt
Normal file
@@ -0,0 +1,17 @@
|
||||
|
||||
|
||||
|
||||
Congratulations! You've just been elected Premier of Setats
|
||||
Detinu, a small communist island 30 by 70 miles long. Your
|
||||
job is to decide upon the country's budget and distribute
|
||||
money to your countrymen from the communal treasury.
|
||||
The money system is rallods, and each person needs 100
|
||||
rallods per year to survive. Your country's income comes
|
||||
from farm produce and tourists visiting your magnificent
|
||||
forests, hunting, fishing, etc. Half your land if farm land
|
||||
which also has an excellent mineral content and may be sold
|
||||
to foreign industry (strip mining) who import and support
|
||||
their own workers. Crops cost between 10 and 15 rallods per
|
||||
square mile to plant.
|
||||
Your goal is to complete your {0} year term of office.
|
||||
Good luck!
|
||||
45
53_King/csharp/Resources/Resource.cs
Normal file
45
53_King/csharp/Resources/Resource.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace King.Resources;
|
||||
|
||||
internal static class Resource
|
||||
{
|
||||
public static Stream Title => GetStream();
|
||||
|
||||
public static string Instructions_Prompt => GetString();
|
||||
public static string Instructions_Text(int years) => string.Format(GetString(), years);
|
||||
|
||||
internal static class Formats
|
||||
{
|
||||
public static string Player => GetString();
|
||||
public static string YouLose => GetString();
|
||||
}
|
||||
|
||||
internal static class Prompts
|
||||
{
|
||||
public static string WantInstructions => GetString();
|
||||
public static string HowManyPlayers => GetString();
|
||||
public static string HowManyRows => GetString();
|
||||
public static string HowManyColumns => GetString();
|
||||
public static string TooManyColumns => GetString();
|
||||
}
|
||||
|
||||
internal static class Strings
|
||||
{
|
||||
public static string TooManyColumns => GetString();
|
||||
public static string TooManyRows => GetString();
|
||||
}
|
||||
|
||||
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}'.");
|
||||
}
|
||||
5
53_King/csharp/Resources/Title.txt
Normal file
5
53_King/csharp/Resources/Title.txt
Normal file
@@ -0,0 +1,5 @@
|
||||
King
|
||||
Creative Computing Morristown, New Jersey
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user