Fix hand comparison text

This commit is contained in:
Andrew Cooper
2022-06-25 16:16:31 +10:00
parent a777b3888b
commit e47864c47f
3 changed files with 5 additions and 6 deletions

View File

@@ -31,7 +31,7 @@ internal class Game
do
{
PlayHand(table);
} while (!table.IsGameOver());
} while (table.ShouldPlayAnotherHand());
}
internal void PlayHand(Table table)

View File

@@ -40,7 +40,6 @@ internal class Human : Player
// The original program had some code about selling a tie tack, but due to a fault
// in the logic the code was unreachable. I've omitted it in this port.
_io.WriteLine("Your wad is shot. So long, sucker!");
IsBroke = true;
}

View File

@@ -88,8 +88,8 @@ internal class Table
_io.WriteLine("My hand:");
_io.Write(Computer.Hand);
_io.WriteLine();
_io.Write($"You have {Human.Hand.Name}");
_io.Write($"and I have {Computer.Hand.Name}");
_io.WriteLine($"You have {Human.Hand.Name}");
_io.WriteLine($"and I have {Computer.Hand.Name}");
if (Computer.Hand > Human.Hand) { return Computer; }
if (Human.Hand > Computer.Hand) { return Human; }
_io.WriteLine("The hand is drawn.");
@@ -97,7 +97,7 @@ internal class Table
return null;
}
internal bool IsGameOver()
internal bool ShouldPlayAnotherHand()
{
if (Computer.IsBroke)
{
@@ -112,6 +112,6 @@ internal class Table
}
_io.WriteLine($"Now I have $ {Computer.Balance} and you have $ {Human.Balance}");
return !_io.ReadYesNo("Do you wish to continue");
return _io.ReadYesNo("Do you wish to continue");
}
}