QKAS

From Esolang
Jump to navigation Jump to search
QKAS
Designed by Prince
Appeared in 2015
Computational class Unknown
Major implementations Encoder, Decoder
Influenced by QWERTY Keyboard Dot Language
File extension(s) {{{files}}}

You can vist QKAS's official website here.

QKAS was made in 2015 by a user simply known as "Prince". The idea of QKAS (Pronounced Kaz) is simple. Be as simple as possible. Although it only uses two main characters (+ and -) you can use all other character excluding letters normally.

Here's how it works, each - or + is equal to +1 to the right on the letter section of a QWERTY keyboard (Remember, the + and - only are for letters). For instance, q being the first letter on the qwerty keyboard is equal to -. w is equal to --, e is equal to ---, r is equal to ---- and so on. The same is with the uppercase letters, except you use + instead of -. So Q is equal to + and W is equal to ++. Hopefully you get it by now, if you don't the read it again. There is one more thing you must know, ALL punctuation stays the same. If you wanted to say Hi!, you would type ++++++++++++++++o--------! (o is the separator).

The first encoder was made by a user known as "_MysteriousMagenta_" and the first decoder was made by "Prince" himself (Although it was very bad).

Examples

Here is the Hello, World! program in QKAS:

++++++++++++++++o---o-------------------o-------------------o---------o,o o++o---------o----o-------------------o-------------o!

Here is the "Hello, World!" program in Brainfuck:

++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.

As you can see, it is simpler but longer.

Here is the "Hello, World!" program in Python2:

print "Hello, World!"

And in Python3:

print("Hello, World!")

Implementations

The following offers a simple implementation of QKAS in Common Lisp. The mapping of integers to keyboard characters is represented in a string lookup table, the first element of which, which would associate a superfluous zero count of - or +, is defined by a dummy space entry.

(defparameter +LOWERCASE-CHARACTERS+ " qwertyuiopasdfghjklzxcvbnm")
(defparameter +UPPERCASE-CHARACTERS+ " QWERTYUIOPASDFGHJKLZXCVBNM")

(defun interpret-QKAS (code)
  "Interprets the QKAS CODE and returns ``NIL."
  (declare (type string code))
  (let ((position 0))
    (declare (type fixnum position))
    (symbol-macrolet ((character     (the character (char code position)))
                      (has-character (< position (length code))))
      (flet ((check-for-separator ()
              (when (and has-character (char/= character #\o))
                (error "Expected separator at position ~d instead of ~s." position character))
              (incf position)))
        (loop do
          (cond
            ((not has-character)
              (loop-finish))
            ((char= character #\-)
              (write-char
                (schar +LOWERCASE-CHARACTERS+
                  (loop while (and has-character (char= character #\-)) count 1 do (incf position))))
              (check-for-separator))
            ((char= character #\+)
              (write-char
                (schar +UPPERCASE-CHARACTERS+
                  (loop while (and has-character (char= character #\+)) count 1 do (incf position))))
              (check-for-separator))
            ((alpha-char-p character)
              (error "Error at position ~d: The letter ~s is not permitted." position character))
            (T
              (write-char character)
              (incf position)
              (check-for-separator))))))))