Pointless programming code.

Discussion in 'The Edge of the Forum' started by wchill, Apr 26, 2010.

  1. wchill
    OP

    wchill Resident chillxpert

    Member
    3
    Jun 12, 2008
    United States
    CODEint[] num = new int[9];
    int u = 0;
    int v = 0;
    int w = 0;
    int x = 0;
    int y = 0;
    int z = 0;
    int temp = 0;
    PrintWriter output;
    void setup() {
    ÂÂoutput = createWriter("answers.txt");
    ÂÂfor (int a = 0; a < 9; a++) {
    ÂÂÂÂnum[0] = a;
    ÂÂÂÂfor (int b = 0; b < 9; b++) {
    ÂÂÂÂÂÂnum[1] = b;
    ÂÂÂÂÂÂfor (int c = 0; c < 9; c++) {
    ÂÂÂÂÂÂÂÂnum[2] = c;
    ÂÂÂÂÂÂÂÂfor (int d = 0; d < 9; d++) {
    ÂÂÂÂÂÂÂÂÂÂnum[3] = d;
    ÂÂÂÂÂÂÂÂÂÂfor (int e = 0; e < 9; e++) {
    ÂÂÂÂÂÂÂÂÂÂÂÂnum[4] = e;
    ÂÂÂÂÂÂÂÂÂÂÂÂfor (int f = 0; f < 9; f++) {
    ÂÂÂÂÂÂÂÂÂÂÂÂÂÂnum[5] = f;
    ÂÂÂÂÂÂÂÂÂÂÂÂÂÂfor (int g = 0; g < 9; g++) {
    ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂnum[6] = g;
    ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂfor (int h = 0; h < 9; h++) {
    ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂnum[7] = h;
    ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂfor (int k = 0; k < 9; k++) {
    ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂnum[8] = k;
    ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂcheckTrue();
    ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ}
    ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ}
    ÂÂÂÂÂÂÂÂÂÂÂÂÂÂ}
    ÂÂÂÂÂÂÂÂÂÂÂÂ}
    ÂÂÂÂÂÂÂÂÂÂ}
    ÂÂÂÂÂÂÂÂ}
    ÂÂÂÂÂÂ}
    ÂÂÂÂ}
    ÂÂ}
    ÂÂoutput.flush();
    ÂÂoutput.close();
    }
    void checkTrue() {
    ÂÂu = num[0] * (10 * num[1] + num[2]);
    ÂÂv = 100 * num[3] + 10 * num[4] + num[5];
    ÂÂw = num[6] * (10 * num[7] + num[8]);
    ÂÂx = num[0] * (10 * num[4] + num[2]);
    ÂÂy = 100 * num[3] + 10 * num[1] + num[6];
    ÂÂz = num[5] * (10 * num[0] + num[8]);
    ÂÂfor (int i = 0; i < 9; i++) {
    ÂÂÂÂprint(num);
    ÂÂ}
    ÂÂprintln();
    ÂÂif (u == v && v == w && x == y && y == z) {
    ÂÂÂÂfor (int i = 0; i < 9; i++) {
    ÂÂÂÂÂÂtemp = temp + int((pow(10, 9-i) * num));
    ÂÂÂÂ}
    ÂÂÂÂoutput.println(temp);
    ÂÂÂÂtemp = 0;
    ÂÂ}
    }
    It's a Processing sketch. Running on my laptop checking 20000 possibilities a second.
    All because I wanted to solve a math problem but was too lazy to figure it out myself. Overkill much?
     
  2. BoxShot

    BoxShot Chiyo-chan :3

    Member
    2
    Dec 18, 2008
    United States
    Middle of the ocean.
    [​IMG] IT'S OVER 9000!

    Well yes its complete overkill.
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice