Last active
November 9, 2015 08:58
-
-
Save Henkoglobin/7b2809f61157eb1ef654 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DefInt A-R | |
Function V(x) | |
On Error Goto e | |
For Z=1 To Len(x) | |
Select Case Mid(x, Z, 1) | |
Case"i":A=A+1 | |
Case"d":A=A-1 | |
Case"s":A=A^2 | |
Case"p":V=V &A | |
Case"P":V=V &Chr(A) | |
Case">":A=R | |
Case"a":B=B+1 | |
Case"k":B=B-1 | |
Case"m":B=B^2 | |
Case"o":V=V &B | |
Case"O":V=V &Chr(B) | |
Case"<":B=R | |
Case"+":R=A+B | |
Case"-":R=A-B | |
Case"*":R=A*B | |
Case"/":R=A\B | |
Case"w":V=V &R &" " | |
Case"@":A=0 | |
Case"#":B=0 | |
Case"e":R=0 | |
End Select | |
Next | |
e: | |
End Function | |
Sub Test() | |
Dim spooky As String: spooky = "iipois+iis<-<aaaO<OkOOkkkkOP@#iippisa+<m+>PaO" | |
Dim spookyResult As String: spookyResult = V(spooky) | |
Dim stuff As String: stuff = "iiispsdPkokmo/w<+w#aaaommO-w@ii*wew" | |
Dim stuffResult As String: stuffResult = V(stuff) | |
Dim hello As String: hello = "iisssaa/>emaa->e#aamam->e#dddddddddddddddddddddddddPiiiiiiiiiiiiiiiiiiiiiiiiiiiiiPiiiiiiiPPiiiP@#eiisaamaaaa*>P@#eiisssaa/>emaa->e#aamam->e#iiiiiiiiiiiiiiiiiiiiiiPddddddddPiiiPddddddPddddddddP@#eiissaa*>iP" | |
Dim helloResult As String: helloResult = V(hello) | |
Debug.Print spookyResult | |
Debug.Print stuffResult | |
Debug.Print helloResult | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Added test cases :)