Tuuba Time: 2025-09-16 04:07:23 | Local Time: 2025-09-16 01:07:23

You are not logged in.

#347 Re: Off Topic » Post your weeaboo shit » 2017-10-20 17:35:27

2017-10-20%2020.14.59.jpg

Finally got around to taking a picture of (nonlewd) japan haul

#348 Re: Off Topic » ITT: Pretend we are still writing in osu! OT » 2017-10-20 10:44:59

You sure get the weirdest ideas sometimes.

#349 Re: Off Topic » ITT: Pretend we are still writing in osu! OT » 2017-10-20 06:21:06

lk3m6o.png

It's really not sure if it should come yet or not.

#351 Re: Off Topic » ITT: Pretend we are still writing in osu! OT » 2017-10-17 16:58:48

The sandwiches I made just were pretty nice. Garlic is 5/5.

#353 Re: Off Topic » ITT: Pretend we are still writing in osu! OT » 2017-10-16 09:31:44

Moving blog:

2017-10-16%2012.26.20.jpg

definitely not going overboard with autism

#354 Re: Off Topic » ITT: Pretend we are still writing in osu! OT » 2017-10-15 09:59:06

The nearby store, you'll have to drink it yourself though.

#359 Re: Off Topic » ITT: Pretend we are still writing in osu! OT » 2017-10-11 13:13:49

public class ArrayColorConversion {


    /**
    * Method arrayMin
    * returns the smallest value in a given array
    * @param array  array to find minimum from
    * @return minimum value in array
    */
    public static int arrayMin(int[] array) {
        int temp = array[0]; // set value of first index in temp
        for (int n = 1;n < array.length;n++) {
            if (temp > array[n]) // compare current value against temp
                temp = array[n]; // if current value is smaller, save it in temp
        }
        return temp; // return temp that now has the smallest value
    }

    /**
    * Method arrayMax
    * returns the largest value in a given array
    * @param array  array to find maximum from
    * @return maximum value in array
    */
    public static int arrayMax(int[] array) {
        int temp = array[0];
        for (int n = 1;n < array.length;n++) {
            if (temp < array[n]) // the only difference to min is the flip of > to <
                temp = array[n];
        }
        return temp;

    }

    /**
    * Method RGBtoHSV
    * converts given RGB value to a HSV value
    * @param array  array to convert values from
    * @return array with values in HSV format
    */
    public static int[] RGBtoHSV(int[] array) {
        //initialize return array and temporary array
        int[] hsv = {0,0,0};
        double[] hsv_t = {0,0,0};

        // convert the 0-255 rgb values to 0-1
        double r = (double) array[0] / 255;
        double g = (double) array[1] / 255;
        double b = (double) array[2] / 255;

        // calculate max, min and delta
        double cmax = (double) arrayMax(array) / 255;
        double cmin = (double) arrayMin(array) / 255;
        double delta = cmax - cmin;

        if (cmax <= 0) { // if max is 0, then everything is 0 and HSV values are 0,0,0
            return hsv;
        }
        else { // if not, calculate hsv values
            if (r >= cmax)
                hsv_t[0] = (g - b) / delta;
            else if (g >= cmax)
                hsv_t[0] = ((b - r) / delta) + 2.0;
            else
                hsv_t[0] = ((r - g) / delta) + 4.0;

            hsv_t[0] *= 60;
            if (hsv_t[0] < 0)
                hsv_t[0] += 360;

            hsv_t[1] = (delta / cmax) * 100;
            hsv_t[2] = cmax * 100;
        }

        // dump the temp values into int array
        hsv[0] = (int) Math.round(hsv_t[0]);
        hsv[1] = (int) Math.round(hsv_t[1]);
        hsv[2] = (int) Math.round(hsv_t[2]);

        return hsv;
    }

    /**
    * Main program
    * @param args user input, not used
    */
    public static void main(String args[]) {

        int[] colour = { 255,0,128 }; //the prettiest of colours
        int[] colourHSV = RGBtoHSV(colour);
        System.out.print("H: " + colourHSV[0] + "\n");
        System.out.print("S: " + colourHSV[1] + "\n");
        System.out.print("V: " + colourHSV[2] + "\n");
    }
}

At least that one is somewhat interesting but it's still java psyduck

Bonus, maximum hacker IDE

#360 Re: Off Topic » ITT: Pretend we are still writing in osu! OT » 2017-10-11 11:15:02

public class ArrayMinMax {

    /**
    * Method arrayMin
    * returns the smallest value in a given array
    * @param array  array to find minimum from
    */
    public static int arrayMin(int[] array) {
        int temp = array[0]; // set value of first index in temp
        for (int n = 1;n < array.length;n++) {
            if (temp > array[n]) // compare current value against temp
                temp = array[n]; // if current value is smaller, save it in temp
        }
        return temp; // return temp that now has the smallest value
    }

    /**
    * Method arrayMax
    * returns the largest value in a given array
    * @param array  array to find maximum from
    */
    public static int arrayMax(int[] array) {
        int temp = array[0];
        for (int n = 1;n < array.length;n++) {
            if (temp < array[n]) // the only difference to min is the flip of > to <
                temp = array[n];
        }
        return temp;

    }

    /**
    * Main program
    * @param user input, not used
    */
    public static void main(String args[]) {

        int[] values = { 1, -5, 10, -15, 0, 7 };

        // prints out min and max with formatting
        System.out.printf("%-5s%2d\n%-5s%2d\n","Min:",arrayMin(values),"Max:",arrayMax(values));
    }
}

suicide

Board footer

Powered by Maki (r-e 139/git:b8267ee)

mascot