DEV Community

Ioannis Gyftakis
Ioannis Gyftakis

Posted on • Edited on

Make Rock, Paper, Scissor game with Ink "Game Engine"

Recently I discovered Ink narrative language by INKLE that has the Inky editor and it is an alternative to Twine.

You can make interactive text based games easily but you can also insert media like images etc. It could also be useful to teach concepts more interactively, especially on the early steps of programming concepts to beginners.

So here is a simple Rock, Paper, Scissor game that uses basic building blocks of INK language like Choices, Knots, Conditionals, Variables, Lists.

Welcome to Rock, Paper, Scissor game

VAR choice = ""
LIST options = (Rock),(Paper),(Scissor)
VAR result = ""

-> main
=== main ===
Wanna play a round of «Rock, Paper, Scissor»?
    + [Yes]
        -> round
    + [No]
        -> DONE

=== round ===
What do you choose?
 + [Rock]
    ~ choice = "Rock"
 + [Paper]
    ~ choice = "Paper"
 + [Scissor]
    ~ choice = "Scissor"

- You chose {choice} 
~ result = LIST_RANDOM(options)
and I chose {result}.
{
    - choice == "Rock" && result == Scissor:
        You won!
    - choice == "Rock" && result == Paper:
        You lost!
    - choice == "Scissor" && result == Rock:
        You lost!
    - choice == "Scissor" && result == Paper:
        You won!
    - choice == "Paper" && result == Rock:
        You won!
    - choice == "Paper" && result == Scissor:
        You lost!
    - else:
        Draw!
}
-> main

-> END
Enter fullscreen mode Exit fullscreen mode

for more try watching this tutorial which is great.

  • Br, John

Postmark Image

Speedy emails, satisfied customers

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay