C#

C# Practice

Learn C# the way game code uses it: integer arithmetic and interpolated strings, loops and switch statements over changing state, dictionaries and lists for an inventory a player can read, and the methods that compose into a battle you can run turn by turn.

dotnet-10.NET SDK 10
Module 1

Values, Control Flow & Collections

Learn how to do integer arithmetic, drive state with loops and switch statements, and hold, count and sort items in dictionaries and lists.

4
About this challenge

Put the prototype's combat numbers in code: a hit that never deals less than 1, a critical hit that adds a rounded percentage, and a ten-segment health bar built with string interpolation.

About this challenge

Turn a total XP amount into a level with a loop over a rising per-level cost, report the XP still missing, and name the rank with a switch at the defined bands.

About this challenge

Make the bag behave: stack quantities of an item it already holds without taking a new slot, refuse a new item when every slot is used, and list the contents alphabetically.

About this challenge

Resolve a whole test fight in code: alternating hits with periodic crits, a draw after fifty rounds, XP and rank on a win, the enemy's loot into a bag that can refuse it, and the final health bars.

Module 2

Methods & Text

Learn how to split and case-fold a typed line, read arguments with TryParse and fallbacks, align text with interpolation, and route commands that change a game's state.

4
About this challenge

Split a debug console line into its words, lower-casing only the command, treating a line without a leading slash as chat, and naming the command without its slash.

About this challenge

Read a console command's arguments safely: a whole number or a fallback when it is missing or garbled, and a word with its own default fallback.

About this challenge

Render chat lines with a default channel and a trimmed message, and fixed-width scoreboard rows that cut a long name with a dot but never cut a score.

About this challenge

Run the game's debug console: echo chat, and answer /give, /heal, /xp, /bag and /stats against the tester's state, with a reply for anything else.

Frequently asked questions

4

What will I practice in this path?

2 modules: Values, Control Flow & Collections and Methods & Text.

How many challenges are there, and how hard are they?

8 challenges, all easy.

What does this path run on?

Challenges run on .NET SDK 10.

Do I need to install anything?

No. Every challenge runs in a browser-based IDE with everything already set up, and your code is graded automatically against a test suite.

We use cookies that are necessary to run Staffcoder, and optional analytics cookies to see which pages get used. Analytics stays off unless you accept. Read our Cookie Policy.

C# Practice: 8 Hands-On Challenges | Staffcoder