battle programmers alliance
Would you like to react to this message? Create an account in a few clicks or log in to continue.

battle programmers allianceLog in

battle programming a forum for elite programmers with extreme will power to sharpen their skills

descriptionupgraded pixel color recognition Emptyupgraded pixel color recognition

refer to the AEye class :


public char getPixelColorV2(int pixel) {
        //  r= red, g = green, b = blue
        int r =;
        int g =;
        int b =;
        //black or white
        if(bigTosmall(r+6,g,r-6)&&bigTosmall(r+6,b,r-6)){if(miner(100,r,g,b)==100){return 'w';}else if(maxer(100,r,g,b)==100){return 'k';}}
        if(maxer(65,r,g,b)==65){return 'k';}
        if(bigTosmall(g,r,b)||bigTosmall(g,b,r)){return 'g';}//green
        if(bigTosmall(b+6,g,b-6)&&(maxer(r,g,b)==r)){return 'r';}//red
        if(bigTosmall(g+6,r,g-6)&&bigTosmall(r+6,g,b)){return  'y';}//yellow
        if(bigTosmall(r,g,b)){return  'o';}//orange
        if(bigTosmall(b+6,g,b-6)&&(bigTosmall(b+6,g,r))){return 'a';}//azure
        if(bigTosmall(b,g,r)||bigTosmall(b,r,g)){return  'b';}//blue
        if(bigTosmall(b+6,r,b-6)&&bigTosmall(r+6,b,g+50)){return 'v';}//violet
        if(bigTosmall(r,b,g)){return 'p';}//pink
        return 'w';//white

tested and working


descriptionupgraded pixel color recognition EmptyRe: upgraded pixel color recognition

using varargs I can also check if a group of numbers are ranged from
big to small.
something has : if n1<n2<n3
in java you had to do : if (n1<n2)&&(n2<n3))
moreover with more numbers the work increases, so...
kuchiyouse no jutsu :


public static Boolean bigTosmall(int... a)
   for (int i = 0; i < a.length - 1; i++) {
      if (!(a[i] > a[i + 1])) {
            return false;
   return true;

miner returns array minimum
maxer returns int array maximum

top evil kek :coolpepe:
privacy_tip Permissions in this forum:
You cannot reply to topics in this forum
power_settings_newLogin to reply