# New Educational Game for Functional Programming

**URL:** <https://discourse.elm-lang.org/t/new-educational-game-for-functional-programming/9783>\
**Category:** Request Feedback\
**Created:** [May 11, 2024, 11:59am UTC](https://discourse.elm-lang.org/t/new-educational-game-for-functional-programming/9783 "2024-05-11T11:59:04Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![j7hoenix](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/j7hoenix/32/4173_2.png) [@j7hoenix](https://discourse.elm-lang.org/u/j7hoenix)\
**Post date:** [May 11, 2024, 11:59am UTC](https://discourse.elm-lang.org/t/new-educational-game-for-functional-programming/9783/1 "2024-05-11T11:59:04Z")

</div>

I’m excited to share a demo of a new educational game, entirely created in Elm. This game is designed to teach children functional programming through a visual language called **Link Lang** (implemented in the game). The core idea is to get folks writing and using their own functions as quickly as possible, making coding engaging and accessible.

> **[Cosmic Code](https://cosmiccodegame.com/)**
>
> Cosmic Code is a fun, kid-friendly game that teaches the basics of functional programming.

- In the game, learners **program a robot** to solve puzzles and collect energy cells, while defining their own functions in a visual editor.
- The ambition is to introduce **functional programming** to young learners.
- **Visual Language - Link Lang:** Simplifies coding concepts, allowing kids to visually manipulate and understand functional programming constructs. It has basic types, type inference, function calling, etc.

I am trying to figure out what to prioritize next, and would really appreciate any **advice** on the following:

- **Game Design:** Anything feel off or confusing with the UI, errors, language, or concepts?
- **Learning Curve:** Is there a point that feels like too big of a jump in difficulty? Or anything that feels too slow? Is adding more similar levels a net negative or positive?
- **Future Directions:** What additional features or concepts would you like to see? How can the game be further refined to better serve its educational purpose?

> **Spoilers - Full Game playthrough**
>
> Recording of me doing the levels (from an earlier version). Ideally you would try each level first, though 😛.
> 
> [Full Game playthrough](https://www.youtube.com/watch?v=dunxXqjbAG8)

Your advice will guide the development process as I prepare for a broader release. Thank you for your support and I look forward to your insights!

---

<div class="post-metadata">

**Author:** ![Sebastian](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/sebastian/32/98_2.png) [@Sebastian](https://discourse.elm-lang.org/u/Sebastian)\
**Post date:** [May 12, 2024, 11:14pm UTC](https://discourse.elm-lang.org/t/new-educational-game-for-functional-programming/9783/2 "2024-05-12T23:14:20Z")

</div>

This looks really nice. Well done. Great too see educational games like this.

I played it a couple of times, here is my feedback.

Defining functions is confusing. If you dont read the instructions carefuly. which I didn’t on purpose. It is very hard to figure out how to define a function. I had to reset the game an read the tutorial with more attention. I think that being able to do figure out things without reading a tutorial carefuly is important.

When defining the function it is possible to miss the () when selecting. Is this intented for later? You get a return type error.

The two buttons next to play (reset and back) are unclear on what they do, a hover or label would be great. I figured out what they do later, but should be clear much earlier e.g. `reset code` and `remove step`.

When resetting the robot doesn’t reset. It should probably reset along with the code. As your code will need to adapt with the new state of the robot, which makes learning by trying and fixing harder.

I would like to see what a function does after defining it. i.e. click on it to see the code that I saw when creating it.

I can put more steps in the editor than needed. As soon as the robot hits the battery, the level is complete, ignoring the extra steps. I thinks this can lead to people spamming the level.

I never used the `negate` to complete the level, I just used turnRight three times. Maybe there should be a check that you actually used the intented introduced concept.

In my second playthrough the game didn’t work as intented. After hitting start over. I didn’t allow me to move levels. I had to refresh the page.

I like that the game moved slowly, not rushing into teaching or using function arguments yet.

---

<div class="post-metadata">

**Author:** ![dirkbj](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/dirkbj/32/3162_2.png) [@dirkbj](https://discourse.elm-lang.org/u/dirkbj)\
**Post date:** [May 21, 2024, 4:02pm UTC](https://discourse.elm-lang.org/t/new-educational-game-for-functional-programming/9783/3 "2024-05-21T16:02:15Z")

</div>

This looks amazing! Love the design concept and implementation. A few pieces of feedback.

- Provide a way to see the instructions again for the current challenge
- Provide a way to see the instructions again for a the an icon
- Provide a way to edit an existing function

Will love to see where it is going.

---

<div class="post-metadata">

**Author:** ![marciofrayze](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/marciofrayze/32/3494_2.png) [@marciofrayze](https://discourse.elm-lang.org/u/marciofrayze)\
**Post date:** [May 21, 2024, 7:05pm UTC](https://discourse.elm-lang.org/t/new-educational-game-for-functional-programming/9783/4 "2024-05-21T19:05:17Z")

</div>

Love this project! Thanks for sharing.

Feels very much in tune with the Elm spirit.

My main feedback for now is similar to what Sabastian said: building and editing a function is not very intuitive.

But the overall idea and execution of the project is excellent.

---

<div class="post-metadata">

**Author:** ![j7hoenix](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/j7hoenix/32/4173_2.png) [@j7hoenix](https://discourse.elm-lang.org/u/j7hoenix)\
**Post date:** [May 30, 2024, 11:52am UTC](https://discourse.elm-lang.org/t/new-educational-game-for-functional-programming/9783/5 "2024-05-30T11:52:49Z")

</div>

> [@Sebastian](#):
>
> Defining functions is confusing. If you dont read the instructions carefuly.

This is super helpful feedback, thank you! I’m working on a spotlight effect that will explain the feature broken down into discrete steps. More forced clicks, but should be quick for each one.

> [@Sebastian](#):
>
> possible to miss the () when selecting

Ah, yeah that is how I’m currently imagining binding an argument in a function (if you try clicking the unit when defining a function then it allows you to choose a name for your argument). Still WIP, though and not intuitive at all.

I also noticed that you can just bind a unit by itself, so probably need to handle both of those cases.

> [@Sebastian](#):
>
> a hover or label would be great

Will do! I saw something nice in a book about microinteractions where you start with it written out and slowly shrink the text as the user gets used to the system, so maybe will try something like that.

> [@Sebastian](#):
>
> robot doesn’t reset

My original thinking was trying to get users to write more (smaller) functions over bigger (more correct) ones.

I’ve also heard the opposite user feedback as well (that they like how it doesn’t start you over).

I’ll try adding a (hard) reset level in the top corner.

> [@Sebastian](#):
>
> people spamming the level

Heard. Not sure what to do about it, yet, though.

> [@Sebastian](#):
>
> just used turnRight three times

😀 I kind of love it TBH. I added a “test harness” that asserts that the user has defined a function that will allow them to not get blocked later (just based on behavior of the function). I’ll think about how to test the internals too.

> [@Sebastian](#):
>
> didn’t allow me to move levels

Not sure on this one. Do you mean that it forces you to redo all of the levels again (intended)? Or do you mean that the feature was just broken? I did add the feature the morning I posted this (so likely a bug on my end) 😳.

> [@Sebastian](#):
>
> I like that the game moved slowly

TY! I am going to try breaking it down further as well.

---

<div class="post-metadata">

**Author:** ![j7hoenix](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/j7hoenix/32/4173_2.png) [@j7hoenix](https://discourse.elm-lang.org/u/j7hoenix)\
**Post date:** [June 2, 2024, 2:56am UTC](https://discourse.elm-lang.org/t/new-educational-game-for-functional-programming/9783/6 "2024-06-02T02:56:15Z")

</div>

> [@dirkbj](#):
>
> - Provide a way to see the instructions again for the current challenge
> - Provide a way to see the instructions again for a the an icon

Awesome ideas! I will look into these. Currently imagining a persistent log that can be inspected (with builtin hyper links to the tutorials).

> [@dirkbj](#):
>
> - Provide a way to edit an existing function

I’ve wondered how to do edit’ing and haven’t landed on a solution I like just yet. I was planning on adding the ability to delete a function and show a created function soon (which then you could “edit” in a cumbersome way). I can definitely see the value if you accidentally mix up `turnLeft` and `move1` and just want to swap them real quick.

TY for looking at it!

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex035/uploads/elm_lang/original/1X/50a05e53677a2c3b47776d7abd0f113eb50193a1.png) [@system](https://discourse.elm-lang.org/u/system)\
**Post date:** [June 12, 2024, 2:57am UTC](https://discourse.elm-lang.org/t/new-educational-game-for-functional-programming/9783/7 "2024-06-12T02:57:06Z")

</div>

Closed on June 12, 2024, 2:57am UTC

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.
