• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

ATOT programing challenge

AFB

Lifer
Prize: Gmail Invite (1)
Rules: We must be able to see your work so you have to use a popular language or have a web based App (ie PHP or ASP ). You can submit as many times as you want. Sorry length must be at least 30 lines.

You have until 2:30 AM Central Standard Time Tuesday.
 
Originally posted by: BaboonGuy
^the 3 posts above describe perfectly why we are ATOT. and why we are virgins!

I hear there are people here that have seen boobies :Q OMG
 
#include <iostream.h>
void main()
{
int a=0;
int b=0;
int c=0;
int d=0;
int e=0;
int f=0;
int g=0;
int h=0;
int i=0;
int j=0;
int k=0;
int l=0;
int m=0;
int n=0;
int o=0;
int p=0;
int q=0;
int r=0;
int s=0;
int t=0;
int u=0;
int v=0;
int w=0;
int x=0;
int y=0;
int z=0;
}

useless enough? 😀
 
.MODEL SMALL

.STACK 100h
.DATA
a dw 2
b dw 3
result dw ?

.CODE

main PROC far

start: mov ax,@data
mov ds,ax

mov ax,a
add ax,b
mov result,ax
;
;
mov ah,4ch
int 21h
main endp
;
end main

is this useless enough?
 
#!/usr/bin/perl
1;
2;
3;
4;
5;
6;
7;
8;
9;
10;
11;
12;
13;
14;
15;
16;
17;
18;
19;
20;
21;
22;
23;
24;
25;
26;
27;
28;
29;
30;
exit;
 
Originally posted by: Darien
Originally posted by: Orsorum
*cough* NERDS *cough*



*anyone* can write all of the programs listed so far....

I heard that you were feeling ill, headache fever and a chill, I came to help restore your pluck, 'cause I'm the nurse who likes to...
 
Ok, this is more impressive looking, but still pretty useless:

#!/usr/bin/perl
my @array;
for( my $ii = 0; $ii < rand ( 256 ); $ii -= 1 ) {
$ii = rand ( 512 );
my %hash;
for ( my $jj = 0; $jj < $ii; $jj++ ) {
$hash{ $jj } = rand ( 1024 );
}
push @array, \%hash;
}
foreach my $entry ( @array ) {
my @key = keys %$entry;
my @vals = values %$entry;
for ( my $ii = 0; $ii < @key ; $ii++ ) {
print "Some key: ";
print $key [ $ii ];
print "\n";
print "Some value: ";
print $vals [ $ii ];
print "\n";
print "\n";
}
}
while ( ( ref $array[0] ) ne "" ) {
$hashref = shift @array;
if ( ref $hashref eq "HASH" ) {
print "hash: ";
print $hashref;
print "\n";
}
else {
print ref $hashref;
print ": ";
print $hashref;
print "\n";
}
}
 
Originally posted by: Orsorum
Originally posted by: Darien
Originally posted by: Orsorum
*cough* NERDS *cough*



*anyone* can write all of the programs listed so far....

I heard that you were feeling ill, headache fever and a chill, I came to help restore your pluck, 'cause I'm the nurse who likes to...

Since I have *NO* idea where that comes from, I probably am a nerd, or I'm not nerdy enough 😛
 
Originally posted by: Darien
Originally posted by: Orsorum
Originally posted by: Darien
Originally posted by: Orsorum
*cough* NERDS *cough*



*anyone* can write all of the programs listed so far....

I heard that you were feeling ill, headache fever and a chill, I came to help restore your pluck, 'cause I'm the nurse who likes to...

Since I have *NO* idea where that comes from, I probably am a nerd, or I'm not nerdy enough 😛

Bueller? Bueller? Anyone?
 
#include iostream
using namspace std;

int main() {

cout << "OMGWATERMELON!";
cout << "OMGWATERMELON!";
cout << "OMGWATERMELON!";
cout << "OMGWATERMELON!";
cout << "OMGWATERMELON!";
cout << "OMGWATERMELON!";
cout << "OMGWATERMELON!";
cout << "OMGWATERMELON!";
cout << "OMGWATERMELON!";
cout << "OMGWATERMELON!";
cout << "OMGWATERMELON!";
cout << "OMGWATERMELON!";
cout << "OMGWATERMELON!";
cout << "OMGWATERMELON!";
cout << "OMGWATERMELON!";
cout << "OMGWATERMELON!";
cout << "OMGWATERMELON!";
cout << "OMGWATERMELON!";
cout << "OMGWATERMELON!";
cout << "OMGWATERMELON!";
cout << "OMGWATERMELON!";
cout << "OMGWATERMELON!";
cout << "OMGWATERMELON!";
cout << "OMGWATERMELON!";
cout << "OMGWATERMELON!";
cout << "OMGWATERMELON!";
cout << "OMGWATERMELON!";
cout << "OMGWATERMELON!";
cout << "OMGWATERMELON!";
cout << "OMGWATERMELON!";
cout << "OMGWATERMELON!";
cout << "OMGWATERMELON!";
cout << "OMGWATERMELON!";
cout << "OMGWATERMELON!";
cout << "OMGWATERMELON!";
cout << "OMGWATERMELON!";
cout << "breasts.";

return 69;
}
 
#include <windows.h>
#include <d3d8.h>
#include <d3dx8tex.h>
#include <dxerr8.h>
#include <time.h>
#include <iostream.h>


LRESULT WINAPI WndProc(HWND hWnd, UINT msg,
WPARAM wParam, LPARAM lParam);
void RegisterWindowClass(HINSTANCE hInstance);
void CreateAppWindow(HINSTANCE hInstance);
WPARAM StartMessageLoop();
HRESULT InitFullScreenDirect3D();
void Render();
void CleanUpDirect3D();

HWND g_hWnd;
IDirect3D8* g_pDirect3D = NULL;
IDirect3DDevice8* g_pDirect3DDevice = NULL;

struct CUSTOMVERTEX
{
FLOAT x, y, z, rhw;
DWORD color;
};


INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, INT)
{
RegisterWindowClass(hInstance);
CreateAppWindow(hInstance);
ShowWindow(g_hWnd, SW_SHOWDEFAULT);
UpdateWindow(g_hWnd);
HRESULT hResult = InitFullScreenDirect3D();
if (SUCCEEDED(hResult))
WPARAM result = StartMessageLoop();
CleanUpDirect3D();
return 0;
}

LRESULT WINAPI WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg)
{
case WM_CREATE:
return 0;

case WM_DESTROY:
PostQuitMessage( 0 );
return 0;

case WM_PAINT:
ValidateRect(g_hWnd, NULL);
return 0;
case WM_KEYDOWN:
switch(wParam)
{
case VK_ESCAPE:
PostQuitMessage(WM_QUIT);
break;
}
}
return DefWindowProc(hWnd, msg, wParam, lParam);
}

void RegisterWindowClass(HINSTANCE hInstance)
{
WNDCLASSEX wc;
wc.cbSize = sizeof(WNDCLASSEX);
wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
wc.lpfnWndProc = WndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wc.hCursor = (HCURSOR)LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
wc.lpszMenuName = NULL;
wc.lpszClassName = "TriangleApp";
wc.hIconSm = NULL;

RegisterClassEx(&amp;wc);
}


void CreateAppWindow(HINSTANCE hInstance)
{
g_hWnd = CreateWindowEx(
NULL,
"TriangleApp",
"Triangle Application",
WS_OVERLAPPEDWINDOW,
100,
100,
648,
514,
GetDesktopWindow(),
NULL,
hInstance,
NULL);
}


WPARAM StartMessageLoop()
{
MSG msg;
while(1)
{
if (PeekMessage(&amp;msg, NULL, 0, 0, PM_REMOVE))
{
if (msg.message == WM_QUIT)
break;
TranslateMessage(&amp;msg);
DispatchMessage(&amp;msg);
}
else
{
// Use idle time here.
Render();
}
}
return msg.wParam;
}


HRESULT InitFullScreenDirect3D()
{
g_pDirect3D = Direct3DCreate8(D3D_SDK_VERSION);
if (g_pDirect3D == NULL)
return E_FAIL;
HRESULT hResult = g_pDirect3D->CheckDeviceType(D3DADAPTER_DEFAULT,
D3DDEVTYPE_REF, D3DFMT_X8R8G8B8, D3DFMT_X8R8G8B8, FALSE);
if (hResult != D3D_OK)
{
MessageBox(g_hWnd,
"Sorry. This program won?t\nrun on your system.",
"DirectX Error", MB_OK);
return E_FAIL;
}
D3DPRESENT_PARAMETERS D3DPresentParams;
ZeroMemory(&amp;D3DPresentParams, sizeof(D3DPRESENT_PARAMETERS));
D3DPresentParams.Windowed = FALSE;
D3DPresentParams.BackBufferCount = 1;
D3DPresentParams.BackBufferWidth = 1280;
D3DPresentParams.BackBufferHeight = 960;
D3DPresentParams.BackBufferFormat = D3DFMT_X8R8G8B8;
D3DPresentParams.SwapEffect = D3DSWAPEFFECT_DISCARD;
D3DPresentParams.hDeviceWindow = g_hWnd;
hResult = g_pDirect3D->CreateDevice(D3DADAPTER_DEFAULT,
D3DDEVTYPE_HAL, g_hWnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING,
&amp;D3DPresentParams, &amp;g_pDirect3DDevice);
if (FAILED(hResult))
return E_FAIL;
return D3D_OK;
}

void CleanUpDirect3D()
{
if (g_pDirect3DDevice)
g_pDirect3DDevice->Release();
if (g_pDirect3D)
g_pDirect3D->Release();
}


void Render()
{
int x,y,z,r;
float a,b,c,d,e,f;
time_t start,end;


while (1){
for (x=0; x<32768; x=x+1)
{
}

z=(int) rand()*255;
y=(int) rand()*255;
x=(int) rand()*255;
a=(float) rand()*420;
b=(float) rand()*959;
c=(float) rand()*420;
d=(float) rand()*959;
e=(float) rand()*420;
f=(float) rand()*959;

time (&amp;start);
time (&amp;end);
while (difftime(end,start) < 0.0166666667)
{
time (&amp;end);
}

CUSTOMVERTEX triangleVertices[] =
{

{320.0f, 120.0f, 0.0f, 1.0f, D3DCOLOR_XRGB(x,y,z),},
{420.0f, 320.0f, 0.0f, 1.0f, D3DCOLOR_XRGB(z,y,x),},
{20.00000000f, 320.0f, 0.0f, 1.0f, D3DCOLOR_XRGB(y,x,z),},


};

IDirect3DVertexBuffer8* pVertexBuf = NULL;
HRESULT hResult = g_pDirect3DDevice->CreateVertexBuffer(
3*sizeof(CUSTOMVERTEX), 0, D3DFVF_XYZRHW | D3DFVF_DIFFUSE,
D3DPOOL_DEFAULT, &amp;pVertexBuf);
if(FAILED(hResult))
{
DXTRACE_ERR("Error creating vertex buffer", hResult);
return;
}
VOID* pVertices;
hResult = pVertexBuf->Lock(0, 0, (BYTE**)&amp;pVertices, 0);
if(FAILED(hResult))
{
DXTRACE_ERR("Error locking vertex buffer", hResult);
return;
}
memcpy(pVertices, triangleVertices, sizeof(triangleVertices));
pVertexBuf->Unlock();

g_pDirect3DDevice->Clear(0, NULL, D3DCLEAR_TARGET,
D3DCOLOR_XRGB(0,0,0), 1.0f, 0 );
g_pDirect3DDevice->SetStreamSource(0, pVertexBuf,
sizeof(CUSTOMVERTEX));
g_pDirect3DDevice->SetVertexShader(D3DFVF_XYZRHW | D3DFVF_DIFFUSE);

g_pDirect3DDevice->BeginScene();
g_pDirect3DDevice->DrawPrimitive(D3DPT_TRIANGLELIST, 0, 1);
g_pDirect3DDevice->EndScene();

g_pDirect3DDevice->Present( NULL, NULL, NULL, NULL );

if (pVertexBuf)
pVertexBuf->Release();

}
}
 
Back
Top