I am developing a test which will give a result of 2 values
$result = array( 't' => 10, 's' => 20 );
and i have ranges that will give a response as badge name from array to that result:
$badges = array(
'badge1' => array(
array('tLow' => 0, 'tHigh' => 20),
array('sLow' => 0, 'sHigh' => 10)
),
'badge2' => array(
array('tLow' => 0, 'tHigh' => 10),
array('sLow' => 11, 'sHigh' => 20)
),
'badge3' => array(
array('tLow' => 21, 'tHigh' => 30),
array('sLow' => 0, 'sHigh' => 10)
),
'badge4' => array(
array('tLow' => 31, 'tHigh' => 40),
array('sLow' => 0, 'sHigh' => 10)
),
'badge5' => array(
array('tLow' => 11, 'tHigh' => 30),
array('sLow' => 11, 'sHigh' => 30)
),
'badge6' => array(
array('tLow' => 0, 'tHigh' => 10),
array('sLow' => 21, 'sHigh' => 30)
),
'badge7' => array(
array('tLow' => 0, 'tHigh' => 10),
array('sLow' => 31, 'sHigh' => 40)
),
);
badge arrays correspond to a grid which looks like this
+---+
| 7 |
+---+---+---+
| 6 | |
+---+ 5 +
| 2 | |
+---+---+---+---+
| 1 | 3 | 4 |
+---+---+---+---+
so my question is what is the most effective way to get a badge for my result? maybe there is a better approach to this?
language-agnostictag for that kind of question, but you should probably use pseudo code if the question is truly language agnostic, as not everyone can read php/perl/whatever.