Add resources

This commit is contained in:
Andrew Cooper
2022-07-17 16:48:42 +10:00
parent 320f5dede0
commit 203f930e12
13 changed files with 89 additions and 0 deletions

View File

@@ -0,0 +1 @@
Coordinates of Chomp (row, column)

View File

@@ -0,0 +1,2 @@
Here we go...

View File

@@ -0,0 +1 @@
How many columns

View File

@@ -0,0 +1 @@
How many players

View File

@@ -0,0 +1 @@
How many rows

View File

@@ -0,0 +1,6 @@
Chomp
Creative Computing Morristown, New Jersey
This is the game of Chomp (Scientific American, Jan 1973)

View File

@@ -0,0 +1,2 @@
Player {0}
Player {0}

View File

@@ -0,0 +1,42 @@
using System.Reflection;
using System.Runtime.CompilerServices;
namespace Chomp.Resources;
internal static class Resource
{
internal static class Streams
{
public static Stream HereWeGo => GetStream();
public static Stream Introduction => GetStream();
public static Stream Rules => GetStream();
public static Stream TooManyColumns => GetStream();
public static Stream TooManyRows => GetStream();
}
internal static class Formats
{
public static string Player => GetString();
public static string YouLose => GetString();
}
internal static class Prompts
{
public static string Coordinates => GetString();
public static string HowManyPlayers => GetString();
public static string HowManyRows => GetString();
public static string HowManyColumns => 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}'.");
}

View File

@@ -0,0 +1,22 @@
Chomp is for 1 or more players (humans only).
Here's how a board looks (this one is 5 by 7):
1 2 3 4 5 6 7 8 9
1 P * * * * * *
2 * * * * * * *
3 * * * * * * *
4 * * * * * * *
5 * * * * * * *
The board is a big cookie - R rows high and C columns
wide. You input R and C at the start. In the upper left
corner of the cookie is a poison square (P). The one who
chomps the poison square loses. To take a chomp, type the
row and column of one of the squares on the cookie.
All of the squares below and to the right of that square
(including that square, too) disappear -- Chomp!!
No fair chomping on squares that have already been chomped,
or that are outside the original dimensions of the cookie.

View File

@@ -0,0 +1 @@
Too many rows (9 is maximum). Now,

View File

@@ -0,0 +1 @@
Too many rows (9 is maximum). Now,

View File

@@ -0,0 +1 @@
You lose, player {0}