Skip to content

Instantly share code, notes, and snippets.

@cies
Created March 5, 2021 12:34
Show Gist options
  • Save cies/f15cd7e7784d0d5e1a76d61cc885db1f to your computer and use it in GitHub Desktop.
Save cies/f15cd7e7784d0d5e1a76d61cc885db1f to your computer and use it in GitHub Desktop.

Simple games ideas for trying out Elm

For some of these game you will need "random numbers".

Here's the official guide on doing random in Elm. To get the example to work in Ellie you need to add a module definition on top (the compile error will guide you in the right direction) and add the Random package from the "Package" menu (see package icon) on the left.

The game ideas:

  • Write function that translates a text to Pig Latin and back.

    • English is translated to Pig Latin by taking the first letter of every word, moving it to the end of the word and adding ‘ay’.
    • For example: “The quick brown fox” becomes “Hetay uickqay rownbay oxfay”.
  • The name game

  • Write a program that converts phrases in the Latin alphabet to Morse code

    • EXTRA: allow it to translate morse code into latin alphabet as well
  • Write a guessing game where the user has to guess a secret number.

    • After every guess the program tells the user whether their number was too large, too small, or spot on!
    • EXTRA: At the end the number of tries may be printed.
  • A reaction speed counter.

    • You show a cue when the counting starts
    • Clicking a button stops the count, which is then shown
    • Good fun to see human performance worsens when beer is added!
  • "21" is a two player game

    • players take turns in choosing a number (1, 2, or 3) which is added to the running total
    • the player whose chosen number causes the running total to reach exactly 21 wins
    • first make it for 2 human player
    • EXTRA: allow a computer player
    • EXTRA: make a coputer player that follows "the perfect strategy" (just look for it online)
  • The game of Pig

    • a multiplayer game played with a single six-sided dice
    • players try to reach 100 points or more.
    • players take turns, in which that player has the option of either:
      1. Rolling the dice:
        • a roll of number two to six is added to their score for that turn and the player's turn continues as the player is given the same choice again;
        • or a roll of number 1 loses the player's total points for that turn and their turn finishes
      2. Holding:
        • the player's score for that round is added to their total and becomes safe from the effects of throwing a one, after which their turn finishes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment