This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#26 2012-12-02 10:37:52

nXIII
Community Moderator
Registered: 2009-04-21
Posts: 1000+

Re: EasyAsPy

Gravitation wrote:

Also, I don't think that the cue is necessary; we'll see later.

I think you mean queue.

cue — a thing said or done that serves as a signal to an actor or other performer to enter or to begin their speech or performance.
queue (2) — [Computing] a list of data items, commands, etc., stored so as to be retrievable in a definite order, usually the order of insertion.

(both from the OAD)


nXIII

Offline

 

#27 2012-12-02 10:52:36

Gravitation
New Scratcher
Registered: 2012-09-26
Posts: 500+

Re: EasyAsPy

nXIII wrote:

Gravitation wrote:

Also, I don't think that the cue is necessary; we'll see later.

I think you mean queue.

cue — a thing said or done that serves as a signal to an actor or other performer to enter or to begin their speech or performance.
queue (2) — [Computing] a list of data items, commands, etc., stored so as to be retrievable in a definite order, usually the order of insertion.

(both from the OAD)

*facepalm*

tongue

Thanks, but yeah, it'll probably be removed anyway.  tongue

Offline

 

#28 2012-12-02 10:55:39

Gravitation
New Scratcher
Registered: 2012-09-26
Posts: 500+

Re: EasyAsPy

technoboy10 wrote:

Gravitation wrote:

technoboy10 wrote:

Here's a list of names I've come up with:
CherryPy
ICanHazPy
EasyAsPy

(800th post!)

EasyAsPy really rings a bell... it'll be easy to remember and is descriptive of our program. Let's go for that one.  smile

Cool.
Yeah, the actual pies seemed a little seasonal.

tongue

Have you done any blocks yet? I want to test my simulator.

Offline

 

#29 2012-12-02 11:04:27

technoboy10
Scratcher
Registered: 2007-08-25
Posts: 1000+

Re: EasyAsPy

Gravitation wrote:

technoboy10 wrote:

Gravitation wrote:


EasyAsPy really rings a bell... it'll be easy to remember and is descriptive of our program. Let's go for that one.  smile

Cool.
Yeah, the actual pies seemed a little seasonal.

tongue

Have you done any blocks yet? I want to test my simulator.

I've done a couple, I'll try and post the updates later.


So long, 1.4.
http://goo.gl/3JEV9

Offline

 

#30 2012-12-02 11:06:14

Gravitation
New Scratcher
Registered: 2012-09-26
Posts: 500+

Re: EasyAsPy

technoboy10 wrote:

Gravitation wrote:

technoboy10 wrote:

Cool.
Yeah, the actual pies seemed a little seasonal.

tongue

Have you done any blocks yet? I want to test my simulator.

I've done a couple, I'll try and post the updates later.

Yay  big_smile

I haven't done any, I feel so guilty ;_;

Offline

 

#31 2012-12-02 11:09:39

technoboy10
Scratcher
Registered: 2007-08-25
Posts: 1000+

Re: EasyAsPy

Done. The first post has the code that I have so far. You'll have to download scratch.py first, though. (http://wiki.scratch.mit.edu/wiki/Python)


So long, 1.4.
http://goo.gl/3JEV9

Offline

 

#32 2012-12-02 11:43:06

Gravitation
New Scratcher
Registered: 2012-09-26
Posts: 500+

Re: EasyAsPy

I'm getting a weird error when running this...

Code:

Sprites = []
Scripts = []
Blocks = []
class Sprite():
    global Sprites, Scripts
    def __init__():
        self.x = 0
        self.y = 0
        self.dir = 90
        self.hidden = False
        self.myScripts = []
        self.name = "Sprite1"
class Script():
    global Sprites, Scripts, Blocks
    def __init__(self):    
        global Sprites
        self.id = 0
        self.myBlocks = []
        self.pos = 0
        self.owner = 0
        k = 0
        for i in Sprites:
            for j in i.myScripts:
                if j.id == self.id:
                    self.owner = k
            k += 1
class Block():
    global Scripts, Blocks
    def __init__(self):
        global Scripts
        self.id = 0
        self.block = 0
        self.inputs = []
        self.complete = False
        self.running = False
        k = 0
        for i in Scripts:
            for j in i.myBlocks:
                if j.id == self.id:
                    self.owner = k
            k += 1
    def check(self):
        global Scripts
        if self.running == False:
            Scripts[self.owner].pos += 1
            if (Scripts[self.owner].pos + 1) > len(Scripts[self.owner].myBlocks):
                Scripts[self.owner].pos = -1
    def run(self):
        global Sprites, answer
        for i in range(len(self.inputs)):
            if type(self.inputs[i]) == type(Sprites[0]):
                self.inputs[i] = self.inputs[i].run()
        if self.block == 0: #say
            string = str(self.inputs[0])
            print(string)
        if self.block == 1: #ask
            string = str(self.inputs[0])
            answer = raw_input(string)
        from math import sqrt
        if self.block == 2: #join
            a = str(self.inputs[0])
            b = str(self.inputs[1])
            return a + b
        if self.block == 3: #mod
            return self.inputs[0] % self.inputs[1]
        if self.block == 4: #letter of
            string = str(self.inputs[1])
            num = (self.inputs[0] - 1) % len(string)
            return string[num]
        if self.block == 5: #length of
            string = str(self.inputs[0])
            return len(string)

Still doesn't work (I'm working on it) but I ran it just to check it's syntax. Now I get an unexpected indentation error.

Offline

 

#33 2012-12-02 11:46:13

technoboy10
Scratcher
Registered: 2007-08-25
Posts: 1000+

Re: EasyAsPy

Gravitation wrote:

I'm getting a weird error when running this...

Code:

Sprites = []
Scripts = []
Blocks = []
class Sprite():
    global Sprites, Scripts
    def __init__():
        self.x = 0
        self.y = 0
        self.dir = 90
        self.hidden = False
        self.myScripts = []
        self.name = "Sprite1"
class Script():
    global Sprites, Scripts, Blocks
    def __init__(self):    
        global Sprites
        self.id = 0
        self.myBlocks = []
        self.pos = 0
        self.owner = 0
        k = 0
        for i in Sprites:
            for j in i.myScripts:
                if j.id == self.id:
                    self.owner = k
            k += 1
class Block():
    global Scripts, Blocks
    def __init__(self):
        global Scripts
        self.id = 0
        self.block = 0
        self.inputs = []
        self.complete = False
        self.running = False
        k = 0
        for i in Scripts:
            for j in i.myBlocks:
                if j.id == self.id:
                    self.owner = k
            k += 1
    def check(self):
        global Scripts
        if self.running == False:
            Scripts[self.owner].pos += 1
            if (Scripts[self.owner].pos + 1) > len(Scripts[self.owner].myBlocks):
                Scripts[self.owner].pos = -1
    def run(self):
        global Sprites, answer
        for i in range(len(self.inputs)):
            if type(self.inputs[i]) == type(Sprites[0]):
                self.inputs[i] = self.inputs[i].run()
        if self.block == 0: #say
            string = str(self.inputs[0])
            print(string)
        if self.block == 1: #ask
            string = str(self.inputs[0])
            answer = raw_input(string)
        from math import sqrt
        if self.block == 2: #join
            a = str(self.inputs[0])
            b = str(self.inputs[1])
            return a + b
        if self.block == 3: #mod
            return self.inputs[0] % self.inputs[1]
        if self.block == 4: #letter of
            string = str(self.inputs[1])
            num = (self.inputs[0] - 1) % len(string)
            return string[num]
        if self.block == 5: #length of
            string = str(self.inputs[0])
            return len(string)

Still doesn't work (I'm working on it) but I ran it just to check it's syntax. Now I get an unexpected indentation error.

Hmm... I'll take a look when I get to a normal computer.


So long, 1.4.
http://goo.gl/3JEV9

Offline

 

#34 2012-12-05 19:54:26

technoboy10
Scratcher
Registered: 2007-08-25
Posts: 1000+

Re: EasyAsPy

Odd, I ran it just fine on my computer (as a module).  hmm


So long, 1.4.
http://goo.gl/3JEV9

Offline

 

#35 2012-12-06 02:03:24

Gravitation
New Scratcher
Registered: 2012-09-26
Posts: 500+

Re: EasyAsPy

technoboy10 wrote:

Odd, I ran it just fine on my computer (as a module).  hmm

hmm

It must have been a parser error. What version of Python are you running it in?

Offline

 

#36 2012-12-06 08:59:56

technoboy10
Scratcher
Registered: 2007-08-25
Posts: 1000+

Re: EasyAsPy

Gravitation wrote:

technoboy10 wrote:

Odd, I ran it just fine on my computer (as a module).  hmm

hmm

It must have been a parser error. What version of Python are you running it in?

Python 2.7.3.


So long, 1.4.
http://goo.gl/3JEV9

Offline

 

#37 2012-12-06 14:28:20

Gravitation
New Scratcher
Registered: 2012-09-26
Posts: 500+

Re: EasyAsPy

technoboy10 wrote:

Gravitation wrote:

technoboy10 wrote:

Odd, I ran it just fine on my computer (as a module).  hmm

hmm

It must have been a parser error. What version of Python are you running it in?

Python 2.7.3.

Ah, I'm running 3.3.0.

I'll try my 2.7 copy.  smile

Offline

 

#38 2012-12-06 14:38:34

technoboy10
Scratcher
Registered: 2007-08-25
Posts: 1000+

Re: EasyAsPy

Gravitation wrote:

technoboy10 wrote:

Gravitation wrote:


hmm

It must have been a parser error. What version of Python are you running it in?

Python 2.7.3.

Ah, I'm running 3.3.0.

I'll try my 2.7 copy.  smile

Yeah, Python 3 isn't my favorite, mainly because they got rid of raw_input().


So long, 1.4.
http://goo.gl/3JEV9

Offline

 

#39 2012-12-06 14:49:21

Gravitation
New Scratcher
Registered: 2012-09-26
Posts: 500+

Re: EasyAsPy

technoboy10 wrote:

Gravitation wrote:

technoboy10 wrote:


Python 2.7.3.

Ah, I'm running 3.3.0.

I'll try my 2.7 copy.  smile

Yeah, Python 3 isn't my favorite, mainly because they got rid of raw_input().

They did? :oooo

It's still throwing that error, though.  hmm

Anyway, I did like, 5 minutes of work on the code:

Code:

Sprites = []
Scripts = []
Blocks = []
class Sprite():
    global Sprites, Scripts
    def __init__(self):
        self.x = 0
        self.y = 0
        self.dir = 90
        self.hidden = False
        self.myScripts = []
        self.name = "Sprite1"
    def run(self):
        for i in self.myScripts:
            i.run()
class Script():
    global Sprites, Scripts, Blocks
    def __init__(self):    
        global Sprites
        self.id = 0
    self.loops = []
        self.myBlocks = []
        self.pos = 0
        self.owner = 0
        k = 0
        for i in Sprites:
            for j in i.myScripts:
                if j.id == self.id:
                    self.owner = k
            k += 1
    def run(self):
        if self.pos == -1:
            if self.loops[len(self.loops) - 1][2] == len(self.myBlocks):
                self.pos = self.loops[len(self.loops) - 1][1]
            else:
                if self.myBlocks[0].run() == True:
                    self.pos == 0
    if self.pos == 0 and self.myBlocks[0].run() == True:
        self.pos = 1
    self.myBlocks[pos].run()
class Block():
    global Scripts, Blocks
    def __init__(self):
        global Scripts
        self.id = 0
        self.block = 0
        self.inputs = []
        self.complete = False
        self.running = False
        k = 0
        for i in Scripts:
            for j in i.myBlocks:
                if j.id == self.id:
                    self.owner = k
            k += 1
    def check(self):
        global Scripts
        if self.running == False:
            Scripts[self.owner].pos += 1
            if (Scripts[self.owner].pos + 1) > len(Scripts[self.owner].myBlocks):
                Scripts[self.owner].pos = -1
    def run(self):
        global Sprites, answer
        for i in range(len(self.inputs)):
            if type(self.inputs[i]) == type(Sprites[0]):
                self.inputs[i] = self.inputs[i].run()
        if self.block == 0: #say
            string = str(self.inputs[0])
            print(string)
        if self.block == 1: #ask
            string = str(self.inputs[0])
            answer = raw_input(string)
        from math import sqrt
        if self.block == 2: #join
            a = str(self.inputs[0])
            b = str(self.inputs[1])
            return a + b
        if self.block == 3: #mod
            return self.inputs[0] % self.inputs[1]
        if self.block == 4: #letter of
            string = str(self.inputs[1])
            num = (self.inputs[0] - 1) % len(string)
            return string[num]
        if self.block == 5: #length of
            string = str(self.inputs[0])
            return len(string)

Can you check it, please?


Now we must finish the block definitions and set up Pygame! Our emulator then works; the conversion will be our next target.  smile

You knew that already, though. ;P

Offline

 

#40 2012-12-06 15:43:33

blob8108
Scratcher
Registered: 2007-06-25
Posts: 1000+

Re: EasyAsPy

Gravitation wrote:

technoboy10 wrote:

Yeah, Python 3 isn't my favorite, mainly because they got rid of raw_input().

They did? :oooo

It's been renamed input().


Things I've made: kurt | scratchblocks2 | this cake

Offline

 

#41 2012-12-06 15:53:14

mythbusteranimator
Scratcher
Registered: 2012-02-28
Posts: 1000+

Re: EasyAsPy

blob8108 wrote:

Gravitation wrote:

technoboy10 wrote:

Yeah, Python 3 isn't my favorite, mainly because they got rid of raw_input().

They did? :oooo

It's been renamed input().

HORRIBLE
tongue


http://www.foxtrot.com/comics/2012-04-01-fdb37077.gif
clicky

Offline

 

#42 2012-12-06 15:54:02

blob8108
Scratcher
Registered: 2007-06-25
Posts: 1000+

Re: EasyAsPy

mythbusteranimator wrote:

blob8108 wrote:

Gravitation wrote:


They did? :oooo

It's been renamed input().

HORRIBLE
tongue

Why?


Things I've made: kurt | scratchblocks2 | this cake

Offline

 

#43 2012-12-06 17:19:12

technoboy10
Scratcher
Registered: 2007-08-25
Posts: 1000+

Re: EasyAsPy

@Gravitation I'm getting errors with indentation in the Script class.


So long, 1.4.
http://goo.gl/3JEV9

Offline

 

#44 2012-12-07 02:34:26

Gravitation
New Scratcher
Registered: 2012-09-26
Posts: 500+

Re: EasyAsPy

technoboy10 wrote:

@Gravitation I'm getting errors with indentation in the Script class.

Oh, I see that; my editor has a major space-tab bug, so indentation is a problem.  hmm

Code:

Sprites = []
Scripts = []
Blocks = []
class Sprite():
    global Sprites, Scripts
    def __init__(self):
        self.x = 0
        self.y = 0
        self.dir = 90
        self.hidden = False
        self.myScripts = []
        self.name = "Sprite1"
    def run(self):
        for i in self.myScripts:
            i.run()
class Script():
    global Sprites, Scripts, Blocks
    def __init__(self):    
        global Sprites
        self.id = 0
        self.loops = []
        self.myBlocks = []
        self.pos = 0
        self.owner = 0
        k = 0
        for i in Sprites:
            for j in i.myScripts:
                if j.id == self.id:
                    self.owner = k
            k += 1
    def run(self):
        if self.pos == -1:
            if self.loops[len(self.loops) - 1][2] == len(self.myBlocks):
                self.pos = self.loops[len(self.loops) - 1][1]
            else:
                if self.myBlocks[0].run() == True:
                    self.pos == 0
        if self.pos == 0 and self.myBlocks[0].run() == True:
            self.pos = 1
        self.myBlocks[pos].run()
class Block():
    global Scripts, Blocks
    def __init__(self):
        global Scripts
        self.id = 0
        self.block = 0
        self.inputs = []
        self.complete = False
        self.running = False
        k = 0
        for i in Scripts:
            for j in i.myBlocks:
                if j.id == self.id:
                    self.owner = k
            k += 1
    def check(self):
        global Scripts
        if self.running == False:
            Scripts[self.owner].pos += 1
            if (Scripts[self.owner].pos + 1) > len(Scripts[self.owner].myBlocks):
                Scripts[self.owner].pos = -1
    def run(self):
        global Sprites, answer
        for i in range(len(self.inputs)):
            if type(self.inputs[i]) == type(Sprites[0]):
                self.inputs[i] = self.inputs[i].run()
        if self.block == 0: #say
            string = str(self.inputs[0])
            print(string)
        if self.block == 1: #ask
            string = str(self.inputs[0])
            answer = raw_input(string)
        from math import sqrt
        if self.block == 2: #join
            a = str(self.inputs[0])
            b = str(self.inputs[1])
            return a + b
        if self.block == 3: #mod
            return self.inputs[0] % self.inputs[1]
        if self.block == 4: #letter of
            string = str(self.inputs[1])
            num = (self.inputs[0] - 1) % len(string)
            return string[num]
        if self.block == 5: #length of
            string = str(self.inputs[0])
            return len(string)

That should work.

Offline

 

#45 2012-12-07 10:11:36

Magnie
Scratcher
Registered: 2007-12-12
Posts: 1000+

Offline

 

#46 2012-12-07 11:37:46

technoboy10
Scratcher
Registered: 2007-08-25
Posts: 1000+

Re: EasyAsPy

@raw_input() in Python 3 Whoops, my bad. I thought they completely got rid of it.  tongue


So long, 1.4.
http://goo.gl/3JEV9

Offline

 

#47 2012-12-08 10:29:04

technoboy10
Scratcher
Registered: 2007-08-25
Posts: 1000+

Re: EasyAsPy

@Gravitation What do you think about having a website for this project? I was thinking about reserving easyaspy.tk.
BTW, did you know we have a Scratch Wiki page?


So long, 1.4.
http://goo.gl/3JEV9

Offline

 

#48 2012-12-09 19:20:47

technoboy10
Scratcher
Registered: 2007-08-25
Posts: 1000+

Re: EasyAsPy

The website is now up (sort of)! It redirects to the Scratch site ATM. http://www.easyaspy.tk
EDIT: The site has some basic content on it now. I'll work on it some more in coming days.

Last edited by technoboy10 (2012-12-09 19:40:10)


So long, 1.4.
http://goo.gl/3JEV9

Offline

 

#49 2012-12-09 21:11:43

pwiter
Scratcher
Registered: 2010-06-02
Posts: 100+

Re: EasyAsPy

As a tip, you should use GitHub for this project.


http://i.imgur.com/YBeXc.png

Offline

 

#50 2012-12-10 03:23:36

Gravitation
New Scratcher
Registered: 2012-09-26
Posts: 500+

Re: EasyAsPy

technoboy10 wrote:

@Gravitation What do you think about having a website for this project? I was thinking about reserving easyaspy.tk.
BTW, did you know we have a Scratch Wiki page?

Good idea!
And no, I did not know that! :3

technoboy10 wrote:

The website is now up (sort of)! It redirects to the Scratch site ATM. http://www.easyaspy.tk
EDIT: The site has some basic content on it now. I'll work on it some more in coming days.

Yaaay! Thanks!

pwiter wrote:

As a tip, you should use GitHub for this project.

Okay, we'll try it out.  smile
@Magnie I know you mentioned that because of indentation; it's because Notepad++ replaces tabs with 4 spaces, and Notepad doesn't, and I mix them. Afterwards I forget to replace the tabs with 4 spaces, so I get indentation issues.  hmm  Thanks for posting that!

Offline

 

Board footer