Login [Register]
Don't have an account? Register now to chat, post, use our tools, and much more.
Here's a quick z80 implementation of plain merthese with a quirk:


Code:
.nolist
   #include "ti83plus.inc"
.list
.org $9D93
.db $bb, $6d

   LD HL,OP1         ;Spell out the Ans variable
   LD (HL),StrngObj  ;...
   INC HL            ;...
   LD (HL),tAns      ;...
   INC HL            ;...
   LD (HL),0         ;...
   INC HL            ;...
   LD (HL),0         ;...
   B_CALL(_FindSym)  ;Load the pointer to a string in to DE
   LD L,E            ;Get the strings length in to HL
   INC DE            ;...
   LD H,D            ;...
   INC DE            ;...
   ADD HL,DE         ;Move HL to the end of the string
   LD (HL),0         ;Null-terminate it
   LD H,D            ;Now we have our input in HL
   LD L,E            ;...
   
mainloop:
   ld A,(HL)
   cp $4D
   call z,c_m
   ld A,(HL)
   cp $45
   call z,c_e
   ld A,(HL)
   cp $52
   call z,c_r
   ld A,(HL)
   cp $54
   call z,c_t
   ld A,(HL)
   cp $48
   call z,c_h
   ld A,(HL)
   cp 0
   jp z,endh
   inc HL
   jp mainloop
   
c_m:
   push HL
   ld hl,str_merth
   b_call(_putS)
   pop HL
   ret
c_e:
   push HL
   b_call(_NewLine)
   pop HL
   ret
c_r:
   push HL
   ld A,$20
   b_call(_putC)
   pop HL
   ret
c_t:
   push HL
   b_call( _Random )
   ld hl, (seed1+5)
   ld A,L
   and $0f
   cp 13
   jp c,checkfail0
   sub 13
checkfail0:
   inc B
   ld B,A
   
loopstart:
   push BC
   b_call( _Random )
   ld hl, (seed1+5)
   ld A,L
   and %00011111
   cp 26
   jp c,checkfail
   sub 26
checkfail:
   add A,$41
   b_call(_putC)
   pop BC
   dec B
   ld A,B
   cp 0
   jp nz,loopstart
   pop HL
   ret
c_h:
   inc HL
   ld A,(HL)
   cp $48
   jp Z,endh
   or A
   jp Z,endh
   jp c_h
endh:
   ret
str_merth:
   .db "merth",0


.end
.end


The quirk is with the T command; it sometimes underflows for some reason and I'm too tired to debug. The input comes from ANS. I don't bother to do any type checking so make sure ANS is actually a string =p
_Player: That's really cool, good work!
Kaslai: Nice! If I knew ASM I'd try to help you debug. Maybe someone else can help.
Oh, I forgot to mention one thing about my compiler. When I proposed the y instruction, I didn't specify how loops were supposed to be done. I'm almost certain what I was thinking at the time was that "yAm" would print "merth" 65 times (Not counting for the fact that m can do multiple things, a better example would be "nAyAv", which would print 65 "N"s). Also, nAy!y!v would print 1089 "N"s (! = 33, 33 * 33 = 1089), or in other words, it can be nested. Just figured I'd clarify on that Smile
Thanks. I was wishing you had explained it before because I had no idea how to implement it and had to just make up something. Wink

So if I understand correctly, the way you were intending it, you can only loop the following character, not multiple ones, right? What happens if the next character is not a valid Merthese instruction? Does it just move forward until it finds a valid character and loops that, or does it just do nothing N times? And for characters that can do multiple things, does it choose a random action each pass through the loop, or does it choose the action once and loop that one action?
Well, I decided to write yet another Merthese interpreter Smile I noticed that no one has yet written one in Lua, so picked that for the job, with favorable results.  I call it, IMDG (interactive merthese debugger, play on IRB, or "interactive Ruby").

It implements ALL _o/ of the standard Merthese library (Merthing @ Kerm with Nikky && tev), but adds new control to this very well versed esoteric language.  New Merthese directives:


Code:
#extend -- allows you to load a module to be used when interpreting programs (example, "#extend"ing "@ Kerm" will make the Merthing @ Kerm module be added to interpreting ruleset)

#retract -- opposite of #extend, unloads a module given if in use

#create -- allows you to code a new module to be used in interpretation. More information below.

#end -- ends a #create session.  More below.

#exit -- exits the interpreter.

#whore -- makes the interpreter an attention whore for 1 line, and will pick a random sequence of characters to use for the next line of the program input.


The biggest extension to the language I added is creation of new modules -- within the interpreter.  It uses Lua as the scripting language (duh), and your script can global Merthese variables (the most useful of which are 'arg' (the current iterated character of the loop), 'index' (the position in the loop from input beginning), and 'input' (the entire string of input given as a Merthese program line)).  For an example, in the demo video below (made a video simply because I'm an attention #whore, pun intended), I create on the spot a "Merthing and Ashbad are awesome" extension that prints "ASHBAD IZ SMRT" if the currently passed argument is 'a'.



And, of course, obligatory source Smile


Code:
input = ""
math.randomseed(os.time())
accum = 0
new_extensions = { }
extensions = { Kerm = false, nikky = false, tev = false }
extensions_names = { Kerm = "@ Kerm ", nikky = "with Nikky ", tev = "&& tev " }
next_input_is_whore = false
repeat
   local has_hit_name = false
   for i,j in pairs(extensions) do
      if(j==true) then 
         has_hit_pair = true
         break
      end
   end
   if(has_hit_name) then
      io.write("Merthese > ")
   else
      local std_ext = "Merthing "
      for i,j in pairs(extensions) do
         if(j==true) then
            std_ext = std_ext .. extensions_names[i]
         end
      end
      io.write(std_ext .. ">")
   end
   if(next_input_is_whore==false) then
      input = io.read()
   else
      io.write(input)
   end
   next_input_is_whore = false
   if(input=="#extend" and next_input_is_whore==false) then
      io.write("Extension name: ")
      local new_ext = io.read()
      local has_hit = false
      for i,j in pairs(extensions_names) do
         if(string.sub(j, 1, #j - 1)==new_ext) then 
            has_hit = true
            extensions[i] = true
            break
         end
      end
      if(has_hit==false) then
         io.write("Error: no module for \"" .. new_ext .. "\" has been found\n") 
      end
   elseif(input=="#retract" and next_input_is_whore==false) then
      io.write("Extension name: ")
      local new_ext = io.read()
      local has_hit = false
      for i,j in pairs(extensions_names) do
         if(string.sub(j, 1, #j - 1)==new_ext and extensions[i]==true) then 
            has_hit = true
            extensions[i] = false
            break
         end
      end
      if(has_hit==false) then
         io.write("\nError: module \"" .. new_ext .. " is not currently loaded\n") 
      end
   elseif(input=="#create" and next_input_is_whore==false) then
      io.write("New Module Name: ")
      local new_mod = io.read() .. " "
      io.write("\nNew Module Code (end editing with #end):\n")
      local code = ""
      local last = ""
      repeat
         last = io.read()
         if(last~="#end") then
            code = code .. last .. " "
         end
      until(last=="#end")
      table.insert(new_extensions, code)
      table.insert(extensions, false)
      table.insert(extensions_names, new_mod)
   elseif(input=="" and next_input_is_whore==false) then
   elseif(input=="#whore") then
      input = ""
      for i=1, math.floor(math.random(0, 428.7)) do
         input = input .. string.char(math.floor(math.random(97,122))%256)
      end
      next_input_is_whore = true
   else
      io.write("\n")
      for i=1, #input do
         arg = string.char(string.byte(input, i)%256)
         if(table.getn(new_extensions) >= 1) then
            for j,k in pairs(new_extensions) do
               if(extensions[j]==true) then
                  loadstring(k)()
               end
            end
         end
         if(arg=='m') then
            if(math.random() < 0.5 and extensions.Kerm==true) then
               io.write(accum)
            else            
               io.write("merth")
            end
         elseif(arg=='e') then
            if(math.random()*3 < 1 and extensions.Kerm==true) then
               accum = accum+1
            elseif(math.random()*3 < 2) then
               io.write("\n")
            elseif(extensions.tev==true) then
               local e_arg_pos = math.floor(math.random(1,10))
               io.write(string.sub("‘.,;:-!?'’", e_arg_pos, e_arg_pos))  
            end
         elseif(arg=='r') then
            io.write(" ")
         elseif(arg=='t') then
            if(math.random() < 0.5) then
               local t_arg = ""
               for j=1, math.floor(math.random(0, 13.4)) do
                  t_arg = t_arg .. string.char(math.floor(math.random(string.byte('a'), string.byte('z')))%256)
               end
               io.write(t_arg)
            elseif(extensions.tev==true) then
               local t_arg_accum = accum
               for j=0, math.floor(math.random(1,13.4)) do
                  io.write(string.char(t_arg_accum%256))
                  t_arg_accum = t_arg_accum+1
               end
               if(math.random() < 0.5) then
                  accum = t_arg_accum+1
               end
            end
         elseif(arg=='h') then
            i,i = string.find(string.sub(arg,i), "h")~=nil and string.find(string.sub(arg,i), "h")+1 or #input,#input
         elseif(arg=='k' and (extensions.Kerm==true or extensions.nikky==true)) then
            if(math.random() > 0.5 and extensions.Kerm==true) then
               io.write(string.char(accum))
            elseif(extensions.nikky==true) then
               io.write("nikky")
            end
         elseif(arg=='r') then
            accum = 0
         elseif(arg=='n') then
            accum = accum + (string.byte(input, i+1)~=nil and string.byte(input, i+1) or 0)
         elseif(arg=='i' and extensions.nikky==true) then
            io.write("\n? ")
            accum = string.byte(string.sub(io.read(), 1, 1))
            io.write("\n")
         elseif(arg=='y' and extensions.nikky==true) then
            for j=1, (string.byte(input, i+1)~=nil and string.byte(input, i+i) or 0) do
               io.write(string.char(string.byte(input, i+1)%256))
            end
         elseif(arg=='v' and extensions.tev==true) then
            io.write((accum >= 97 and accum <= 122) and 
               (string.char((string.byte(accum)+13 <= 122 and
               string.byte(accum)+13 or string.byte(accum)+13-122+string.byte(accum))%256)) 
            or string.char(accum%256))
         end      
      end
      io.write("\n")
   end
until(input=="#exit")
Travis wrote:
Thanks. I was wishing you had explained it before because I had no idea how to implement it and had to just make up something. Wink

So if I understand correctly, the way you were intending it, you can only loop the following character, not multiple ones, right? What happens if the next character is not a valid Merthese instruction? Does it just move forward until it finds a valid character and loops that, or does it just do nothing N times? And for characters that can do multiple things, does it choose a random action each pass through the loop, or does it choose the action once and loop that one action?

Hmm, good questions. Going off of the way that mine worked, it would only loop the next character, and if it happened to be an invalid character, it would just loop pointlessly. Also, it would choose a random thing each time.
Why does it start with "Merthing"? The base dialect is "Merthese". I'm also not terribly fond of people throwing "whore" into my language, but other than those, looks pretty sweet.
merthsoft wrote:
Why does it start with "Merthing"? The base dialect is "Merthese". I'm also not terribly fond of people throwing "whore" into my language, but other than those, looks pretty sweet.


It's supposed to say "Merthese" if no modules are loaded, but it seems it doesn't. It's only supposed to say "Merthing" in conjunction with other modules -- will fix tomorrow Smile

Also, if you would prefer, I can change the "#whore" directive out (was to pick fun at nikky's vocal choice, mostly) with something else, suggestions? Smile

(edit: suggestions for the new name, not for a new function associated with the word #whore)

Edit2: with no objections, tomorrow I'm going to do a ctrl-h replace all on #whore to #nikky Smile

Edit3: Cathy said there was no java implementation yet, so I raced to make one first. Finished in <4 mins, on iPad:


Code:
public class Merth {
  public static void main(String args[]) {
    String input = "";
    for(int j=1; j<args.length; j++) {
      input += args[j];
    }
    for(int j=0; j<input.length(); j++) {
      char arg = input.charAt(j);
      switch(j) {
        case 'm': System.out.print("merth"); break;
        case 'e': System.out.println(); break;
        case 'r': System.out.print("r"); break;
        case 't':
          String a = "";
          for(int k=0; k< 7; k++) { // cheap, but compliant, I'm racing to do this :)
            a+= ((char)Math.random('a', 'z')).tostring();
          }
          System.out.print(a);
          break;
        case 'h':
          j = input.substring(j+1).indexOf("h");
          if(j==-1) { System.exit(0); }
          break;
      }
    }
  }
}


Edit4: I updated the Esolang page: http://esoteric.voxelperfect.net/wiki/Merthese

Updated list of implementations, new extensions (could someone add more to my World Wide Merth one? It's lacking due to my lack of knowledge how it is supposed to work, really), and proof editing.
Here's my Merthese z80 compiler: http://dl.dropbox.com/u/3601919/upload/compiler.exe
Example output from "merthttthmmemmemmemememheeeememethmememr":

Code:
.nolist
#include "ti83plus.inc"
#include "dcs7.inc"

.list
   .org progstart
   .db $BB,6D
   jr Main
   
Merth_string:
   .db "merth",0
routine_t:
   ld b,14
   call iRandom
   ld b,a
_loop:
   push bc
   ld b,26
   call iRandom
   add a,$61
   b_call(_PutC)
   pop bc
   djnz _loop
   ret
Main:
   ld hl, Merth_string
   b_call(_PutS)
   b_call(_NewLine)
   ld a,' '
   b_call(_PutC)
   call routine_t
   jp _0
   call routine_t
   call routine_t
   call routine_t
_0:
   ld hl, Merth_string
   b_call(_PutS)
   ld hl, Merth_string
   b_call(_PutS)
   b_call(_NewLine)
   ld hl, Merth_string
   b_call(_PutS)
   ld hl, Merth_string
   b_call(_PutS)
   b_call(_NewLine)
   ld hl, Merth_string
   b_call(_PutS)
   ld hl, Merth_string
   b_call(_PutS)
   b_call(_NewLine)
   ld hl, Merth_string
   b_call(_PutS)
   b_call(_NewLine)
   ld hl, Merth_string
   b_call(_PutS)
   b_call(_NewLine)
   ld hl, Merth_string
   b_call(_PutS)
   jp _1
   b_call(_NewLine)
   b_call(_NewLine)
   b_call(_NewLine)
   b_call(_NewLine)
   ld hl, Merth_string
   b_call(_PutS)
   b_call(_NewLine)
   ld hl, Merth_string
   b_call(_PutS)
   b_call(_NewLine)
   call routine_t
_1:
   ld hl, Merth_string
   b_call(_PutS)
   b_call(_NewLine)
   ld hl, Merth_string
   b_call(_PutS)
   b_call(_NewLine)
   ld hl, Merth_string
   b_call(_PutS)
   ld a,' '
   b_call(_PutC)
   ret
Alright, I fixed up the wiki a bit. Here's what I did:
- Fixed formatting of the commands to be in a table.
- Removed excess spaces after periods (for consistency, let's just stick to one space after the period).
- Re-chronologized implementation list (please try to keep this in order).
- Put compilers by what language they compiled down to.
- Fixed some incidental wording here and there.
- Removed any mention of "#whore", seemed unnecessary, though history fans I suppose may like it.
- Removed the World Wide Whatever stuff until that's better defined.
- With that was removal of Turing Completeness. Until we get a proof one way or the other (a formal one), let's not bring it up.
- Changed mention of "standard library" to "standard set of extensions", I prefer it this way. If everyone else likes it more the other way we can change it back.
I think that's it.

Good work overall, guys. I'm really digging all this stuff.
Here's a version in FORTH (That works on my compiler! Very Happy). I added a word, RAND, that returns a number between 0 and n (inclusive). Maybe the only other things that are different from a normal FORTH compiler are: \ is for a comment to the end of the line, and [CHAR] x is replaced by the ascii code for x. Also, it doesn't really use that many functions in the end (Most of them are inlined, except for HH, H?, and RAND-STRING). And, not sure if the standard specifies, but I am using -1 as the EOF.

Code:
\ : RAND ( max -- {0..max-1} )
: RAND-STRING 13 RAND 0 DO 26 RAND [CHAR] a + EMIT LOOP ;

: MM ." merth" ;
: EE SPACE ;
: RR CR ;
: TT RAND-STRING ;
: HH BEGIN KEY [CHAR] h = UNTIL ;

: M? DUP [CHAR] m = IF MM THEN ;
: E? DUP [CHAR] e = IF EE THEN ;
: R? DUP [CHAR] r = IF RR THEN ;
: T? DUP [CHAR] t = IF TT THEN ;
: H? DUP [CHAR] h = IF HH THEN ;

: CHECK-FOR-INSTRUCTION M? E? R? T? H? ;
: EOF? -1 = ;
: MERTHESE BEGIN KEY CHECK-FOR-INSTRUCTION EOF? UNTIL ;

MERTHESE
So I was looking through the programming manual for the CNC machine I run at work and if I can find a way to get random numbers I am so writting a g-code merthese interpreter, one that takes input and outputs to cold hard steel(or chrome or aluminum). Very Happy I've been looking for a reason to brush up on my NC programming and this seems like a great way to do it.

Input can be handled by the touch off probe we have. My thought was to have it measure different heights along the input block and then store them in the machines local vars. From there I can switch pallets and then output to the block placed there.

The biggest issue would be handling the random numbers needed input but my thought was to use spindle position basing the rpm and spin time off of the previous random number.

The main issue is this would all be very machine specific so even if I got it working I'd have no way to test and nor would anyone else unless they have the exact same machine with the same touch off probe, nc controller and other accessories. Though I may be able to nudge one of the free cnc simulators to test the output code.
merthsoft wrote:
Alright, I fixed up the wiki a bit. Here's what I did:
- Fixed formatting of the commands to be in a table.
- Removed excess spaces after periods (for consistency, let's just stick to one space after the period).
- Re-chronologized implementation list (please try to keep this in order).
- Put compilers by what language they compiled down to.
- Fixed some incidental wording here and there.
- Removed any mention of "#whore", seemed unnecessary, though history fans I suppose may like it.
- Removed the World Wide Whatever stuff until that's better defined.
- With that was removal of Turing Completeness. Until we get a proof one way or the other (a formal one), let's not bring it up.
- Changed mention of "standard library" to "standard set of extensions", I prefer it this way. If everyone else likes it more the other way we can change it back.
I think that's it.

Good work overall, guys. I'm really digging all this stuff.


Thanks for cleaning some stuff up Smile I did a lot of editing/cleaning myself the other day, and was sure there would be some things that would have to be changed.
Okay, here's the source for my latest SysRPL Merthese interpreter (MASD format). I've been getting my feet wet with SysRPL recently and thought this would be a good warm-up exercise.
http://pastebin.com/bbRh9ETH

This time it supports external loadable extension modules, which can be written in either form of RPL. The downside is that the dynamic modules make the interpreter relatively slow. Kerm, Nikky, Tev, Ashbad extensions are implemented. The Nikky module now implements loops as described by _player1537.

It should work either from a directory or built into a library. Quick rundown:

The global variable ‘MertheseModules’ holds the names of any extra modules to load by default (e.g., { TEV.MOD NIKKY.MOD }, { } for just base Merthese, etc.). Put a string on the stack and run MERTHESE. MertheseModules can be overridden by placing on the stack the program string, then the list of modules to use instead, then running MERTHESEMOD.

Since I doubt very many people around here actually have/use HP calcs, I'll stop here unless anyone wants to know more.
I just ported Merthese to BASIC256!

Code:
cls
clg
hstatus = false
l$ = {"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"," "}
print "Merthese Programming Language"
print "Ported to BASIC256 by Spyro543"
while true
start:
print "Ready."
input "> ",cmd$
if cmd$ = "" then goto start
for i = 1 to length(cmd$)
s$ = mid(cmd$,i,1)
if hstatus = true then
if s$ = "h" then hstatus = false
else
if s$ = "m" then print "merth";
if s$ = "e" then print ""
if s$ = "r" then print " ";
if s$ = "t" then
times = int(rand * 13.4) + 1
for x = 1 to times
num = int(rand * 27)
print l$[num];
next x
endif
if s$ = "h" then
hstatus = true
endif
endif
next i
print ""
endwhile


Screenshots:
The terminal when you start the program:


Running a merthese program:


The "t" command in action:


Download link:
http://www.mediafire.com/?lm3j96337dk12h5

EDIT: Updated the wiki page on esolangs.org so BASIC256 is in the list of implementations.
A Rust implementation! Tested with rustc 0.7.

Code:
use std::rand;
use std::rand::RngUtil;

fn main() {
    let stdin = std::io::stdin();
    let stdout = std::io::stdout();
    let mut rng = rand::rng();

    loop {
        let c = stdin.read_char();
        if stdin.eof() {
            break;
        }

        match c {
            'm' => print("merth"),
            'e' => print("\n"),
            'r' => print(" "),
            't' => {
                let len = rng.gen_uint_range(0, 13.4 as uint);
                for std::uint::range(0, len) |i| {
                    let x = rng.gen_uint_range('a' as uint, 'z' as uint);
                    stdout.write_char(x as char);
                }
            },
            'h' => {
                stdin.read_until('h' as u8, true);
            },
            _ => ()
        }
    }
}
Plenty of library churn in Rust since my original version. Wrote this one against a 0.10-pre snapshot:
rustc --version wrote:
rustc 0.10-pre (af93684 2014-03-17 11:57:08 -0700)

Notably, the required handling of I/O errors is much more robust in current versions. Previously one could opt in to handling I/O errors which would otherwise fail!() the task; now the possibility of error must be accounted for on all operations that return IoResult.

Code:
extern crate rand;

use std::iter;
use std::io;
use rand::Rng;

fn main() {
    let mut stdin = io::stdin();
    let mut stdout = io::stdout();

    match merthterpret(&mut stdin, &mut stdout) {
        Ok(..) => unreachable!(),
        Err(e) => match e.kind {
            io::EndOfFile => (),
            _ => println!("I/O error: {}", e.desc)
        }
    }
}

fn merthterpret<R: Buffer, W: Writer>(input: &mut R, output: &mut W) -> io::IoResult<()> {
    let mut rng = rand::task_rng();
    loop {
        let c = try!(input.read_char());

        match c {
            'm' => print!("merth"),
            'e' => print!("\n"),
            'r' => print!(" "),
            't' => {
                let len = rng.gen_range(0, 13.4 as uint);
                for _ in iter::range(0, len) {
                    let x = rng.gen_range('a' as u8, 'z' as u8);
                    try!(output.write_char(x as char));
                }
            },
            'h' => {
                try!(input.read_until('h' as u8));
            },
            _ => ()
        }
    }
}
A MUMPS implementation:

Code:
Merthterpret(string) n index,char,hFlag
   s hFlag=0
   f index=1:1:$l(string) d
   . s char=$e(string,index,index)
   . i hFlag d
   . . s:char="h" hFlag=0
   . e  d
   . . s:char="h" hFlag=1
   . . w:char="e" !
   . . w $s(char="m":"merth",char="r":" ",char="t":$$randString($r(14.4)),1:"")
   q
   ;
randString(length) n s,ret,index,rand
   s ret=""
   s s="abcdefghijklmnopqrstuvwxyz"
   f index=1:1:length d
   . s rand=$r(26)+1
   . s ret=ret_$e(s,rand,rand)
   q ret
All Merthese compilers are deleted!
https://github.com/elfprince13/MerthingAtKerm-Scala
Implemented in Scala, as a proper javax.script.ScriptEngine.

The relevant bit, for anyone who cares:


Code:
class MertheseEngine(val atKerm:Boolean, val seed:Long) extends AbstractScriptEngine {
   val random = new Random(seed)
   
   def createBindings(): Bindings = {
      new SimpleBindings(Map[String,AnyRef]("accumulator" -> ('\0':java.lang.Character),"seeking" -> (false:java.lang.Boolean)).asJava)
   }

   def eval(srcReader: java.io.Reader,context: ScriptContext): Object = {
      Stream.continually(srcReader.read()).takeWhile(_ != -1).map(i => exec(i.toChar,context)).mkString("")
   }
   
   def eval(srcString: String,context: ScriptContext): Object = {
      Stream.from(0).takeWhile(_ < srcString.length).map(i => exec(srcString.charAt(i),context)).mkString("")
   }
   
   def exec(char: Char, context: ScriptContext):String = {
      val state = context.getBindings(ScriptContext.ENGINE_SCOPE)
      if (state.get("seeking").asInstanceOf[java.lang.Boolean]){
         state.put("seeking",(false:java.lang.Boolean));""
      } else {
         val shouldKerm = atKerm && random.nextBoolean
         char match {
            case 'm' => if(shouldKerm){
                  state.get("accumulator").asInstanceOf[java.lang.Character].charValue.toInt.toString
               } else{"merth"}
            case 'e' => if(shouldKerm){
               val c = state.get("accumulator").asInstanceOf[java.lang.Character].charValue()
               state.put("accumulator",
                  (if (Character.UnicodeBlock.of(c+1) == Character.UnicodeBlock.BASIC_LATIN){
                     c + 1
                  } else {
                     '\0'
                  }:java.lang.Character)
               );""
            } else {"\n"}
            case 'r' => if(shouldKerm){
                  state.put("accumulator",('\0':java.lang.Character));""
               } else {" "}
            case 't' =>
               random.alphanumeric.filter(_.isLower).take((random.nextDouble*13.4).toInt).mkString("")
            case 'h' => state.put("seeking",(true:java.lang.Boolean));""
            case 'k' =>  if(atKerm){
                  state.get("accumulator").asInstanceOf[java.lang.Character].toString
               } else {""}
            case _ => ""
         }
      }
   }
   
   def getFactory() = MertheseFactory
}
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 6 of 7
» All times are GMT - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum