Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-4041-

Dubz Checker

Name: Anonymous 2012-01-29 15:38

Just made this for you, /prog/

It's on my Github as well!


#include <stdio.h>
#include <stdlib.h>
#define FOREVER for(;;)
#define MAXBASE 16
   
typedef struct house {
    struct house *prev;
    struct house *next;
    unsigned long int value;
    } house;

int BASE = 2;

void check(unsigned long int num) {

    house *first;
 
    first = (house*)malloc(sizeof(house));
    first->prev = NULL;
    first->next = NULL;
    first->value = num;
 
    house *current = first;

    house *aux = first;
 
    FOREVER {
    if(current->value < BASE) {
        goto U_MAD;
        }
    else {
        house *nexthouse;
        nexthouse = (house*)malloc(sizeof(house));
        nexthouse->prev = current;
        nexthouse->next = NULL;
        nexthouse->value = 0;
        current->next = nexthouse;

        while(current->value >= BASE) {
            current->value -= BASE;
            nexthouse->value += 1;
            }

        current = nexthouse;

        }
    }

    U_MAD:

    if(first->value == first->next->value) {

        while(aux->next != NULL) {
            aux = aux->next;
            }

        printf("Base %d : %X",BASE,aux->value);

        while(aux->prev != NULL) {
            aux = aux->prev;
            printf("%X",aux->value);
            }

        printf("\n");

        }

    while(aux->next != NULL) {
        aux = aux->next;
        }

    while(aux != first) {
        aux->prev->next = NULL;
        current = aux->prev;
        free(aux);
        aux = current;
        }
    free(first);
    }

int main(int argc,char **argv) {
    do {
        check(atoi(argv[1]));
        ++BASE;
        }while(BASE <= MAXBASE);
    return EXIT_SUCCESS;
    }

Name: Anonymous 2012-01-29 15:48

fail

Name: Anonymous 2012-01-29 15:50

It works, but...

Name: Anonymous 2012-01-29 15:51

>>1
#define FOREVER for(;;)
Stopped reading right there.

Name: Anonymous 2012-01-29 15:56

>>4
#define ever (;;)

Name: Anonymous 2012-01-29 15:58

This was very good! I'm gonna use it from now on! 1+

Name: Anonymous 2012-01-29 16:00

>>4

You should keep reading, there's a goto used on purpose

Name: Anonymous 2012-01-29 16:43

OMGOPTIMIZED!!

Fixed low entries and made entering data during program call optional (now you can insert the value inside it)

/****************************************
 * Doubles Checker                        *
 *                                         *
 * Checks for dubz in different bases    *
 *                                         *
 * Created by Felipe Cotti              *  
 ****************************************/
 
/* This program is free software. It comes without any warranty, to
 * the extent permitted by applicable law. You can redistribute it
 * and/or modify it under the terms of the Do What The Fuck You Want
 * To Public License, Version 2, as published by Sam Hocevar. See
 * http://sam.zoy.org/wtfpl/COPYING for more details. */
 
#include <stdio.h>
#include <stdlib.h>
#define FOREVER for(;;)
#define MAXBASE 16

typedef struct house {
    struct house *prev;
    struct house *next;
    unsigned long int value;
    } house;

int BASE = 2;

void check(unsigned long int num) {
   
    house *first;
 
    first = (house*)malloc(sizeof(house));
    first->prev = NULL;
    first->next = NULL;
    first->value = num;
 
    house *current = first;
   
    house *aux = first;
 
    FOREVER {
    if(current->value < BASE) {
        goto U_MAD;
    }
    else {
        house *nexthouse;
        nexthouse = (house*)malloc(sizeof(house));
        nexthouse->prev = current;
        nexthouse->next = NULL;
        nexthouse->value = 0;
        current->next = nexthouse;
       
        while(current->value >= BASE)    {
            current->value -= BASE;
            nexthouse->value += 1;
            }
       
        current = nexthouse;
   
        }
    }
   
    U_MAD:
   
    if(first->next == NULL) {
        free(first);
        return;
        }
    if(first->value == first->next->value) {
       
        while(aux->next != NULL) {
            aux = aux->next;
            }
       
        printf("Base %d : %X",BASE,aux->value);
       
        while(aux->prev != NULL) {
            aux = aux->prev;
            printf("%X",aux->value);
            }
       
        printf("\n");
       
        }
   
    while(aux->next != NULL) {
            aux = aux->next;
        }
       
    while(aux != first) {
        aux->prev->next = NULL;
        current = aux->prev;
        free(aux);
        aux = current;
        }
    free(first);
}

int main(int argc,char **argv) {
    if(argc == 1) {
        unsigned long int insert;
       
        printf("Insert a number: ");
        scanf("%d",&insert);
        do {
            check(insert);
            ++BASE;
            } while(BASE <= MAXBASE);
        } else {
        do {
            check(atoi(argv[1]));
            ++BASE;
            }while(BASE <= MAXBASE);       
        }
    return EXIT_SUCCESS;
}

Name: Anonymous 2012-01-29 17:11

int dubs(unsigned long long n, unsigned long long b) {
     return n%b==n/b%b;
}

Also IHBT

Name: Anonymous 2012-01-29 17:15

>>1,8
That was [b][i]GNU QUALITY[/i][/b]!
Now all you need is support for different locales and five pages of command-line options.

Name: Anonymous 2012-01-29 17:20

unsigned long int them = atoi("11");
check(them);

Name: Anonymous 2012-01-29 17:28

>>9

Why the heck didn't I think of that?

Anyway the crapcode is still useful to print in the number in other bases, so WHBT

Name: Anonymous 2012-01-29 17:41

>>7
I use gotos on purpose and they're quite useful when you forget the stigma.

Name: Anonymous 2012-01-29 17:51

>>13

I agree.

Name: Anonymous 2012-01-29 18:03

I don't use gotos because they are considered harmful, so I use jmp instead

-- your friendly next-door assembly programmer

Name: Anonymous 2012-01-29 18:06

>>15
I use j instead because unlike you I like to write in an elegant instruction set such as MIPS

-- your unfriendly next-door MIPS assembly programmer

Name: Anonymous 2012-01-29 18:53

>>16
I already told you to find me a MIPS or ARM netbook that can be fully driven by FOSS for under 300$, so better fuck off and stop talking about your toy architecture before you find one

-- your unfriendly next-door x86 assembly programmer

Name: Anonymous 2012-01-29 18:55

>>17
x86 is a Jew's hemorrhoid. Programming for it is like eating hemorrhoids that have been surgically removed from a Jew's anus.

Name: VIPPER 2012-01-29 18:56

#define j goto

Name: Anonymous 2012-01-29 18:57

>>17
http://www.aliexpress.com/product-gs/284840643-Yeeloong-Notebook-computer-8089D-white-Linux--wholesalers.html
http://www.lemote.com/en/products/Notebook/2010/0310/112.html
1) The world's first fully free software. All system source files(BIOS, kernel, drivers etc.) are free software, no close firmware needed.

Name: Anonymous 2012-01-29 18:59

>>18
Logic:

boycott x86 => buy non-x86 => buy something more expensive => give more money to the jews => get enslaved more quickly by the jews

Name: Anonymous 2012-01-29 19:01

>>21
boycott x86 => buy non-x86 => buy something more expensive => give more money to goyim => don't get enslaved by the jews
Intel is as Jewish as Rahm Emanuel.

Name: Anonymous 2012-01-29 19:17

>>20
http://www.osnews.com/story/21530/The_Loongson-2_MIPS_Lemote_Yeeloong_Netbook/page2/
The tiny three cell battery provides about an hour and a half battery life. The system does have a spinning hard drive, which is less energy efficient than the SSDs that used to be the promise of the "netbook" market.
That's pathetic.  My shitty Atom netbook (albeit with a 6-cell battery but still with a magnetic hard drive) goes for a good 7-8 hours when doing text editing and playing music.

Do you know why I stay away from your shit architectures? Because I write a lot of my stuff in assembly, and when I write for x86 I know that it will work for all x86's around the world. But, for instance, if I write for ARM, well, maybe it'll work on an ARM9 but not an ARM7 and so on.

Oh and for toy OS shit, at least on x86 I can use the BIOS text interface or maybe even code up a simple framebuffer driver for one of the not-that-many Intel or ATI cards. On ARM or MIPS I'd probably have to sign twenty-five NDAs and get an EE education before understanding all the specs for one specific configuration on one specific device. Fuck that shit.

Name: Anonymous 2012-01-29 19:21

Didn't I write this in 3 lines of ruby just the other day

Name: Anonymous 2012-01-29 19:23

>>23
and when I write for x86 I know that it will work for all x86's around the world
If you use AVX it works on an Atom? If you use CMOV it works on a Pentium? If you use 3DNow it works on Intel chips? All of the SSE extensions work on all x86's around the world?
BIOS text interface
So calling a closed-source binary blob of 20-year-old spaghetti code is okay if an x86 computer uses it, but if a MIPS uses PMON or an ARM uses OpenFirmware, you need the specs?

Name: Anonymous 2012-01-29 20:27

>>>7`
>not using goto
>taking anything Dijkstra has ever said seriously

Name: Anonymous 2012-01-29 20:27

>>25
AVX isn't a part of x86.

Name: Anonymous 2012-01-29 20:29

>>33 check `em

Name: Anonymous 2012-01-29 20:46

>>27
In that case neither are SSE, 64-bit extensions, MMX, or 386 Protected Mode. Not ``all x86's around the world'' have those either.

Name: Anonymous 2012-01-29 21:29

>>29
In that case neither are SSE, ...
Well no shit genius, did you figure that out all by yourself?

Name: Anonymous 2012-01-29 21:36

>>25
if a MIPS uses PMON or an ARM uses OpenFirmware, you need the specs
Yeah, as if they were doing it properly and it's not just a poor shitty half-compatible hack.

Alright, let's have it, faggot. Suppose I write a shit toy OS in x86 assembly. It works fine, and it works across most x86 computers minus some glitches or bugs. Now suppose I write its equivalent (same amount of logic) for MIPS or for ARM. Now tell me, how much extra fucking work will it take just to deal with the fact that every single MIPS and ARM vendor decides to customize their bullshit so that I can't just boot my original image directly? Maybe my question isn't clear enough or perhaps it is too complex or high-level for your mental midgetry so I'll illustrate.

Suppose I write an ARM OS that works perfectly fine on one of those cheap ARM evaluation boards; it's automatically a bad decision, because if I want to move to a different board, I will have to fuck around with the boot image (perhaps the boot process is different because the manufacturer decided so), I will have to rewrite the entire hardware handling stuff (most glaringly the graphics code). And then it might not work. And if it doesn't work, too fucking bad, because there aren't any working examples of miniature toy ARM OSes on the web nor is the documentation as extensive as it is for x86. If you look up info about setting up x86 paging and long mode, it's all there with examples and comments, explained in a hundred different ways. But for your unpopular architectures? Nothing.

Fuck you, x86 is king.

Name: Anonymous 2012-01-29 22:37

>>33
nice dubs bro

Name: Anonymous 2012-01-29 22:42

>>31
It works fine, and it works across most x86 computers minus anything invented after 1985.

Name: Anonymous 2012-01-29 22:45

>>31
You're confusing the Jewish toy instruction set called x86 with the Goyish computing platform called the IBM PC.

Name: Anonymous 2012-01-29 22:50

>>30
So you Israelis limit yourselves to what runs on the original 8086? That's as disgusting as Biblical Hebrew!

Name: Anonymous 2012-01-30 0:02

░░░░░░░░░░░░░░░▄░░░░░░░░░░░░░░░
░░░░░░░░░░░░░▄▀█░░░░░░░░░░░░░░░
░░░░░░░░░░░▄▀░░█░░░░░░░░░░░░░░░
░░░░░░░░░▄▀░░▄▀░░░░░░░░░░░░░░░░
░░░░░░░░█▄░▄▀░░░░░░░░▄█▄░░░░░░░
░░░░░░░░█░▀▄░░░░░░░▄▀░█░▀▄░░░░░
░░░░░░░░▀▄░░▀▄░░░▄▀░░▄▀▄░░▀▄░░░
░▄░░░░░░░░▀▄░░▀▄▀░░▄▀░░░▀▄░░▀▄░
░█▀▄░░░░░░░░▀▄▀█▀▄▀░░░░░░░▀▄░█░
░█░░▀▄░░░░░▄▀░░█░░▀▄░░░░░░░░▀█░
░░▀▄░░▀▄░▄▀░░▄▀░▀▄░░▀▄░░░░░░░░░
░░░░▀▄░░█░░▄▀░░░░░▀▄░▄█░░░░░░░░
░░░░░░▀▄█▄▀░░░░░░░░▄▀░█░░░░░░░░
░░░░░░░░▀░░░░░░░░▄▀░░▄▀░░░░░░░░
░░░░░░░░░░░░░░░▄▀░░▄▀░░░░░░░░░░
░░░░░░░░░░░░░░░█░▄▀░░░░░░░░░░░░
░░░░░░░░░░░░░░░█▀░░░░░░░░░░░░░░
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
░█▄░█░█░▄▀▀▄░░█░░█░█▀▀░▀█▀░█░░░
░█░█▄░█░█░▄▄░░█▄▄█░█▄▄░░█░░█░░░
░█░░█░█░▀▄▄▀░░█░░█░█▄▄░▄█▄░█▄▄░
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░

Name: Anonymous 2012-01-30 1:27

>>33
that's the best you can do?

>>34-35
fuck off niggers

Name: Anonymous 2012-01-30 3:39

>>34
Nope. They're both one and the same.

Name: Anonymous 2012-01-30 11:52

x86 supremacy

Name: Anonymous 2012-01-30 11:53

>>39
Jewish prolapsed AIDS-ridden distended anus supremacy

Name: Anonymous 2013-10-06 22:19

check 'em

Name: Anonymous 2013-10-07 1:28

                        ██████████████████████                                                                           
      ██████████████████                      ████            ██████████████    ████    ██    ██  ██████    ████    ██    ██
    ██                      ██                    ████  ████████████████████  ██    ██  ██    ██  ██      ██    ██  ██  ██
    ██                  ████            ██            ████    ██████████████  ██        ████████  ████    ██        ████ 
      ██████████████████          ██████                ██    ██████████████  ██    ██  ██    ██  ██      ██    ██  ██  ██
                    ██        ████    ██                ██    ██████████████    ████    ██    ██  ██████    ████    ██    ██
                    ██████████        ██                ██    ██████████████                                             
                      ██          ████  ██              ██    ██████████████  ██████████  ██    ██  ██████  ██      ██   
                        ██████████      ██              ██    ██████████████      ██      ██    ██  ██      ████  ████   
                          ██        ████  ██            ██    ██████████████      ██      ████████  ████    ██  ██  ██   
                            ████████      ██            ██    ██████████████      ██      ██    ██  ██      ██      ██   
                            ██        ████              ██    ██████████████      ██      ██    ██  ██████  ██      ██   
                              ████████            ████████    ██████████████                                             
                                      ████████████      ████████████████████                                             
                                                              ██████████████

Name: Anonymous 2013-10-07 2:08

die, fat nuggets

Name: Anonymous 2013-10-07 2:25

<-------

Name: Anonymous 2013-10-07 9:09

le pedophile dubs

Don't change these.
Name: Email:
Entire Thread Thread List