alice-teacher Alice 3 Comparing colors of an object

Don Slater dslater+ at andrew.cmu.edu
Sat Apr 9 21:47:26 EDT 2016


The ability to compare colors is not implemented  in the version of Alice that is currently available to download.

In the meantime, try this:

1) Create a TextString variable property for the Disc class, name it "color", and set its initial value to "white".

2) There is a procedural method in the Scene class called "PerformCustomSetup". Edit this method and set the values of each of the color variables for each Disc to the appropriate color.

3) Youo can now write if statements to compare the variable TextString values.

4) If you are changing the colors of the disc, be sure to also change th`e text value of the variable appropriately.

Let us know if you have any other questions...

All the best,
Don Slater

Sent from my iPad

> On Apr 8, 2016, at 12:30 PM, Steven Jang via alice-teachers <alice-teachers at lists.andrew.cmu.edu> wrote:
> 
> I found a post by S. Rodger with the question of comparing if two objects have the same colors.,
> 
> My students have a similar problem for a class project and I found your post of 11/25/2013. 
> 
> Our project randomly flips 4x4 discs. When you get four disc in a row with the same colors, you win. We can't find a way to use an if statement to do this.
> 
> Did the Alice 3 team find a solution  to compare if the colors of two objects are the same? I could not after searching the web.
> 
> PACIFIC ACADEMY
> T H E  O P P O R T U N I T Y  T O  B E  M E
> A Private Preparatory School for Grades 7 through 12
> 
> S T E V E  J A N G
> PACIFIC ACADEMY | Computer Science/Math instructor
> Email:  SJang at pacificacademy.org
> Websites: pacificacademy.org
> 
> Irvine Campus
> 4947 Alton Parkway, Irvine, CA 92604
> Phone: (949) 398-5288, Fax: (949) 398-5289
> 
> San Diego Campus
> 679 Encinitas Blvd,  #205, Encinitas, CA 92024
> Phone: (760) 634-1188, Fax: (760) 436-5718
> _______________________________________________
> alice-teachers mailing list
> alice-teachers at lists.andrew.cmu.edu
> 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/20160409/be2e4348/attachment.html>


More information about the alice-teachers mailing list