Exercises
Exercise 1
Compose a series of functions into a pipeline that processes a list of enemy waves, applying increased difficulty (hard mode), validating the result, and transforming it into a formatted string using the following code:
public class EnemyWave { public int WaveNumber { get; set; } public int EnemyCount { get; set; } public string Description { get; set; } } Func<EnemyWave, bool> validateWave = wave => wave.EnemyCount > 0; Func<EnemyWave, EnemyWave> applyHardMode = wave => { wave.EnemyCount = (int)(wave.EnemyCount * 1.2); // +20% enemies return wave; }; Func<EnemyWave, string> formatWave = wave => $"Wave {wave.WaveNumber}: {wave.Description} - {wave.EnemyCount} enemies";
Exercise 2
Using the following code, compose a series of monadic functions into a pipeline that processes a game data file, reads its content, processes it...