Jump to content

Day 16: Advent Calendar


Kathis

Recommended Posts

Hello Jellybeans, Day 16 of puzzles. Todays lesson is about Colour~ and a bit of bitlogic.

 

We'll start with the colour.

 

Red, Green, Blue, Magenta, Cyan, Yellow, Black, and White. Have a what I like to call a pure hex value. 

 

Black #000000

Red #FF0000

Green #00FF00

Blue #0000FF

Yellow #FFFF00

Cyan #00FFFF

Magenta #FF00FF

White #FFFFFF

 

image.png

 

The first two values are Red values 0-255  (00-FF)

the second values are Green values 0-255 (00-FF)

and the last values are Blue values 0-255 (00-FF)

#RRGGBB

Now I know you have paint, and you can use the eye dropper. To get the decimal values.  and check it in the edit colour. 

 

----

Now bitlogic. 

 

Math in bit logic is a bit... weird.  

bitwise Or ( | ) is simple.  Take these two bytes for example. 

 

1000 1011

0111  0101

 

we compare the 1 and the 0, if there is a 1, then the final answer would have a 1 in that slot. 

 

So since every slot has a 1 at some point, it's 1111 1111 or FF

 

bitwise And (&) however is a bit more... picky. Like Or it will compare the 0 and the 1, but they both need to have a 1, otherwise it's a 0.

With our pervious bytes the answer would be 0000 0001  since only that slot had a 1 in both bytes.

 

bitwise Not (~) 

Just flips the bit.  0's become 1, and 1's become zero. For this puzzle you will not need to worry about it. But it is worth mentioning

 

-----

 

That's the crash course.

So let us begin. The easy exercise / puzzle.

 

image.png

(I made the | bolder since it was harder to see...)

 

Provide the answer in decimal with our respective letters.

 

 

Good luck everyone. 

Link to comment
Share on other sites

Blue (a) = 2B8BEC

Indigo (b) = 626AB5

Lime (c) = B9E730
 

Each hexadecimal number can be represented by 4 bits, from 0000 (0) to 1111 (F). 

So, each color would have 6 x 4 = 24 bits. 

Then, you can break it down and convert by dividing each number by 2 until the number is zero.

The remainder for each division is the binary bit starting from the "ones" place: 

2 = 0010 (2/2 = 1 R0, 1/2 = 0 R1)

B = 1011 (11/2 = 5 R1, 5/2 = 2 R1, 2/2 = 1 R0, 1/2 = 0 R1)

8 = 1000 (8 is just 2^3 so it's 1000, because 2, 4, 8, 16, and so on is a 1 followed by X 0s using X from 2X)

B = 1011 (B was done)

E = 1110 (minus 1 from F 1111)

C = 1100 (add 1 to B)

and combining them still gives the same number 001010111000101111101100 = 2B8BEC

 

Or you can just convert it somewhere. 

In fact, you could just do: ████████ & ████████ | ███████
 

Logically, the order would be (a & b) | c = 12mXXXkXX6 but the answer doesn't seem right?

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...