I don't do this much, but definitely no one but me does it. .. .. But it's kind of embarrassing.
What is Kinx? Please see the following.
** "The appearance is JavaScript, the brain (contents) is Ruby, (stability is AC / DC)" ** The scripting language Kinx kinx).
- Reference
- First motivation ... Script language KINX (introduction)
- All links to individual articles are collected here.
- Repository ... https://github.com/Kray-G/kinx
- We are waiting for Pull Request etc.
When I looked at JavaScript version, it was executed on the browser (← it may be natural in a sense ...), so looks JavaScript couldn't show its true character. I had no choice but to make it with full scratch (it's not a big deal).
yubaba.kx
System.println("It's a contract. Write your name there.");
var name = $stdin.readLine();
System.println("Hung.%Is it s? It's a luxurious name." % name);
var nameArray = name.split('');
var index = Integer.parseInt(Math.random() * 1000) % nameArray.length();
var newName = nameArray[index];
System.println("From now on your name is%1%It is. Mind you,%1%That's right. I'll reply when I understand%1%!!" % newName);
It's a contract. Write your name there.
Spirited Away
Hung. Is it Chihiro? It's a luxurious name.
From now on your name is a thousand. It ’s a thousand. I'll reply when I understand, a thousand!!
Kinx's String # split
is split in UTF-8, so make it an array and then cut out one character.
I made it crash.
It's a contract. Write your name there.
Hung. I mean. It's a luxurious name.
Uncaught exception: No one catch the exception.
SystemException: Divide by zero
Stack Trace Information:
at <main-block>(yubaba.kx:7)
I dare to calculate the remainder to make it crash. Originally the following part,
var index = Integer.parseInt(Math.random() * 1000) % nameArray.length();
This is fine below.
var index = Integer.parseInt(Math.random() * nameArray.length());
This will not crash, but since there are no array elements, nameArray [0]
will return undefined and will look like this:
It's a contract. Write your name there.
Hung. I mean. It's a luxurious name.
From now on your name is((null))It is. Mind you,((null))That's right. I'll reply when I understand((null))!!
I enjoyed everyone's stories that have been implemented in various ways. Originally, it's a quality that doesn't do this much, but well, Kinx will not do anything other than me, so I did it with a moment of hesitation.
Thank you to @Nemesis (and others) for providing the material.
Recommended Posts