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

Pages: 1-

Megazeux robotics vs GM

Name: Anonymous 2012-09-27 12:52

I've tried rational on the internet. It wasn't much fun for me.
If we keep telling them money can't buy happiness, it will keep them from rioting.

Imagine there's a person who's really fat because they don't eat right or exercise. One day, they get up, wobble around ungainly-like on stubby, crusty legs in a crude and obviously unpracticed attempt at jogging, get frustrated because they suck at it and it hurts them to start using these neglected muscles, go back to the couch, and say disdainfully "I've tried skinny. It wasn't much fun for me."
________________________
This is how I feel about real programming languages. That's why I use Megazeux and Game Maker in the first place. It will never be action-script or C. But it's ok because I have a better understanding of what I am doing. That's why I ask what I did about these half-assed codes counting as a appropriate programming language.

Name: Anonymous 2012-09-27 13:07

Are you quoting something?

The fat guy can't exercise, he's weak; you can't learn a proper language, your mind is weak.

Name: Anonymous 2012-09-27 13:07

Hi /prog/,
I'm writing a small program in C to calculate the value of pi using the Montecarlo algorithm.
What can I do to improve it ?

[code]#include <stdio.h>
#include <stdlib.h>
#include <time.h>

long EVALPI(long);

#ifdef EBUG
#define DEBUG
#endif

/* README:
        you can add -DEBUG to your CFLAGS.
        Usage: ./montecarlo [number of loops] [rand seed]
        If the number of loops is not provided, it'll be asked on the command line.
        If the rand seed is not provided, it'll use the current timestamp using time() (3).
*/

int main(int argc, char **argv){
        long c, p;

        if(argc > 1){
                p = atoi(argv[1]);
        }else{
                printf("Nombre d'iterations: ");
                scanf("%ld", &p);
        }

        if(argc > 2)
                srand(atoi(argv[2]));
        else
                srand(time(NULL));

        c = EVALPI(p);
        printf("pi ~= 4*%ld/%ld ~= %f\n", c, p, (double)(c<<2)/p);
        return 0;
}

long EVALPI(long p){
        const long CENTRE = RAND_MAX >> 1;
        const long CENTRE_2 = CENTRE * CENTRE;
        long x, y, c = 0;
#ifdef DEBUG
        long old = p, foo = p/4;
#endif
        do{
                x = CENTRE - rand();
                x *= x;
                y = CENTRE - rand();
                y *= y;
                if(x+y < CENTRE_2) c++;
#ifdef DEBUG
                if(p % foo == 1) printf("%f\n", (double)(c<<2)/(old-p));
#endif
        }while(p--);

        return c;
}
[code]

Name: Anonymous 2012-09-27 13:11

you can close your bbcode tags

Name: Anonymous 2012-09-27 13:21

Oh, fuck this shit. I clicked on "New Thread" on the front page and it ended up here.

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