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

#1 2012-06-18 11:16:09

Molybdenum
Scratcher
Registered: 2012-06-17
Posts: 1000+

MIght as well post this... (Ackermann function)

http://scratch.mit.edu/projects/Molybdenum/2617436
The wikipedia link on the Ackermann function is useful: http://en.wikipedia.org/wiki/Ackermann_function
This program calculates Ackermann(m,n) for given m and n. It doesn't use any optimizations (like Ack(1,n)=n+2), so the script is very simple. It works by exploiting this property:
Any Ackermann function calculation only will be like this (intermediately):
Ack(A,Ack(B, ... Ack(Y,Z) ) ... ) )
[Sorry, double parenthesis are changed due to scratchblocks or something.]
So the last number (Z in the example) is kept seperate, and all the others, because they are all in the first argument, are kept in a list.
Then, the bottom evaluation (Ack(Y,Z) in the example) is calculated with (item last of M) and N (the varible). When that is done, M is deleted and the result is put in N (in result 1 in wikipedia definition), M and N are modified (result 2), or an M is added, while the old bottom M and N are modified. (You didn't need to understand that sentence).
Say the result was ☺. ☺ will be put in place of Ack(Y,Z), and the resulting "end" will be Ack(X,☺). Then the cycle starts all over.

I have found that the stack is a good way to visualize the Ackermann function.

Comments?


"The Enrichment Center is required to remind you that you will be baked, and then there will be cake."
(|Balls and Platforms: Stay on!|) (|NaOS-H: An operating system... Or is it?|)

Offline

 

#2 2012-06-19 12:14:00

Molybdenum
Scratcher
Registered: 2012-06-17
Posts: 1000+

Re: MIght as well post this... (Ackermann function)

Bump...
1. Why isn't anyone posting?
2. This is a good way to visualize the Ackermann function.
4. You didn't notice I skipped 3.
5. Why doesn't anyone post on my threads (as much as the others)?


"The Enrichment Center is required to remind you that you will be baked, and then there will be cake."
(|Balls and Platforms: Stay on!|) (|NaOS-H: An operating system... Or is it?|)

Offline

 

#3 2012-06-21 19:35:34

gamer2012
Scratcher
Registered: 2011-04-17
Posts: 100+

Re: MIght as well post this... (Ackermann function)

This is pretty interesting!


Coming soon: Nothing much 'till Scratch 2.0. Oh, here's one of my classics!  tongue  Square Quest: (You BETTER click here!!! XD)

Offline

 

#4 2012-06-22 23:45:22

Smozzick
Scratcher
Registered: 2011-10-23
Posts: 100+

Re: MIght as well post this... (Ackermann function)

I think the answer to 5 can be summed up in two words: Target Audience.

lol.

I'll have a look though, sounds interesting.


http://i50.tinypic.com/ded8m.png

Offline

 

#5 2012-06-23 17:47:36

Molybdenum
Scratcher
Registered: 2012-06-17
Posts: 1000+

Re: MIght as well post this... (Ackermann function)

Hmm... I didn't see these posts. Thanks for repling anyway!


"The Enrichment Center is required to remind you that you will be baked, and then there will be cake."
(|Balls and Platforms: Stay on!|) (|NaOS-H: An operating system... Or is it?|)

Offline

 

#6 2012-06-23 20:01:08

trinary
Scratcher
Registered: 2012-01-29
Posts: 1000+

Re: MIght as well post this... (Ackermann function)

It looks rather interesting.


http://trinary.tk/images/signature_.php

Offline

 

#7 2012-06-25 14:59:50

racypy
Scratcher
Registered: 2012-03-17
Posts: 28

Re: MIght as well post this... (Ackermann function)

This is a great program. I don't really understand this function, but I will certainly read up on it now. I am fascinated by recursion ...

Offline

 

#8 2012-06-25 15:12:43

Molybdenum
Scratcher
Registered: 2012-06-17
Posts: 1000+

Re: MIght as well post this... (Ackermann function)

Yes, recursion is interesting, but we have to wait for scratch 2.0 to do it in scratch  sad


"The Enrichment Center is required to remind you that you will be baked, and then there will be cake."
(|Balls and Platforms: Stay on!|) (|NaOS-H: An operating system... Or is it?|)

Offline

 

Board footer