mirror of
https://github.com/coding-horror/basic-computer-games.git
synced 2025-12-27 21:23:30 -08:00
Add string resources
This commit is contained in:
2
90 Tower/csharp/Tower/Resources/Congratulations.txt
Normal file
2
90 Tower/csharp/Tower/Resources/Congratulations.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
|
||||
Congratulations
|
||||
1
90 Tower/csharp/Tower/Resources/DiskCountPrompt.txt
Normal file
1
90 Tower/csharp/Tower/Resources/DiskCountPrompt.txt
Normal file
@@ -0,0 +1 @@
|
||||
How many disks do you want to move (7 is max)
|
||||
2
90 Tower/csharp/Tower/Resources/DiskCountQuit.txt
Normal file
2
90 Tower/csharp/Tower/Resources/DiskCountQuit.txt
Normal file
@@ -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.
|
||||
1
90 Tower/csharp/Tower/Resources/DiskCountRetry.txt
Normal file
1
90 Tower/csharp/Tower/Resources/DiskCountRetry.txt
Normal file
@@ -0,0 +1 @@
|
||||
Sorry, but i can't do that job for you.
|
||||
1
90 Tower/csharp/Tower/Resources/DiskPrompt.txt
Normal file
1
90 Tower/csharp/Tower/Resources/DiskPrompt.txt
Normal file
@@ -0,0 +1 @@
|
||||
Which disk would you like to move
|
||||
1
90 Tower/csharp/Tower/Resources/DiskQuit.txt
Normal file
1
90 Tower/csharp/Tower/Resources/DiskQuit.txt
Normal file
@@ -0,0 +1 @@
|
||||
Stop wasting my time. Go bother someone else.
|
||||
1
90 Tower/csharp/Tower/Resources/DiskRetry.txt
Normal file
1
90 Tower/csharp/Tower/Resources/DiskRetry.txt
Normal file
@@ -0,0 +1 @@
|
||||
Illegal entry... You may only type 3, 5, 7, 9, 11, 13, or 15.
|
||||
1
90 Tower/csharp/Tower/Resources/DiskUnavailable.txt
Normal file
1
90 Tower/csharp/Tower/Resources/DiskUnavailable.txt
Normal file
@@ -0,0 +1 @@
|
||||
That disk is below another one. Make another choice.
|
||||
3
90 Tower/csharp/Tower/Resources/IllegalMove.txt
Normal file
3
90 Tower/csharp/Tower/Resources/IllegalMove.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
You can't place a larger disk on top of a smaller one,
|
||||
it might crush it!
|
||||
Now then,
|
||||
10
90 Tower/csharp/Tower/Resources/Instructions.txt
Normal file
10
90 Tower/csharp/Tower/Resources/Instructions.txt
Normal file
@@ -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!
|
||||
11
90 Tower/csharp/Tower/Resources/Intro.txt
Normal file
11
90 Tower/csharp/Tower/Resources/Intro.txt
Normal file
@@ -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.
|
||||
|
||||
1
90 Tower/csharp/Tower/Resources/NeedlePrompt.txt
Normal file
1
90 Tower/csharp/Tower/Resources/NeedlePrompt.txt
Normal file
@@ -0,0 +1 @@
|
||||
Place disk on which needle
|
||||
2
90 Tower/csharp/Tower/Resources/NeedleQuit.txt
Normal file
2
90 Tower/csharp/Tower/Resources/NeedleQuit.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
I tried to warn you, but you wouldn't listen,
|
||||
Bye bye, big shot.
|
||||
2
90 Tower/csharp/Tower/Resources/NeedleRetry.txt
Normal file
2
90 Tower/csharp/Tower/Resources/NeedleRetry.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
I'll assume you hit the wrong key this time. But watch it,
|
||||
I only allow one mistake
|
||||
2
90 Tower/csharp/Tower/Resources/PlayAgainPrompt.txt
Normal file
2
90 Tower/csharp/Tower/Resources/PlayAgainPrompt.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
|
||||
Try again (Yes or No)
|
||||
38
90 Tower/csharp/Tower/Resources/Strings.cs
Normal file
38
90 Tower/csharp/Tower/Resources/Strings.cs
Normal file
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
2
90 Tower/csharp/Tower/Resources/Thanks.txt
Normal file
2
90 Tower/csharp/Tower/Resources/Thanks.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
|
||||
Thanks for the game!
|
||||
11
90 Tower/csharp/Tower/Resources/Title.txt
Normal file
11
90 Tower/csharp/Tower/Resources/Title.txt
Normal file
@@ -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.
|
||||
|
||||
2
90 Tower/csharp/Tower/Resources/TooManyMoves.txt
Normal file
2
90 Tower/csharp/Tower/Resources/TooManyMoves.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
Sorry, but i have orders to stop is you make more than
|
||||
128 moves.
|
||||
2
90 Tower/csharp/Tower/Resources/YesNoPrompt.txt
Normal file
2
90 Tower/csharp/Tower/Resources/YesNoPrompt.txt
Normal file
@@ -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