View Full Version : Nifty way of using Alice for visualizing array algorithms

10-18-2009, 12:35 AM
I use Alice 3.0 for lab assignments in my CS1 class, and students love it. Carol the robot is a big hit when she escapes a maze (hear the applause at http://helsinki.cs.sjsu.edu:8080/videos/play.html?video=cs46a-2009-09-29 around 44:15) or drops beepers in a spiral pattern. Why Carol? I am trying out Leland Beck's cooperative learning labs, which use Karel, but since I am already using Alice, I don't want students to learn another environment. So I made an Alice class that acts like Karel. The 3D looks sooo much better--I know it is silly and only visual fluff, but it really makes a difference for the students.

Now I came up with this nifty way of doing array algorithm visualizations. I simply subclass ArrayList<E> to VisualArrayList<E extends Model>, and override add/remove to visually shift the elements. So, you can really feel in your gut that remove(0) is pretty slow because you have to wait for the darned cars to move s l o w l y to the left. See http://horstmann.com/sjsu/cs46a/lab8/index.html and go to part D.

My point is that it is really easy for a moderately skilled coder to twist Alice 3 into animating things that I would have never considered doing in the drag-and-drop world of Alice 2. Alice 2 is a great tool, but Alice 3 is a great toolkit!