alice-teacher A number list is being filled with booleans

Vanderhyde, James vanderhyde at sxu.edu
Tue Jan 25 17:16:01 EST 2022


It seems to be the int function that is causing the problem. This bug is easy to reproduce (see attached screenshot). If you use floor instead of int, the result is a number, as expected. So I recommend you tell the student to use floor instead of int.

The values from int are correct, if you assume false==0 and true==1. There must be a bug in Alice that is converting the output of the int function into a Boolean for those two cases.

James
—
James Vanderhyde
Associate Professor
Computer Science
Saint Xavier University
3700 W. 103rd St.
Chicago, IL 60655
773-298-3454
[cid:506183F9-6977-4579-A472-EECD359F8F7A]
On Jan 25, 2022, at 1:04 PM, Donald Slater via alice-teachers <alice-teachers at lists.andrew.cmu.edu<mailto:alice-teachers at lists.andrew.cmu.edu>> wrote:

Carlos,
I am not sure where those boolean values are coming from. Perhaps run a loop before actually beginning the work in which all elements in the lists are initialized to 0 to start. (In there words do not rely on whatever initialization Alice does when you set up the list.)

Then as you are watching the variables, slow things down by putting a wait statement after each statement that updates the list so that you can see exactly what is going on.

Please keep us posted and let us know if you have any questions.

All the best,
Don Slater

Alice Project


On Jan 25, 2022, at 11:33 AM, Carlos Bovell via alice-teachers <alice-teachers at lists.andrew.cmu.edu<mailto:alice-teachers at lists.andrew.cmu.edu>> wrote:

Hi,

We have a project where I'm asking the students to make change and output how many 20s, how many 10s, etc will be needed to make the change. A student is trying to fill a number list with the quotients and getting some weird results that gets in the way of his being able to use the quotients elsewhere in his project. This is what we see when we "watch the variables" (see below). Note that two of the elements in the list appear as booleans. Could that be what is causing elsewhere later on when he tries to use these values as numbers?

Thanks for taking my question.

Carlos Bovell
Northern Burlington High School

<image.png>
_______________________________________________
alice-teachers mailing list
alice-teachers at lists.andrew.cmu.edu<mailto:alice-teachers at lists.andrew.cmu.edu>
To change settings or unsubscribe visit:
https://lists.andrew.cmu.edu/mailman/listinfo/alice-teachers<https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.andrew.cmu.edu%2Fmailman%2Flistinfo%2Falice-teachers&data=04%7C01%7Cvanderhyde%40sxu.edu%7C338b2e699c0e4e6fc80508d9e035b98b%7Cfe272ab3cfce455f9427088b59a13be5%7C0%7C0%7C637787343631685138%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=C4%2B%2Fi%2FK8l8p4b27ZFt9LT81rKI3edji%2B7f3t2s%2BDXXg%3D&reserved=0>

_______________________________________________
alice-teachers mailing list
alice-teachers at lists.andrew.cmu.edu<mailto:alice-teachers at lists.andrew.cmu.edu>
To change settings or unsubscribe visit:
https://lists.andrew.cmu.edu/mailman/listinfo/alice-teachers

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.andrew.cmu.edu/pipermail/alice-teachers/attachments/20220125/f0f273cf/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screen Shot 2022-01-25 at 4.12.24 PM.png
Type: image/png
Size: 164809 bytes
Desc: Screen Shot 2022-01-25 at 4.12.24 PM.png
URL: <http://lists.andrew.cmu.edu/pipermail/alice-teachers/attachments/20220125/f0f273cf/attachment-0001.png>


More information about the alice-teachers mailing list