DEV Community

Ioannis Gyftakis
Ioannis Gyftakis

Posted on • Edited on

1

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

AWS GenAI LIVE image

Real challenges. Real solutions. Real talk.

From technical discussions to philosophical debates, AWS and AWS Partners examine the impact and evolution of gen AI.

Learn more

Top comments (1)

Collapse
 
pliroforiki_sxoleiou profile image
Pliroforiki Sxoleiou 01

Nice, using also AI Assistants like Cursor etc you can make even more advanced scenarios.

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

👋 Kindness is contagious

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

Okay