something wicked!

This is a discussion on something wicked! within the Windows Programming forums, part of the Platform Specific Boards category; something wicked! The study of randomology. In theory at some point or another all possibilities of a given function will ...

  1. #1
    Registered User kryptkat's Avatar
    Join Date
    Dec 2002
    Posts
    638

    something wicked!

    something wicked!



    The study of randomology. In theory at some point or another all possibilities of a given function will occur. So what does random look like?
    With this wicked prog to aid in the study of randomology you should see what random looks like. What this wicked prog does is generate a random x value in the window
    dimentions. It then generates a random y value or point in the window. Then it produces a random value for the RED color. A GREEN random value is then selected. And last a BLUE random value.
    It then sets one pixel at the x and y cordinates with the random RED random GREEN random BLUE value.

    What you get is an image that can not be mesured in frames per second. The image eventhough random appears to be of patterns that are semetrical. If you stare
    at the center of the image while it runs you get to see a crystal shape that changes in a sphere with prongs. Then you get to see the rise and fall of a 3d image.
    Like a fog or mist with patterns of flowers moving and dancing. Wicked! yes! you may want to put a getch() but i just wanted to see how fast it would run. These are the fun progs i love to do. enjoy.

    disclaimer. i will not be responsible if you puke vomit or get sick from this prog. If it should cause you to faint go insane or anyother problem or crash your computer
    i will not be responsible because by run this prog at you own risk.

    Code:
    /* Wicked.c */
    /*          */
    /*             by KryptKat! */
    /*                             June 11, 2006 */
    
    
    
    #include<windows.h>
    #include<disclaimer.h> 
    
    #define MAX 261
    
    int a;
    int b;
    int d;
    int e;
    
    int i;
    int j;
    
    LRESULT CALLBACK MainWindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
    
    int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
    {
    	WNDCLASS meowWin;
    	MSG msg;
    
    	meowWin.style = CS_VREDRAW | CS_HREDRAW;
    	meowWin.lpfnWndProc = MainWindowProc;
    	meowWin.cbClsExtra = 0;
    	meowWin.cbWndExtra = 0;
    	meowWin.hInstance = hInstance;
    	meowWin.hIcon = LoadIcon (NULL, IDI_APPLICATION);
    	meowWin.hCursor = LoadCursor (NULL, IDC_ARROW);
    	meowWin.hbrBackground = (HBRUSH) (COLOR_SCROLLBAR + 1);
    	meowWin.lpszMenuName = 0;
    	meowWin.lpszClassName = "wicked";
    
    
    	if (!RegisterClass (&meowWin))
    		return 0;
    
    	HWND hwnd;
    
    	hwnd = CreateWindow (	"Wicked",
    							"wicked.cpp",
    							WS_OVERLAPPEDWINDOW & ~WS_THICKFRAME,
    							20,
    							20,
    							MAX + 40,
    							MAX + 60,
    							NULL,
    							NULL,
    							hInstance,
    							NULL);
    
    	if (!hwnd)
    		return 0;
    
    
    	ShowWindow (hwnd, nCmdShow);
    
    	while (GetMessage (&msg, NULL, 0, 0))
    	{
    		TranslateMessage (&msg);
    		DispatchMessage (&msg);
    	}
    
        return 0;
    }
    
    
    
    
    LRESULT CALLBACK MainWindowProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
    {
    
    	switch (msg)
    	{
    
    		case WM_PAINT:
    		{
    			PAINTSTRUCT ps;
    			HDC hdc = BeginPaint(hwnd, &ps);
    
                            
                            for(a=0;a<999999999;a++){
    
    
                           j = rand() % MAX;
                           i = rand() % MAX;
    
                           b = rand() % 255;
                           d = rand() % 255;
                           e = rand() % 255;
    
    
    
    			SetPixel (hdc, j + 20, i + 20, RGB (b, d, e));
    				 }
    
    			EndPaint(hwnd, &ps);
    			return 0;
    		}
    		break;
    
    		case WM_DESTROY:
    		{
    
    			PostQuitMessage (0);
    		}
    		break;
    
    
    
    
    	}
    	
    	return DefWindowProc (hwnd, msg, wParam, lParam);	
    }
    suggestions for improvements comments other? fun yes?

  2. #2
    carry on JaWiB's Avatar
    Join Date
    Feb 2003
    Location
    Seattle, WA
    Posts
    1,972
    >The image eventhough random appears to be of patterns that are semetrical. If you stare
    at the center of the image while it runs you get to see a crystal shape that changes in a sphere with prongs. Then you get to see the rise and fall of a 3d image.

    I don't see it...I suppose what you're seeing might be an optical illusion, or it might be due to the fact that rand is only returning a pseudo-random number
    "Think not but that I know these things; or think
    I know them not: not therefore am I short
    Of knowing what I ought."
    -John Milton, Paradise Regained (1671)

    "Work hard and it might happen."
    -XSquared

  3. #3
    Registered User kryptkat's Avatar
    Join Date
    Dec 2002
    Posts
    638
    There was an experiment on television where they painted large numbers on baseballs and ran them through the pitching machine. The batters at first could not read the numbers but after some time they could read them as they swing to hit the ball with the number on them.

    I think this prog is like that. The brain tries to make sense of the mess of dots.

    I modified the prog to use lineto and other functions just for fun. The pixels is still the best one.

    Is this a worthwhile prog for randomology or just another catastrophe? Meow?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Copy strings from editcontrols
    By Drogin in forum C++ Programming
    Replies: 14
    Last Post: 11-01-2005, 12:55 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21