How to resolve the algorithm Magic 8-ball step by step in the Transd programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Magic 8-ball step by step in the Transd programming language

Table of Contents

Problem Statement

Create Magic 8-Ball.

See details at:   Magic 8-Ball.

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Magic 8-ball step by step in the Transd programming language

Source code in the transd programming language

#lang transd

MainModule : {
    ans: ["It is certain.", "It is decidedly so.", "Without a doubt.",
        "Yes - definitely.", "You may rely on it.", "As I see it, yes.",
        "Most likely.", "Outlook good.", "Yes.", "Signs point to yes.",
        "Reply hazy, try again.", "Ask again later.",
        "Better not tell you now.", "Cannot predict now.",
        "Concentrate and ask again.", "Don't count on it.",
        "My reply is no.", "My sources say no.", "Outlook not so good.",
        "Very doubtful."],
	_start: (lambda locals: sense 0 quest ""
        (while true
            (lout "Please, ask your question:")
            (getline quest)
            (if (not (size quest)) break)
            (if (neq (back quest) "?") (lout "\nEh?") continue)
            (= sense 0)
            (tql quest reduce: ["col1"] using: (λ c Char() (+= sense c)))
            (lout (get ans (mod sense 20)))
        )
    )
}


  

You may also check:How to resolve the algorithm Check output device is a terminal step by step in the Python programming language
You may also check:How to resolve the algorithm Leonardo numbers step by step in the Common Lisp programming language
You may also check:How to resolve the algorithm Address of a variable step by step in the XLISP programming language
You may also check:How to resolve the algorithm Bitwise operations step by step in the Quackery programming language
You may also check:How to resolve the algorithm Arrays step by step in the Pike programming language