add C++, Typescript and more stuff

This commit is contained in:
2026-10-28 00:15:08 +01:00
parent e99e6386e8
commit ea0f475cae
108 changed files with 2488 additions and 980 deletions
+17 -1
View File
@@ -11,7 +11,7 @@ namespace KernelPanic.Run
public static class LanguageTraining
{
public static readonly IReadOnlyList<Language> Supported = Array.AsReadOnly(new[]
{ Language.C, Language.Rust, Language.Python, Language.JavaScript, Language.Haskell, Language.Java, Language.Go });
{ Language.C, Language.CPlusPlus, Language.Rust, Language.Python, Language.JavaScript, Language.TypeScript, Language.Haskell, Language.Java, Language.Go });
public static bool IsSupported(Language language) => Supported.Contains(language);
@@ -29,6 +29,8 @@ namespace KernelPanic.Run
Language.Python => new[] { "lang_py_import_antigravity", "shop_py_async_def", "lang_py_for_loop", "mint_cinnamon", "lang_py_print", "lang_py_print" },
Language.Haskell => new[] { "lang_hs_map", "lang_hs_thunk", "lang_hs_foldr" },
Language.C => new[] { "lang_c_malloc", "lang_c_pointer", "lang_c_printf" },
Language.CPlusPlus => new[] { "lang_cpp_malloc", "lang_cpp_pointer", "lang_cpp_printf" },
Language.TypeScript => new[] { "lang_ts_console_log", "lang_ts_fetch", "lang_ts_typeof" },
Language.Rust => new[] { "lang_rs_fn_main", "lang_rs_unwrap", "lang_rs_borrow" },
Language.JavaScript => new[] { "lang_js_console_log", "lang_js_fetch", "lang_js_typeof" },
Language.Java => new[] { "lang_java_new_object", "lang_java_system_out_println", "lang_java_public_static_main" },
@@ -56,6 +58,8 @@ namespace KernelPanic.Run
string name = LanguageCatalog.Get(language).DisplayName;
string objective = language switch
{
Language.CPlusPlus => "Learn C's evolved cards: stronger hits, full overkill spill and combos without segfault recoil.",
Language.TypeScript => "Learn to plan reliable attacks using JavaScript's evolved cards, with fixed damage and no failed typeof rolls.",
Language.Python => "You'll learn to build a combo that attacks this turn and repeats on later turns. First, we'll draw the cards we need. Then we'll put them in order.",
Language.Haskell => "You'll learn to make a stronger attack by playing your cards in the right order. We'll build a stack together, then work through why it resolves backward.",
Language.Rust => "You'll learn to turn an attack into protection. We'll defeat the weaker enemy first, use the leftover damage as Shield, then attack the stronger one.",
@@ -68,6 +72,16 @@ namespace KernelPanic.Run
Read("welcome", "Learn to use " + name, objective, "enemies");
switch (language)
{
case Language.CPlusPlus:
Read("evolution", "C without the segfault", "C++ keeps C's immediate attacks and elevated critical chance. Damage is stronger, all overkill spills, and playing C++ never causes segfault recoil.", "enemies");
Play("burst", "lang_cpp_malloc", "Start with upgraded malloc", "Play malloc to begin your C++ chain. Your hand stays safe from segfault corruption.");
Read("combo", "Follow with pointer", "Pointer deals 20 base damage after a C++ card instead of 12. Use printf to repair corruption from other sources. Full excess damage spills to the next living enemy.", "enemies");
break;
case Language.TypeScript:
Read("evolution", "Plan around fixed values", "TypeScript upgrades JavaScript's cards. Damage has a fixed value and no critical roll. Buffs and enemy defenses still apply.", "enemies");
Play("fixed", "lang_ts_console_log", "Deal a reliable 9", "Play console.log(). Its base damage is always 9 instead of a random 3 to 9.");
Read("guarantee", "No failed typeof", "Fetch deals 13 base damage. Typeof always deals 16 instead of risking a failed roll. Check enemy defenses, then choose your follow-up.", "enemies");
break;
case Language.Go:
Read("go-slots", "Start a worker for future turns", "Go has 3 active slots, separate from hand RAM. A deployed worker leaves your hand and starts attacking next round. Its card returns to the discard pile when it stops.", "GoroutineScheduler");
Play("go-worker", "lang_go_worker", "Deploy your first worker", "Select go worker(). It will deal 3 base damage on each of its next 3 eligible rounds. Its first tick is next round, so you still need to plan for this turn's enemies.",
@@ -149,6 +163,8 @@ namespace KernelPanic.Run
}
string practice = language switch
{
Language.CPlusPlus => "Finish the fight. Chain C++ cards for pointer's bonus, use full overkill spill, and repair corruption with printf. Your C++ attacks never cause segfaults.",
Language.TypeScript => "Finish the fight. Use fixed damage to plan each kill, accounting for Shield and other modifiers. Typeof always succeeds.",
Language.Python => "Finish the fight yourself. Draw before committing to a combo, put setup before payloads, and check your active script. End your turn when the queue is ready.",
Language.Haskell => "Finish the fight yourself. Start with a smaller card, save a bigger effect for a higher multiplier, then check the stack from top to bottom before ending your turn.",
Language.Rust => "Finish the fight yourself. Compare the enemy's intent with your Shield. Use overkill for protection when you can, and borrow() when you need Shield without a kill.",