Reverse 'pixelcoloring' and total amount of colors

William de Smet williamdesmet at gmail.com
Mon Mar 5 08:55:39 CET 2018


Hi there,

This is quite a challenge for me.
I an trying to build a template in which users (small children) can
'pixeldraw' something and based on the drawing the instruction will be made.
The instruction is needed for other children to make the pixel drawing.
The instruction is quite special.

The template is a square with 49 buttons (7x7) for the coloring and 49
fields for the instruction.
The coloring of the buttons is no problem. The 'reverse' coloring is the
problem.
I can get the amount of a colors in a row (5 x white and 2 x blue) but how
do I determine on which place (in which buttons) these colors are.
The first row is: 3 white - 1 blue - 2 white - 1 blue
But how do I output it like: 3 - 1- 2 - 1 ? And each number needs to be in
another field.

---------------
on mouseup
if the backgroundcolor of btn "f1" is 255,255,255 then add "1" to field "v1"
end mouseup

or

on mouseup
repeat with x=1 to 7
put "f"&x into tButton
if the backgroundcolor of btn tButton is 255,255,255
then
add "1" to field "v1"
else
add "1" to field "v2"
end if
end mousep

-------------------

What is the best way to do this?

Any pointers are welcome.


To easier understand what i am trying to do, see this image:
http://www.camelcaps.nl/pixelcoding/pixelcoding.jpg



greetings,

William


More information about the use-livecode mailing list