Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 484683
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T01:19:30+00:00 2026-05-13T01:19:30+00:00

Has anyone written either a long or short program in COW that demonstrates what

  • 0

Has anyone written either a long or short program in COW that demonstrates what it can do? Sure, the language is a joke; but since it is Turing complete, maybe someone has written a high-level language that translates into COW. After writing a short, practical program that at least showed what you typed on the screen, one would think that someone has written a far more interesting application in the language.

MoOMOOmoOMooMooOOOmOomoo
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T01:19:30+00:00Added an answer on May 13, 2026 at 1:19 am

    DDX further increases the capabilities of COW, and when translated into EZ COW, it considerably easier to read. What follows is an EZ DDX COW program written with comments well interspersed into the code.

    This is the first word.
    N = M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++
        M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++
        M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++
        M++M++M++P++
    U = M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++
        M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++
        M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++
        M++M++M++M++M++M++M++M++M++M++P++
    M = M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++
        M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++
        M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++
        M++M++P++
      = M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++
        M++M++M++M++M++M++M++P++
    = = M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++
        M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++
        M++M++M++M++M++M++M++M++M++M++M++P++
      = M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++
        M++M++M++M++M++M++M++
    
    Show the prompt.
    P--P--P--P--P--
    LOP
    I/O
    P++
    END
    
    Get and store the input.
    INP
    REG (or "wiz")
    M=0
    M++
    S++
    
    This is the second word.
    D = M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++
        M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++
        M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++P++
    I = M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++
        M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++
        M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++P++
    V = M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++
        M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++
        M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++
        M++M++M++M++M++M++M++M++M++M++M++P++
      = M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++
        M++M++M++M++M++M++M++P++
    = = M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++
        M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++
        M++M++M++M++M++M++M++M++M++M++M++P++
      = M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++
        M++M++M++M++M++M++M++
    
    Show the prompt.
    P--P--P--P--P--
    LOP
    I/O
    P++
    END
    
    Get the input and setup for calculation.
    INP
    S++
    M--
    WIZ
    
    Display the results.
    
    (this stomach is no longer needed)
    S--
    M=0
    
    (string)
    M++M++M++M++M++M++M++M++M++M++P++
    
    M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++
    M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++
    M++M++M++M++M++M++M++M++M++M++M++M++M++P++
    
    M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++
    M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++
    M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++
    P++
    
    M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++
    M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++
    M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++
    M++M++M++M++M++P++
    
    M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++
    M++M++M++M++M++M++P++
    
    M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++
    M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++
    M++M++M++M++M++M++M++M++M++P++
    
    M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++
    M++M++M++M++M++M++
    
    P--P--P--P--P--P--
    
    (print)
    LOP
    I/O
    P++
    END
    S--
    OUT
    S++
    
    (string)
    M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++
    M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++
    M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++
    M++M++M++M++P++
    
    M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++
    M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++
    M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++P++
    
    M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++
    M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++
    M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++P++
    
    M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++
    M++M++M++M++M++M++P++
    
    M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++
    M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++
    M++M++M++M++M++M++M++M++M++P++
    
    M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++M++
    M++M++M++M++M++M++
    
    P--P--P--P--P--
    
    (print)
    LOP
    I/O
    P++
    END
    S++
    OUT
    

    What follows is a simple interpreter written in Python. It can take the “divide.cow” file listed above and run it quickly enough for live interaction with the program. Other example COW programs are still welcomed!

    INS = ['moo', 'mOo', 'moO', 'mOO', 'Moo', 'MOo',
           'MoO', 'MOO', 'OOO', 'MMM', 'OOM', 'oom',
           'MMm', 'MmM', 'Oom', 'oOm',
           'OoM', 'oOM', 'ooo', 'mmm']
    
    HLP = dict((s, i) for i, s in enumerate(INS))
    
    import sys
    import msvcrt
    
    ################################################################################
    
    class COD:
    
        def __init__(self, code):
            for ins in code:
                assert 0 <= ins < len(INS)
            self.cod = code
            self.pos = 0
    
        def get(self):
            return self.cod[self.pos]
    
        def inc(self):
            self.pos += 1
            if self.pos == len(self.cod):
                sys.exit()
    
        def dec(self):
            self.pos -= 1
            assert self.pos >= 0
    
    ################################################################################
    
    class MEM:
    
        def __init__(self):
            self.mem = {}
            self.pos = 0
    
        def get(self):
            if self.pos in self.mem:
                return self.mem[self.pos]
            return 0
    
        def set(self, value):
            if value:
                self.mem[self.pos] = value
            elif self.pos in self.mem:
                del self.mem[self.pos]
    
        def inc(self):
            self.pos += 1
    
        def dec (self):
            self.pos -= 1
    
    ################################################################################
    
    class DDX:
    
        STOMACHS = 7
    
        def __init__(self):
            self.mem = [MEM() for stomach in range(self.STOMACHS)]
            self.pos = 0
    
        def __getattr__(self, name):
            return getattr(self.mem[self.pos], name)
    
        def ddx_prv(self):
            self.pos = (self.pos - 1 + self.STOMACHS) % self.STOMACHS
    
        def ddx_nxt(self):
            self.pos = (self.pos + 1) % self.STOMACHS
    
        def ddx_dec(self):
            for stomach in self.mem:
                stomach.dec()
    
        def ddx_inc(self):
            for stomach in self.mem:
                stomach.inc()
    
        def ddx_sub(self):
            for stomach in self.mem:
                stomach.set(stomach.get() - 1)
    
        def ddx_add(self):
            for stomach in self.mem:
                stomach.set(stomach.get() + 1)
    
        def ddx_nul(self):
            for stomach in self.mem:
                stomach.set(0)
    
        def ddx_reg(self, reg):
            if reg is None:
                return sum(map(MEM.get, self.mem))
            else:
                all_zero = True
                for stomach in self.mem:
                    if stomach.get():
                        all_zero = False
                        break
                if all_zero:
                    for stomach in self.mem:
                        stomach.set(reg)
                else:
                    weighting = sum(map(MEM.get, self.mem))
                    base, remainder = divmod(reg, weighting)
                    for stomach in self.mem:
                        temp = stomach.get()
                        if temp < 0:
                            stomach.set(abs(temp) * remainder)
                        else:
                            stomach.set(temp * base)
                return None
    
    
    ################################################################################
    
    def parse(string):
        index = 0
        code = []
        ins = string[index:index+3]
        while len(ins) == 3:
            if ins in INS:
                code.append(INS.index(ins))
                index += 3
            else:
                index += 1
            ins = string[index:index+3]
        return tuple(code)
    
    DECODE = ['END', 'P--', 'P++', 'EXE', 'I/O', 'M--',
              'M++', 'LOP', 'M=0', 'REG', 'OUT', 'INP',
              'S--', 'S++', 'AP-', 'AP+',
              'AM-', 'AM+', 'A=0', 'WIZ']
    
    def decode(code):
        for ins in code:
            print(INS[ins] + '\t' + DECODE[ins])
        print()
    
    def engine(code):
        global REG
        REG = None
        mem = DDX()
        cod = COD(code)
        ins = cod.get()
        while True:
            ins = run(mem, cod, ins)
    
    def run(mem, cod, ins):
        global REG
        # INS - 0 - moo
        if ins == 0:
            cod.dec()
            cod.dec()
            # INIT
            level = 1
            temp = cod.get()
            if temp == HLP['moo']:
                level += 1
            elif temp == HLP['MOO']:
                level -= 1
            while level:
                # LOOP
                cod.dec()
                temp = cod.get()
                if temp == HLP['moo']:
                    level += 1
                elif temp == HLP['MOO']:
                    level -= 1
            return HLP['MOO']
        # INS - 1 - mOo
        elif ins == 1:
            mem.dec()
            cod.inc()
            return cod.get()
        # INS - 2 - moO
        elif ins == 2:
            mem.inc()
            cod.inc()
            return cod.get()
        # INS - 3 - mOO
        elif ins == 3:
            temp = mem.get()
            assert temp != 3
            if 0 <= temp < len(INS):
                return run(mem, cod, temp)
            else:
                sys.exit()
        # INS - 4 - Moo
        elif ins == 4:
            temp = mem.get()
            if temp:
                msvcrt.putch(bytes([temp & 127]))
            else:
                char = get_char()
                mem.set(char & 127)
            cod.inc()
            return cod.get()
        # INS - 5 - MOo
        elif ins == 5:
            mem.set(mem.get() - 1)
            cod.inc()
            return cod.get()
        # INS - 6 - MoO
        elif ins == 6:
            mem.set(mem.get() + 1)
            cod.inc()
            return cod.get()
        # INS - 7 - MOO
        elif ins == 7:
            temp = mem.get()
            if temp:
                cod.inc()
                return cod.get()
            else:
                cod.inc()
                cod.inc()
                # INIT
                level = 1
                temp = cod.get()
                if temp == HLP['moo']:
                    level -= 1
                elif temp == HLP['MOO']:
                    level += 1
                while level:
                    # LOOP
                    cod.inc()
                    temp = cod.get()
                    if temp == HLP['moo']:
                        level -= 1
                    elif temp == HLP['MOO']:
                        level += 1
                cod.inc()
                return cod.get()
        # INS - 8 - OOO
        elif ins == 8:
            mem.set(0)
            cod.inc()
            return cod.get()
        # INS - 9 - MMM
        elif ins == 9:
            if REG is None:
                REG = mem.get()
            else:
                mem.set(REG)
                REG = None
            cod.inc()
            return cod.get()
        # INS - 10 - OOM
        elif ins == 10:
            print_int(mem.get())
            cod.inc()
            return cod.get()
        # INS - 11 - oom
        elif ins == 11:
            mem.set(get_int())
            cod.inc()
            return cod.get()
        # INS - 12 - MMm
        elif ins == 12:
            mem.ddx_prv()
            cod.inc()
            return cod.get()
        # INS - 13 - MmM
        elif ins == 13:
            mem.ddx_nxt()
            cod.inc()
            return cod.get()
        # INS - 14 - Oom
        elif ins == 14:
            mem.ddx_dec()
            cod.inc()
            return cod.get()
        # INS - 15 - oOm
        elif ins == 15:
            mem.ddx_inc()
            cod.inc()
            return cod.get()
        # INS - 16 - OoM
        elif ins == 16:
            mem.ddx_sub()
            cod.inc()
            return cod.get()
        # INS - 17 - oOM
        elif ins == 17:
            mem.ddx_add()
            cod.inc()
            return cod.get()
        # INS - 18 - ooo
        elif ins == 18:
            mem.ddx_nul()
            cod.inc()
            return cod.get()
        # INS - 19 - mmm
        elif ins == 19:
            REG = mem.ddx_reg(REG)
            cod.inc()
            return cod.get()
        # ERROR
        else:
            raise Exception('Bad instruction!')
    
    def print_int(number):
        for char in str(number):
            msvcrt.putch(bytes([ord(char) & 127]))
        msvcrt.putch(b' ')
    
    def get_char():
        while msvcrt.kbhit():
            msvcrt.getch()
        func = False
        char = msvcrt.getch()[0]
        if char in (0x00, 0xE0):
            func = True
        while func:
            msvcrt.getch()
            func = False
            char = msvcrt.getch()[0]
            if char in (0x00, 0xE0):
                func = True
        return char if char != 13 else 10
    
    def get_int():
        while msvcrt.kbhit():
            msvcrt.getch()
        buff = ''
        char = chr(msvcrt.getch()[0])
        while char != '\r' or not buff:
            if '0' <= char <= '9':
                msvcrt.putch(bytes([ord(char) & 127]))
                buff += char
            char = chr(msvcrt.getch()[0])
        sys.stdout.write('\n')
        return int(buff)
    
    ################################################################################
    
    def main():
        path = input('Run File: ') + '.cow'
        code = parse(open(path).read())
        decode(code)
        engine(code)
    
    ################################################################################
    
    if __name__ == '__main__':
        INS, DECODE = DECODE, INS
        try:
            main()
        except SystemExit:
            input()
        except:
            import traceback
            input(traceback.format_exc())
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 256k
  • Answers 256k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I had to remove, and re-add the controllers for some… May 13, 2026 at 10:30 am
  • Editorial Team
    Editorial Team added an answer If the file is moved (in the same filesystem) or… May 13, 2026 at 10:30 am
  • Editorial Team
    Editorial Team added an answer I usually seem to see NSManagedObject subclasses referred to as… May 13, 2026 at 10:30 am

Related Questions

I am currently trying to implement an algorithm to select a unique (16-bit) identifier.
When using memory-mapped files it seems it is either read-only, or write-only. By this
Is there some standard way or has anyone written something that allows you to
As part of the base class for some extensive unit testing, I am writing

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.