alice in summerland

learning and teaching math in alice

Friday, Friday

It’s Friday, Friday / Gotta get down on Friday / Everybody’s looking forward to the weekend, weekend—the wise words of Rebecca Black.

Well, it’s not the weekend yet, until I finish this blog post.

The kids are now standing on an array visualization to make the coding more efficient and concise.

So my goal for today was  to start a tutorial for my permutations/factorials program since the multiplication table one was getting a little tricky and I thought that could wait. After re-reading Professor Rodger’s comments in her email that suggested I use an array instead of manually moving people around in a line, I realized I really needed to redo the entire program. I put the 4 kids onto a visual array and put an object visualization behind them so that, when two kids switched places, one could stand on that object visualization so they don’t run into one another. In this case, the object visualization was just being used as a temporary object placeholder.

Figuring out how to make an algorithm to show all 24 permutations of 4 kids standing in a line.

After making my first tutorial about the inequalities, I realized that my codes really need to be perfect before I make the tutorials. I needed to make the 4! case of switching around 4 people in a line much more efficient, which would require some kind of algorithm. The picture is an outline of the basic algorithm, and the [brackets] indicate that these two objects will switch in the next line. This basically breaks the problem up 2-object and 3-object problems. You can see that the first 6 lines have A first, meaning that we are really just arranging 3 items: B, C, and D. You can also see that the first two lines also have B second, meaning that we are just arranging 2 items: C and D. This whole process works out fine until the last item in the third column where I need to change BACD to DACB since D hasn’t been first yet. This is the only time I have to switch two people who aren’t next to each other, and I had to specifically address this case in the code. This permutation thing would probably be perfect with recursion, but that might be to difficult to teach the kids so I stuck with nested loops that do the job.

After fixing up those problems and deleting some of the unnecessary methods (I had separate methods for the 2!, 3!, and 4! cases), my code is much shorter now and will (hopefully!) be easy to explain on a tutorial and shorter than 50 pages this time.

Advertisements

No comments yet»

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s

%d bloggers like this: