This 3-hour workshop will introduce you to Git version control and .NET development through a hands-on project. You'll be enhancing a Number Guessing Game console application using C#. Link to Speaker Notes
- 0:00-0:10: Welcome & Introductions
- 0:10-0:25: Git Essentials
- 0:25-0:45: .NET & C# Overview
- 0:45-1:00: Project Introduction
- 1:00-2:15: Hands-on Coding
- 2:15-2:45: Code Review & Discussion
- 2:45-3:00: Wrap-up & Resources
| Command | Description | Example |
|---|---|---|
git clone [url] |
Create a local copy of a remote repository | git clone https://github.com/username/repo.git |
git status |
Check the status of files in your repository | git status |
git add [file] |
Stage changes for commit | git add Program.cs or git add . (all files) |
git commit -m "[message]" |
Save your changes with a descriptive message | git commit -m "Fix random number generation" |
git push |
Upload local changes to remote repository | git push |
git pull |
Download changes from remote repository | git pull |
// Output text
Console.WriteLine("Hello, World!"); // With line break
Console.Write("Enter your name: "); // Without line break
// Input text
string input = Console.ReadLine();
// Parse input to numbers
int number;
bool success = int.TryParse(input, out number);
// Formatted output
Console.WriteLine($"Hello, {input}!"); // String interpolation
Console.WriteLine("Score: {0}/{1}", correct, total); // Composite formatting// Change text color
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine("Success message");
// Change background color
Console.BackgroundColor = ConsoleColor.Blue;
Console.WriteLine("Highlighted text");
// Reset colors
Console.ResetColor();
Console.WriteLine("Normal text");
// Available colors:
// Black, DarkBlue, DarkGreen, DarkCyan, DarkRed, DarkMagenta, DarkYellow,
// Gray, DarkGray, Blue, Green, Cyan, Red, Magenta, Yellow, White// Create a random number generator
Random random = new Random(); // Don't use a seed value!
// Generate random integers
int number = random.Next(); // Any non-negative integer
int number = random.Next(100); // Between 0 and 99
int number = random.Next(1, 101); // Between 1 and 100// If-else statement
if (condition) {
// Code to execute if condition is true
} else if (anotherCondition) {
// Code to execute if anotherCondition is true
} else {
// Code to execute if all conditions are false
}
// Switch statement
switch (value) {
case 1:
// Code for value 1
break;
case 2:
// Code for value 2
break;
default:
// Code for any other value
break;
}
// While loop
while (condition) {
// Code executes repeatedly while condition is true
}
// For loop
for (int i = 0; i < 10; i++) {
// Code executes 10 times (0 through 9)
}- Find the bug in the
GenerateTargetNumber()method - Remove the seed value from the Random object constructor
- Look for:
Random random = new Random(42);
- Use different colors for different message types:
- Success messages (green)
- Error/wrong guess messages (red)
- Informational messages (cyan or yellow)
- Normal text (default white)
- Look for the TODO comments with "Part 4" that mention color
- Add a method to choose difficulty at game start
- Update game settings based on difficulty
- Implement best score properties
- Update scores when player wins
- Show best scores in final statistics screen
- Add hints, timers, or other enhancements
- Implement turn-based play for two players
-
Does the random number change?
- Run the game multiple times
- You should get different target numbers
-
Is the console output colorful?
- Error messages should be in red
- Success messages should be in green
- Different message types should use different colors
-
Does the game work correctly?
- Can you guess correctly?
- Do you get appropriate feedback?
- Are wins and losses tracked?