PDA

View Full Version : Having a hard time "reading" Alice code.


ringoffluff
10-07-2014, 10:52 AM
Hello! I'm a computer science student with previous experience working in IT doing basic programming. I'm taking a prerequisite class that utilizes Alice, and so far I've had perfect grades on all my projects, quizzes, etc. Overall I'm enjoying the program and like the very visual learning style. I have a pretty good grasp of what I'm doing - when I'm the one writing the code.

My problem is that now in my quizzes (and upcoming midterm!), we're being asked questions based on blocks of code. For example, we'll be given a screen cap of code and asked the result of running it when certain conditions are applicable. I am having an awful time answering these questions, and I'm really not sure why. It doesn't make sense that I can put together the projects when asked, but I can't read them back when someone else has made them.

Is there a particular way I should be "reading" these? Are there links anywhere to tutorials or something where someone breaks down how they read through Alice code? I've done quite a bit of searching on my own and haven't come up with anything. My class is online, and unfortunately the tutoring sessions are during my work hours and I'm trying hard to avoid having to take time off of work to go to the tutoring session.

I've attached two screen caps from a previous quiz. The possible answers for it are 3, 4, 6, or 10 meters.

Thanks in advance.

MrMoke
10-07-2014, 04:21 PM
The easiest way to solve a logic problem in programming is to build a list of the things that must be done to get the answer, and then build a flowchart to solve.
In this case, since the character isn't behind the Frisbee, he has to get to the appropriate starting point by moving an appropriate distance (Note: The problem doesn't appear to take that into account), turning to face the chair(Also not mentioned in code), and loop (Distance to Ball) times moving forward until the Frisbee gets to the chair.

Bottom Line: The code will move the Frisbee, but the Guy won't even be close it, so don't worry about those distractions.

Can you then use the remaining distances to form a solution? Try writing the modified values on a piece of paper to see the interaction.

One of the most exciting challenges in programming is to solve a problem for client. :-)

ringoffluff
10-08-2014, 11:15 AM
Thanks! It is definitely helping me to rewrite the problem on another sheet of paper and figure it out from there. I still feel like I'm missing something, so my instructor is giving me a call this evening to go over it some more. I'll post if I make any good progress, in case anyone else is struggling.

MrMoke
10-08-2014, 03:12 PM
He will probably ask you something like:

How many times is the If() statement executed?

ringoffluff
10-15-2014, 11:42 AM
Just wanted to update -- I have a much better understanding and what helped me was looking at the chunk of code in question as a word problem. That's it. Just made a math problem out of what I was reading, and it helped me organize the information MUCH better.

I took my current chapter's practice quiz yesterday and did very well, so I'm really pleased and feel a lot more confident. Maybe that can help someone else who is just starting out and getting stuck.

hmerrillb
11-23-2014, 10:15 AM
looking forward for this topic..:confused: