mirror of
https://github.com/coding-horror/basic-computer-games.git
synced 2026-06-22 22:56:08 -07:00
Add string resources
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
|
||||
Congratulations
|
||||
@@ -0,0 +1 @@
|
||||
How many disks do you want to move (7 is max)
|
||||
@@ -0,0 +1,2 @@
|
||||
All right, wise guy, if you can't play the game right, I'll
|
||||
just take my puzzle and go home. So long.
|
||||
@@ -0,0 +1 @@
|
||||
Sorry, but i can't do that job for you.
|
||||
@@ -0,0 +1 @@
|
||||
Which disk would you like to move
|
||||
@@ -0,0 +1 @@
|
||||
Stop wasting my time. Go bother someone else.
|
||||
@@ -0,0 +1 @@
|
||||
Illegal entry... You may only type 3, 5, 7, 9, 11, 13, or 15.
|
||||
@@ -0,0 +1 @@
|
||||
That disk is below another one. Make another choice.
|
||||
@@ -0,0 +1,3 @@
|
||||
You can't place a larger disk on top of a smaller one,
|
||||
it might crush it!
|
||||
Now then,
|
||||
@@ -0,0 +1,10 @@
|
||||
In this program, we shall refer to disks by numerical code.
|
||||
3 will represent the smallest disk, 5 the next size,
|
||||
7 the next, and so on, up to 15. If you do the puzzle with
|
||||
2 disks, their code names would be 13 and 15. With 3 disks
|
||||
the code names would be 11, 13 and 15, etc. The needles
|
||||
are numbered from left to right, 1 to 3. We will
|
||||
startup with the disks on needle 1, and attempt to move them
|
||||
to needle 3.
|
||||
|
||||
Good luck!
|
||||
@@ -0,0 +1,11 @@
|
||||
Towers
|
||||
Creative Computing Morristown, New Jersey
|
||||
|
||||
|
||||
|
||||
Towers of Hanoi puzzle.
|
||||
|
||||
You must transfer the disks from the left to the right
|
||||
tower, one at a time, never putting a larger dish on a
|
||||
smaller disk.
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
Place disk on which needle
|
||||
@@ -0,0 +1,2 @@
|
||||
I tried to warn you, but you wouldn't listen,
|
||||
Bye bye, big shot.
|
||||
@@ -0,0 +1,2 @@
|
||||
I'll assume you hit the wrong key this time. But watch it,
|
||||
I only allow one mistake
|
||||
@@ -0,0 +1,2 @@
|
||||
|
||||
Try again (Yes or No)
|
||||
@@ -0,0 +1,38 @@
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace Tower.Resources
|
||||
{
|
||||
internal static class Strings
|
||||
{
|
||||
internal static string Congratulations => GetResource();
|
||||
internal static string DiskCountPrompt => GetResource();
|
||||
internal static string DiskCountQuit => GetResource();
|
||||
internal static string DiskCountRetry => GetResource();
|
||||
internal static string DiskPrompt => GetResource();
|
||||
internal static string DiskQuit => GetResource();
|
||||
internal static string DiskRetry => GetResource();
|
||||
internal static string DiskUnavailable => GetResource();
|
||||
internal static string IllegalMove => GetResource();
|
||||
internal static string Instructions => GetResource();
|
||||
internal static string Intro => GetResource();
|
||||
internal static string NeedlePrompt => GetResource();
|
||||
internal static string NeedleQuit => GetResource();
|
||||
internal static string NeedleRetry => GetResource();
|
||||
internal static string PlayAgainPrompt => GetResource();
|
||||
internal static string Thanks => GetResource();
|
||||
internal static string Title => GetResource();
|
||||
internal static string TooManyMoves => GetResource();
|
||||
internal static string YesNoPrompt => GetResource();
|
||||
|
||||
private static string GetResource([CallerMemberName] string name = "")
|
||||
{
|
||||
var streamName = $"Tower.Resources.{name}.txt";
|
||||
using var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(streamName);
|
||||
using var reader = new StreamReader(stream);
|
||||
|
||||
return reader.ReadToEnd();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
|
||||
Thanks for the game!
|
||||
@@ -0,0 +1,11 @@
|
||||
Towers
|
||||
Creative Computing Morristown, New Jersey
|
||||
|
||||
|
||||
|
||||
Towers of Hanoi puzzle.
|
||||
|
||||
You must transfer the disks from the left to the right
|
||||
tower, one at a time, never putting a larger dish on a
|
||||
smaller disk.
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
Sorry, but i have orders to stop is you make more than
|
||||
128 moves.
|
||||
@@ -0,0 +1,2 @@
|
||||
|
||||
'Yes' or 'No' please
|
||||
@@ -5,4 +5,8 @@
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Resources\*.txt" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
Reference in New Issue
Block a user