From 32747853946f588dc9c2462552e50428396c522a Mon Sep 17 00:00:00 2001 From: Todd Schwartz Date: Wed, 26 Nov 2025 08:44:14 -0800 Subject: [PATCH 1/2] Improve hints --- .../concept/role-playing-game/.docs/hints.md | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/exercises/concept/role-playing-game/.docs/hints.md b/exercises/concept/role-playing-game/.docs/hints.md index b87640f99..169f3a5f8 100644 --- a/exercises/concept/role-playing-game/.docs/hints.md +++ b/exercises/concept/role-playing-game/.docs/hints.md @@ -1,10 +1,23 @@ # Hints -- See the [F# language reference on Options][options] for more usage examples. +## 1. Introduce yourself + +The `introduce` function must "unwrap" the value contained in `player.Name`. +Consider using the [`Options.defaultValue` function][defaultvalue] to convert `player.Name` to its "wrapped" value when it is `Some` or the required default value when it is `None`. + +## 2. Implement the revive mechanic + +The `revive` function must return either `Some ` or `None`, where `` is a `Player` record possibly with some modified fields. ## 3. Implement the spell casting mechanic -- The [`max` function][max] can be used to ensure the health value does not go below 0. +Consider using a match expression to cover both the `Some` and `None` cases, as in the following example: + +``` +let exists (x: Option) = + match x with + | Some n -> true + | None -> false +``` -[options]: https://learn.microsoft.com/en-us/dotnet/fsharp/language-reference/options -[max]: https://fsharp.github.io/fsharp-core-docs/reference/fsharp-core-operators.html#max +[defaultvalue]: https://learn.microsoft.com/en-us/dotnet/fsharp/language-reference/options#converting-options-with-default-values From 63177e58f4c43f52c4faadf318b2dfae67d3b3fa Mon Sep 17 00:00:00 2001 From: Todd Schwartz Date: Fri, 28 Nov 2025 12:06:28 -0800 Subject: [PATCH 2/2] Apply review feedback Co-authored-by: Erik Schierboom --- exercises/concept/role-playing-game/.docs/hints.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/concept/role-playing-game/.docs/hints.md b/exercises/concept/role-playing-game/.docs/hints.md index 169f3a5f8..d19d1c61c 100644 --- a/exercises/concept/role-playing-game/.docs/hints.md +++ b/exercises/concept/role-playing-game/.docs/hints.md @@ -13,7 +13,7 @@ The `revive` function must return either `Some ` or `None`, where `) = match x with | Some n -> true