mirror of
https://github.com/coding-horror/basic-computer-games.git
synced 2025-12-26 12:51:29 -08:00
Add resources
This commit is contained in:
1
26_Chomp/csharp/Resources/Coordinates.txt
Normal file
1
26_Chomp/csharp/Resources/Coordinates.txt
Normal file
@@ -0,0 +1 @@
|
||||
Coordinates of Chomp (row, column)
|
||||
2
26_Chomp/csharp/Resources/HereWeGo.txt
Normal file
2
26_Chomp/csharp/Resources/HereWeGo.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
Here we go...
|
||||
|
||||
1
26_Chomp/csharp/Resources/HowManyColumns.txt
Normal file
1
26_Chomp/csharp/Resources/HowManyColumns.txt
Normal file
@@ -0,0 +1 @@
|
||||
How many columns
|
||||
1
26_Chomp/csharp/Resources/HowManyPlayers.txt
Normal file
1
26_Chomp/csharp/Resources/HowManyPlayers.txt
Normal file
@@ -0,0 +1 @@
|
||||
How many players
|
||||
1
26_Chomp/csharp/Resources/HowManyRows.txt
Normal file
1
26_Chomp/csharp/Resources/HowManyRows.txt
Normal file
@@ -0,0 +1 @@
|
||||
How many rows
|
||||
6
26_Chomp/csharp/Resources/Introduction.txt
Normal file
6
26_Chomp/csharp/Resources/Introduction.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
Chomp
|
||||
Creative Computing Morristown, New Jersey
|
||||
|
||||
|
||||
|
||||
This is the game of Chomp (Scientific American, Jan 1973)
|
||||
2
26_Chomp/csharp/Resources/Player.txt
Normal file
2
26_Chomp/csharp/Resources/Player.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
Player {0}
|
||||
Player {0}
|
||||
42
26_Chomp/csharp/Resources/Resource.cs
Normal file
42
26_Chomp/csharp/Resources/Resource.cs
Normal 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}'.");
|
||||
}
|
||||
22
26_Chomp/csharp/Resources/Rules.txt
Normal file
22
26_Chomp/csharp/Resources/Rules.txt
Normal 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.
|
||||
|
||||
1
26_Chomp/csharp/Resources/TooManyColumns.txt
Normal file
1
26_Chomp/csharp/Resources/TooManyColumns.txt
Normal file
@@ -0,0 +1 @@
|
||||
Too many rows (9 is maximum). Now,
|
||||
1
26_Chomp/csharp/Resources/TooManyRows.txt
Normal file
1
26_Chomp/csharp/Resources/TooManyRows.txt
Normal file
@@ -0,0 +1 @@
|
||||
Too many rows (9 is maximum). Now,
|
||||
1
26_Chomp/csharp/Resources/YouLose.txt
Normal file
1
26_Chomp/csharp/Resources/YouLose.txt
Normal file
@@ -0,0 +1 @@
|
||||
You lose, player {0}
|
||||
Reference in New Issue
Block a user