M30W Programming Forum

M30W is a text-based version of Scratch

You are not logged in.

Announcement

This is the development forum for M30W (also known as Emerald, do not confuse with Emerald Programming Language).
Our Non-development forums are available here

M30W(Emerald) 0.3 is out! (Download) Requires Python 2.6 or higher.
Opal 0.3(A better command line M30W) is out! (Download) Requires Python 2.6 or higher.
M30W 0.3.6 GUI barebones (Download) Requires Python 2.6 or higher and wxPython
Diamond-2 RED2 GUI Barebones (Fancy M30W editor) s out! (Download) Requires .NET Framework 3.5 or higher, does not require Python
M30W++ GUI barebones (Java M30W) Alpha 1 is out! (Download) Requires Java.


Gershmer.net, our hosting, will close in February 2011. We have not fully decided what to do with our hosting after that, but we will tell you when we decide.

Adverts

Adverts

#26 2010-03-31 05:31:14

floppy_gunk
I Am Your Father.
From: Earth, The Milky Way (I think)
Registered: 2009-10-08
Posts: 186
Website

Re: Functions, and M3OW 0.1

Gershmer wrote:

Code:

import time

# Defs

def help():
    print "Opal help"
    print ""
    print "Here are Opal's commands:"
    print "print 'text' - prints text"
    print "wait # s - waits the specified # of seconds."
    print "list - lists the program"
    print "run - runs the program"
    print ""

def list():
    print "Program:"
    print ""
    for i in range(0, len(commands)):
        if commands[i] == 'print':
            print "print '" + commands2[i] + "'"
        elif commands[i] == 'wait':
            print "wait " + commands2[i] + " s"  #" cycles"
    print ""

def run():
    print "Running program:"
    print ""
    for i in range(0, len(commands)):
        if commands[i] == 'print':
            print commands2[i]
        elif commands[i] == 'wait':
            time.sleep(int(commands2[i]))
    print ""

def exit():
    print "Are you sure? Y/N"
    sureyesno = raw_input("")
    if sureyesno[0] == 'y':
        running_opal = 0  # terminate the loop in a polite way, not polite way: break

def a():
    i = 7
    to_print = ''
    while i < len(command) - 1:
        to_print = to_print + command[i]
        i = i + 1
    commands.append('print')
    commands2.append(to_print)

def b():
    i = 5
    to_wait = ''
    while i < len(command) - 2:
        to_wait = to_wait + command[i]
        i = i + 1
    commands.append('wait')
    commands2.append(to_wait)

# Start Program
print "Opal v0.1"
print "A text-based programming language"
print "Based on 'Emerald' by the Emerald Team"
place_holder = raw_input("Hit enter to initiate Opal")
valid_commands = ['print', 'wait']
commands = []
commands2 = []
running_opal = 1
running_program = 0
while running_opal == 1:
    print "Enter command:"
    command = raw_input("")
    if command[0] == valid_commands[0][0] and command[1] == valid_commands[0][1] and command[2] == valid_commands[0][2] and command[3] == valid_commands[0][3] and command[4] == valid_commands[0][4]:
        a()
    elif command[0] == valid_commands[1][0] and command[1] == valid_commands[1][1] and command[2] == valid_commands[1][2] and command[3] == valid_commands[1][3]:
        b()
    elif command == 'help':
        help()
    elif command == 'list':
        list()
    elif command == 'run':
        run()
    elif command == 'exit':
        exit()
    else:
        print "That is not a valid command."

OK. Here you go.

AHEM :mad:

Code:

i = i + 1

NO. It's

Code:

i += 1

GET IT RIGHT OR I WILL MAKE SURE THAT YOU WILL NEVER, EVER USE PYTHON AGAIN!

jk.

Wait a minute. Was it you who wrote that script?


Big Bob bites black bugs, but black bugs bite Big Bob back.

Offline

 

2010-03-31 05:31:14

AdBot
Advertisements

#27 2010-03-31 06:08:50

floppy_gunk
I Am Your Father.
From: Earth, The Milky Way (I think)
Registered: 2009-10-08
Posts: 186
Website

Re: Functions, and M3OW 0.1

markyparky56 wrote:

cds56 wrote:

NUMBER OF THE BEST IS BETTER SOMEHOW

number of best is best. ;)

Best, by definition, is best. What can be better than the best? Of course, it is possible that the best is not best, but the best that best can be conceived best by the best human being with the best of the best mind for conceiving the best that best can be best, unless a better best is best, in which case the best cannot be best, for there is a best better than best, causing the best paradox, but the best is not the best, so the best paradox cannot be best, and therefore there must be a better paradox that is best, but if the best definition of best is best, but not better, then whatever is better than best cannot be best, for best is not best even though it is somehow best, so therefore best is best and also not best meaning that best has two definitions, one better than the other, causing a best better than the best best that best can be, which is the best solution to the above statement, but if something is the best, then there is two of it, one better than the other, so one of them is best, so there is two of it, one better than the other, so one of them is best, etc...

And since everything is best at something in some way, there is an infinite number of everything!

Including CHEESECAKES (and one of them is infinitely best)!! Yum :P


Big Bob bites black bugs, but black bugs bite Big Bob back.

Offline

 

#28 2010-03-31 12:53:06

markyparky56
Hi...
From: Scotland
Registered: 2009-10-08
Posts: 910
Website

Re: Functions, and M3OW 0.1

floppy_gunk wrote:

markyparky56 wrote:

cds56 wrote:

NUMBER OF THE BEST IS BETTER SOMEHOW

number of best is best. ;)

Best, by definition, is best. What can be better than the best? Of course, it is possible that the best is not best, but the best that best can be conceived best by the best human being with the best of the best mind for conceiving the best that best can be best, unless a better best is best, in which case the best cannot be best, for there is a best better than best, causing the best paradox, but the best is not the best, so the best paradox cannot be best, and therefore there must be a better paradox that is best, but if the best definition of best is best, but not better, then whatever is better than best cannot be best, for best is not best even though it is somehow best, so therefore best is best and also not best meaning that best has two definitions, one better than the other, causing a best better than the best best that best can be, which is the best solution to the above statement, but if something is the best, then there is two of it, one better than the other, so one of them is best, so there is two of it, one better than the other, so one of them is best, etc...

And since everything is best at something in some way, there is an infinite number of everything!

Including CHEESECAKES (and one of them is infinitely best)!! Yum :P

Uh... lets just say:
The number of the best is awesome. Nuff said.


I am A M30Wr.
I always get the last word.

Offline

 

#29 2010-03-31 18:59:55

cds56
THE TOOOTH! THE TOOOOOOOOOOOOTH!!!!!
From: Canamadiana
Registered: 2009-11-07
Posts: 423

Re: Functions, and M3OW 0.1

Nice rant on "Best"

But some kid in my school wrote a speech on the concept of nothing. Talk about three minutes of "If there is nothing, then how can there be nothing because nothing is something so if there is nothing, in fact, there is something."

Beastly speech, and he managed to keep a straight face the entire time :D


http://www.catb.org/esr/faqs/glider.png

Offline

 

#30 2010-03-31 19:04:53

markyparky56
Hi...
From: Scotland
Registered: 2009-10-08
Posts: 910
Website

Re: Functions, and M3OW 0.1

cds56 wrote:

Nice rant on "Best"

But some kid in my school wrote a speech on the concept of nothing. Talk about three minutes of "If there is nothing, then how can there be nothing because nothing is something so if there is nothing, in fact, there is something."

Beastly speech, and he managed to keep a straight face the entire time :D

That kid must have nothing to do...


I am A M30Wr.
I always get the last word.

Offline

 

#31 2010-03-31 19:49:18

Gershmer
Admin
From: Newton Centre, Massachusetts
Registered: 2009-10-08
Posts: 515
Website

Re: Functions, and M3OW 0.1

floppy_gunk wrote:

Gershmer wrote:

Code:

import time

# Defs

def help():
    print "Opal help"
    print ""
    print "Here are Opal's commands:"
    print "print 'text' - prints text"
    print "wait # s - waits the specified # of seconds."
    print "list - lists the program"
    print "run - runs the program"
    print ""

def list():
    print "Program:"
    print ""
    for i in range(0, len(commands)):
        if commands[i] == 'print':
            print "print '" + commands2[i] + "'"
        elif commands[i] == 'wait':
            print "wait " + commands2[i] + " s"  #" cycles"
    print ""

def run():
    print "Running program:"
    print ""
    for i in range(0, len(commands)):
        if commands[i] == 'print':
            print commands2[i]
        elif commands[i] == 'wait':
            time.sleep(int(commands2[i]))
    print ""

def exit():
    print "Are you sure? Y/N"
    sureyesno = raw_input("")
    if sureyesno[0] == 'y':
        running_opal = 0  # terminate the loop in a polite way, not polite way: break

def a():
    i = 7
    to_print = ''
    while i < len(command) - 1:
        to_print = to_print + command[i]
        i = i + 1
    commands.append('print')
    commands2.append(to_print)

def b():
    i = 5
    to_wait = ''
    while i < len(command) - 2:
        to_wait = to_wait + command[i]
        i = i + 1
    commands.append('wait')
    commands2.append(to_wait)

# Start Program
print "Opal v0.1"
print "A text-based programming language"
print "Based on 'Emerald' by the Emerald Team"
place_holder = raw_input("Hit enter to initiate Opal")
valid_commands = ['print', 'wait']
commands = []
commands2 = []
running_opal = 1
running_program = 0
while running_opal == 1:
    print "Enter command:"
    command = raw_input("")
    if command[0] == valid_commands[0][0] and command[1] == valid_commands[0][1] and command[2] == valid_commands[0][2] and command[3] == valid_commands[0][3] and command[4] == valid_commands[0][4]:
        a()
    elif command[0] == valid_commands[1][0] and command[1] == valid_commands[1][1] and command[2] == valid_commands[1][2] and command[3] == valid_commands[1][3]:
        b()
    elif command == 'help':
        help()
    elif command == 'list':
        list()
    elif command == 'run':
        run()
    elif command == 'exit':
        exit()
    else:
        print "That is not a valid command."

OK. Here you go.

AHEM :mad:

Code:

i = i + 1

NO. It's

Code:

i += 1

GET IT RIGHT OR I WILL MAKE SURE THAT YOU WILL NEVER, EVER USE PYTHON AGAIN!

jk.

Wait a minute. Was it you who wrote that script?

No. It was one of the last things Magnie ever did.


http://card.ly/images/vcard-green-small.png

Offline

 

#32 2010-04-01 14:59:47

markyparky56
Hi...
From: Scotland
Registered: 2009-10-08
Posts: 910
Website

Re: Functions, and M3OW 0.1

In C# all you have to do is:

Code:

i = i++

You see it mostly in the loops.
where it goes

Code:

for(int i = 1; i < something; i++)
{
... // code
}

I ish learnin'


I am A M30Wr.
I always get the last word.

Offline

 

#33 2010-04-01 22:24:13

cds56
THE TOOOTH! THE TOOOOOOOOOOOOTH!!!!!
From: Canamadiana
Registered: 2009-11-07
Posts: 423

Re: Functions, and M3OW 0.1

in C/C++ all ya need to do is:

Code:

i ++

for(i = 5; i < j; i++)
{
cout << "RAWR WHYR YOU EATING\nMY\nCOO\nKIEEEEEEEEEeeee\nEEEEEEEEEEEEES\n";
}

http://www.catb.org/esr/faqs/glider.png

Offline

 

#34 2010-04-02 19:21:04

markyparky56
Hi...
From: Scotland
Registered: 2009-10-08
Posts: 910
Website

Re: Functions, and M3OW 0.1

cds56 wrote:

in C/C++ all ya need to do is:

Code:

i ++

for(i = 5; i < j; i++)
{
cout << "RAWR WHYR YOU EATING\nMY\nCOO\nKIEEEEEEEEEeeee\nEEEEEEEEEEEEES\n";
}

Id say C# is simpler.
But why would you want to out put:

RAWR WHYR YOU EATING
MY
COO
KIEEEEEEEEEeeee
EEEEEEEEEEEEES


I am A M30Wr.
I always get the last word.

Offline

 

#35 2010-04-03 16:26:22

cds56
THE TOOOTH! THE TOOOOOOOOOOOOTH!!!!!
From: Canamadiana
Registered: 2009-11-07
Posts: 423

Re: Functions, and M3OW 0.1

why not?


http://www.catb.org/esr/faqs/glider.png

Offline

 

#36 2010-04-03 21:46:30

floppy_gunk
I Am Your Father.
From: Earth, The Milky Way (I think)
Registered: 2009-10-08
Posts: 186
Website

Re: Functions, and M3OW 0.1

Because I don't want anyone eating my cookies.

And although the C# program does look better, it's not cross platform.

By the way, here's the python version:

Code:

for i in range(j):
     print 'RAWR WHYR YOU EATING\nMY\nCOO\nKIEEEEEEEEEeeee\nEEEEEEEEEEEEES\n'

Those can also be put on the same line:

Code:

for i in range(j): print 'RAWR WHYR YOU EATING\nMY\nCOO\nKIEEEEEEEEEeeee\nEEEEEEEEEEEEES\n'

Or:

Code:

for i in range(j):
     print '''RAWR WHYR YOU EATING
     MY
     COO
     KIEEEEEEEEEeeee
     EEEEEEEEEEEEES'''

And here's the Logo version:

Code:

repeat j
[show [RAWR WHYR YOU EATING]
show "MY
show "COO
show "KIEEEEEEEEEeeee
show "EEEEEEEEEEEEES]

Big Bob bites black bugs, but black bugs bite Big Bob back.

Offline

 

#37 2010-04-04 08:31:00

markyparky56
Hi...
From: Scotland
Registered: 2009-10-08
Posts: 910
Website

Re: Functions, and M3OW 0.1

Is there any frameworks for C# that dont use .NET? because iv got 3 frameworks (That i know of) .NET, Microsoft,And a plug in one i have, XNA Framework (For making games) I'm not sure, I only think that the .NET is not crossplatform... XNA isn't, i know that, it only makes games for windows... Microsoft, idk...


I am A M30Wr.
I always get the last word.

Offline

 

#38 2010-04-04 17:58:57

cds56
THE TOOOTH! THE TOOOOOOOOOOOOTH!!!!!
From: Canamadiana
Registered: 2009-11-07
Posts: 423

Re: Functions, and M3OW 0.1

markyparky56 wrote:

Is there any frameworks for C# that dont use .NET? because iv got 3 frameworks (That i know of) .NET, Microsoft,And a plug in one i have, XNA Framework (For making games) I'm not sure, I only think that the .NET is not crossplatform... XNA isn't, i know that, it only makes games for windows... Microsoft, idk...

maybe... Isn't there that cross-platform IDE for C#? What Framework does it use?
(I forget what's the name of the ide)


http://www.catb.org/esr/faqs/glider.png

Offline

 

#39 2010-04-04 18:37:15

Gershmer
Admin
From: Newton Centre, Massachusetts
Registered: 2009-10-08
Posts: 515
Website

Re: Functions, and M3OW 0.1

cds56 wrote:

markyparky56 wrote:

Is there any frameworks for C# that dont use .NET? because iv got 3 frameworks (That i know of) .NET, Microsoft,And a plug in one i have, XNA Framework (For making games) I'm not sure, I only think that the .NET is not crossplatform... XNA isn't, i know that, it only makes games for windows... Microsoft, idk...

maybe... Isn't there that cross-platform IDE for C#? What Framework does it use?
(I forget what's the name of the ide)

Idk. But there is Mono and SharpDevelop. (maybe what you are looking for)


http://card.ly/images/vcard-green-small.png

Offline

 

#40 2010-04-04 19:07:51

cds56
THE TOOOTH! THE TOOOOOOOOOOOOTH!!!!!
From: Canamadiana
Registered: 2009-11-07
Posts: 423

Re: Functions, and M3OW 0.1

Mono, that's the one ive heard of..


http://www.catb.org/esr/faqs/glider.png

Offline

 

#41 2010-04-05 17:36:16

markyparky56
Hi...
From: Scotland
Registered: 2009-10-08
Posts: 910
Website

Re: Functions, and M3OW 0.1

Sharpdevelop is an opensource version of Visual Studio using the .NET framework.


I am A M30Wr.
I always get the last word.

Offline

 

#42 2010-04-05 17:36:57

markyparky56
Hi...
From: Scotland
Registered: 2009-10-08
Posts: 910
Website

Re: Functions, and M3OW 0.1


I am A M30Wr.
I always get the last word.

Offline

 

#43 2010-04-05 20:40:50

cds56
THE TOOOTH! THE TOOOOOOOOOOOOTH!!!!!
From: Canamadiana
Registered: 2009-11-07
Posts: 423

Re: Functions, and M3OW 0.1

:D there ya go.


http://www.catb.org/esr/faqs/glider.png

Offline

 

#44 2010-04-06 08:23:26

markyparky56
Hi...
From: Scotland
Registered: 2009-10-08
Posts: 910
Website

Re: Functions, and M3OW 0.1

Its amazing what C# can do...


I am A M30Wr.
I always get the last word.

Offline

 

Adverts

Board footer

Powered by FluxBB
Hosted by PunBB-Hosting