Chameleon challenges are a bad thing, apparently. Too bad, chameleons are beautiful creatures. Time for a change!
As we all know, many chameleons posses a remarkable ability to blend in with their surroundings by changing the color of their skin. Which is also the objective of this challenge.
Challenge
Imagine a square of nine pixels. Eight pixels are the surroundings. At the center is the chameleon.
Like this:
The chameleon naturally tries to blend in with its surroundings. It does so by changing its color to the average of that of the surrounding pixels. So, in this case, the chameleon would change its color to .
Objective
Given the colors of the surrounding pixels, output the color of the chameleon.
The color of the chameleon is defined as the total of all red, green and blue in the pixels ÷ 8.
Input
An array of color values for the eight surrounding pixels, starting at the top left and continuing clockwise, like this:
[[<red>,<green>,<blue>],[<red>,<green>,<blue>],[<red>,<green>,<blue>],[<red>,<green>,<blue>],[<red>,<green>,<blue>],[<red>,<green>,<blue>],[<red>,<green>,<blue>],[<red>,<green>,<blue>]]
You may choose to receive input in a different form, as long as it consists of eight triples of decimal numbers 0-255.
If you receive input in a different form, numbers must either be of a consistent length or have a non-numeric separator between them. Triples must have a separating character unless they are 0-padded to 9 digits. (E.g. 044200255044200255044200255044200255044200255044200255044200255044200255
is valid, so are 44 200 255 44 200 255 44 200 255 44 200 255 44 200 255 44 200 255 44 200 255 44 200 255
and 44?200?255$44?200?255$44?200?255$44?200?255$44?200?255$44?200?255$44?200?255$44?200?255
, but 4420025544200255442002554420025544200255442002554420025544200255
is not.)
Output
An array / string / etc. containing the colors of the center pixel (in decimal), like this:
[<red>,<green>,<blue>]
In case you output something other than an array: Numbers must either be of a consistent length or have a non-numeric separator between them. (E.g. 044200255
is valid, so is 44 200 255
, but 44200255
is not.)
The numbers may not contain decimal points, so e.g. 44.0 200 255.0
is invalid.
Rounding
Output must be rounded to the nearest integer. (Halves must be rounded up.) E.g., if the sum of all red is 1620, you must output 203
, not 202
or 202.5
.
Examples
Pictures are for illustration only. The middle pixel is the output, the surrounding pixels are the input.
Input:
[[200,200,200],[200,200,200],[200,200,200],[200,200,200],[200,200,200],[200,200,200],[200,200,200],[200,200,200]]
Output:
[200,200,200]
Input:
[[0,0,0],[255,255,255],[0,0,0],[255,255,255],[255,255,255],[0,0,0],[255,255,255],[0,0,0]]
Output:
[128,128,128]
Input:
[[0,200,200],[200,0,200],[200,200,0],[60,200,0],[200,0,200],[0,200,220],[2,200,0],[0,0,0]]
Output:
[83,125,103]
Input:
[[0,56,58],[65,0,200],[33,200,0],[60,33,0],[98,0,200],[0,28,220],[2,200,0],[99,0,5]]
Output:
[45,65,85]
Submissions can be a full program or a function. Standard I/O and loophole rules apply.