mardi 28 mars 2017

Calculate value based on amount of green against blue and red

A bit stuck on this one.

Here is my predicament:

A colour has 3 elements Red, Green and Blue (RGB).

All colours have a value from 0-255.

for example:

var red:int = 53; 
var green:int = 150;
var blue:int = 28;

My scoring system works that the greener the colour the higher score it will get out of 10.

so:

var red:int = 0; 
var green:int = 255;
var blue:int = 0;

Would receive the highest score(10) and:

var red:int = 255; 
var green:int = 0;
var blue:int = 255;

would receive the lowest score (0).

I need to produce an equation of some sort. Is Bayes' Theorum where I am meant to be?

really dont have a clue.

Aucun commentaire:

Enregistrer un commentaire