Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Woof, a joke language with a proof of concept [Now with 256 diffrent counters!]  (Read 839 times)

MoonyTheHuman

  • Bay Watcher
  • I think the DEC VAX hates me.
    • View Profile
    • hellomouse

Woof is a language that has only 6 commands, its quite simple, see the PoC code for their functions
Spoiler (click to show/hide)
« Last Edit: April 22, 2016, 09:17:04 pm by MoonyTheHuman »
Logged

smjjames

  • Bay Watcher
    • View Profile
Re: Woof, a joke language with a proof of concept
« Reply #1 on: April 22, 2016, 08:52:59 pm »

Looks like a code for an obnoxious bot. Maybe.
Logged

Shadowlord

  • Bay Watcher
    • View Profile
Re: Woof, a joke language with a proof of concept
« Reply #2 on: April 22, 2016, 09:13:31 pm »

Woof is a language that has only 4 commands, its quite simple, see the PoC code for their functions
Spoiler (click to show/hide)

Quote
char inttochartable[54] = {'a','A','b','B','c','C','d','D','e','E','f','F','g','G','h','H','i','I','j','J','k','K','l','L','m','M','n','N','o','O','p','P','q','Q','r','R','s','S','t','T','u','U','v','V','w','W','x','X','y','Y','z','Z','/n',' '};

(╯°□°)╯︵ ┻━┻

Seven hells, man, do you even ASCII!?
Logged
<Dakkan> There are human laws, and then there are laws of physics. I don't bike in the city because of the second.
Dwarf Fortress Map Archive

MoonyTheHuman

  • Bay Watcher
  • I think the DEC VAX hates me.
    • View Profile
    • hellomouse
Re: Woof, a joke language with a proof of concept
« Reply #3 on: April 22, 2016, 09:14:52 pm »

Woof is a language that has only 4 commands, its quite simple, see the PoC code for their functions
Spoiler (click to show/hide)

Quote
char inttochartable[54] = {'a','A','b','B','c','C','d','D','e','E','f','F','g','G','h','H','i','I','j','J','k','K','l','L','m','M','n','N','o','O','p','P','q','Q','r','R','s','S','t','T','u','U','v','V','w','W','x','X','y','Y','z','Z','/n',' '};

(╯°□°)╯︵ ┻━┻

Seven hells, man, do you even ASCII!?
if you can do better, post updated code

Shadowlord

  • Bay Watcher
    • View Profile

This eliminates the table:

Code: [Select]
char int_to_char(int input) {
    if (input > 0 && input < 26) {
        return (char) (input + 'A');
    } else if (input >= 26 && input < 52) {
        return (char) (input + 'G'); //or (input-26)+'a'
    } else if (input == 52) {
        return '\n'; // '/n' is not a character
    } else if (input == 53) {
        return ' ';
    } else {
        return 0;
    }
}

That might not be faster than yours, of course, since you're just doing a table lookup. But you'd have never had to make that table. :P

Also, it probably would be faster if the ifs and else ifs were replaced with switch/case, but iirc you'd need 25 case statements that fell through to the 26th for a-z and again for A-Z, because C/C++ doesn't allow conditions in case and so forth.

P.S. did I mention you wrote '/n'? I mean, I didn't try to compile what I wrote above, either :V
Logged
<Dakkan> There are human laws, and then there are laws of physics. I don't bike in the city because of the second.
Dwarf Fortress Map Archive

TheDarkStar

  • Bay Watcher
    • View Profile

This makes me want to write my own language. Maybe one controlled with emoticons?
Logged
Don't die; it's bad for your health!

it happened it happened it happen im so hyped to actually get attacked now

MoonyTheHuman

  • Bay Watcher
  • I think the DEC VAX hates me.
    • View Profile
    • hellomouse

This makes me want to write my own language. Maybe one controlled with emoticons?
The base code i used for woof could be morphed into that with little trouble