mirror of
https://github.com/coding-horror/basic-computer-games.git
synced 2025-12-22 23:26:40 -08:00
Use common library in SuperStarTrek
This commit is contained in:
@@ -29,6 +29,15 @@ public class TextIO : IReadWrite
|
||||
_numberTokenReader = TokenReader.ForNumbers(this);
|
||||
}
|
||||
|
||||
public virtual char ReadCharacter()
|
||||
{
|
||||
while(true)
|
||||
{
|
||||
var ch = _input.Read();
|
||||
if (ch != -1) { return (char)ch; }
|
||||
}
|
||||
}
|
||||
|
||||
public float ReadNumber(string prompt) => ReadNumbers(prompt, 1)[0];
|
||||
|
||||
public (float, float) Read2Numbers(string prompt)
|
||||
@@ -99,6 +108,8 @@ public class TextIO : IReadWrite
|
||||
|
||||
public void WriteLine(object value) => _output.WriteLine(value.ToString());
|
||||
|
||||
public void Write(string format, params object[] values) => _output.Write(format, values);
|
||||
|
||||
public void WriteLine(string format, params object[] values) => _output.WriteLine(format, values);
|
||||
|
||||
public void Write(Stream stream, bool keepOpen = false)
|
||||
|
||||
Reference in New Issue
Block a user