Skip to content

Commit

Permalink
Fixed user help and updated TODO.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
redleek committed Jan 3, 2015
1 parent 51d8a1a commit a6481c0
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 26 deletions.
18 changes: 18 additions & 0 deletions TacticalSpaceCheeseRacer/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
CS = mcs
CSDEBUG = -define:DEBUG
FILE = Program
NAME = TacticalSpaceCheeseRacer
DEBUGNAME = $(NAME)-DEBUG

all: $(NAME).exe

.PHONY: clean

clean:
rm -f $(NAME).exe $(DEBUGNAME).exe

debug: $(FILE).cs
$(CS) $(CSDEBUG) $(FILE).cs -out:$(DEBUGNAME).exe

$(NAME).exe: $(FILE).cs
$(CS) $(FILE).cs -out:$(NAME).exe
60 changes: 41 additions & 19 deletions TacticalSpaceCheeseRacer/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ struct Player
static int[] cheese_squares = new int[8] { 8, 15, 19, 28, 33, 45, 55, 59 };

// Represents the status of debug mode
# if DEBUG
#if DEBUG
static bool debugmode = false;
# endif
#endif

// Create an instance of random number so we don't get the same values in a short space of time.
static Random randomnum = new Random();
Expand Down Expand Up @@ -153,7 +153,16 @@ static void ParseCLA(string[] args)
case "--help":
case "-h":
// Print out command line help.
StreamReader reader = new StreamReader(@"..\README.md");
StreamReader reader;
try
{
reader = new StreamReader(@"README.md");
}
catch
{
PrintLine("Help file `README.md' not found! If found, please place in the same directory as the program.");
Environment.Exit(0);
}
while (true)
{
string line = reader.ReadLine();
Expand Down Expand Up @@ -210,21 +219,23 @@ static void SetupGame(bool reinitialise, bool use_old_names)
else
{
no_of_players = ReadNumber("Please enter the number of players: ", MAX_PLAYERS, MIN_PLAYERS);
//Console.WriteLine("The number of players is: {0}", no_of_players);
#if DEBUG
Console.WriteLine("The number of players is: {0}", no_of_players);
#endif
players = new Player[no_of_players];

// Read in the players' names.
ReadNames();

// Check that the names are being stored correctly.
# if DEBUG
#if DEBUG
Console.WriteLine("Stored players:");
for (int playercount = 0; playercount < no_of_players; playercount++)
{
Console.WriteLine(players[playercount].name);
}
Console.WriteLine();
# endif
#endif

}
}
Expand Down Expand Up @@ -314,7 +325,7 @@ static void PlayerTurn(int playerno)
{
roll = RandDiceRoll();
}
# else
#else
roll = RandDiceRoll();
#endif
Console.WriteLine("{0} rolled a {1}.", players[playerno].name, roll);
Expand All @@ -324,9 +335,20 @@ static void PlayerTurn(int playerno)
// Check if the dice roll was 6, if so, allow current player to throw the tactics dice for another player.
if (roll == 6)
{
PrintLine("Because you rolled a 6, you can throw the tactics dice for another player:");
PrintAllPositions();
TacticalRoll(ReadNumber("Please enter a player number: ", no_of_players, 1) - 1);
// Don't allow the player to roll the tactics dice for themselves.
do
{
PrintLine("Because you rolled a 6, you can throw the tactics dice for another player:");
PrintAllPositions();
int roll_choice = ReadNumber("Please enter a player number: ", no_of_players, 1) - 1;
if (roll_choice == playerno)
{
PrintLine("You cannot roll for yourself.");
continue;
}
TacticalRoll(roll_choice);
break;
} while (true);
}
}

Expand Down Expand Up @@ -470,7 +492,7 @@ static void TacticalRoll(int playerno)
{
roll = RandDiceRoll();
}
# else
#else
roll = RandDiceRoll();
#endif
Console.WriteLine("{0} rolled a {1}.", players[playerno].name, roll);
Expand Down Expand Up @@ -506,15 +528,15 @@ static void Main(string[] args)
// Parse the command line arguments given to the program.
ParseCLA(args);

# if DEBUG
if (debugmode)
{
PrintLine("Entering in Debug mode...");
}
# endif
#if DEBUG
if (debugmode)
{
PrintLine("Entering in Debug mode...");
}
#endif

// Set up the game for the first time. Reinitialise and use of old names will never need to be set on the first set up.
SetupGame(false, false);
// Set up the game for the first time. Reinitialise and use of old names will never need to be set on the first set up.
SetupGame(false, false);

// Loop so we can ask if the players want to play again.
bool replay;
Expand Down
1 change: 1 addition & 0 deletions TacticalSpaceCheeseRacer/README.md
8 changes: 1 addition & 7 deletions TacticalSpaceCheeseRacer/TODO.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
USER INTERFACE
==============
1. Create welcome screen.
2. Create the user help option from the command line.
3. Make a smooth/juddery typing method.

MECHANICS
=========
1. Implement tactical dice
2. Implement an enhancement.
2. Finish more methods for formatted string printing with `Print' method.

0 comments on commit a6481c0

Please sign in to comment.