pouët.net

Random line of code thread

category: code [glöplog]
POKE 56334, PEEK(56334) AND 254
lda #<($10 | (checkchars / $0400))
added on the 2009-12-04 05:47:55 by ferris ferris
;mknormal,yyy,timey,refperiod=[1881,1940]
;
; Apply a VERY ARTIFICAL correction for decline!!
;
yrloc=[1400,findgen(19)*5.+1904]
valadj=[0.,0.,0.,0.,0.,-0.1,-0.25,-0.3,0.,-0.1,0.3,0.8,1.2,1.7,2.5,2.6,2.6,$
2.6,2.6,2.6]*0.75 ; fudge factor
(...)
;
; APPLY ARTIFICIAL CORRECTION
;
yearlyadj=interpol(valadj,yrloc,x)
densall=densall+yearlyadj
added on the 2009-12-04 11:03:21 by NoahR NoahR
Code: $pointer =& self::$dstMatrix[self::$srcTables[$i]][self::$dstTables[self::$srcTables[$i]][$k ]];

...yea ... no democoding ATM :(
added on the 2009-12-04 11:14:51 by d0DgE d0DgE
Quote:
for(int i=start; i<start+amount; i++) {
tempPos=i-start;
if(creeps[nextAvailableCreep]==null) {
creeps[nextAvailableCreep]=new Creep(type, difficulty, nextAvailableCreep);
}
else
creeps[nextAvailableCreep].reset(type, difficulty, nextAvailableCreep);
creeps[nextAvailableCreep].currentPath=path[i%2];
creeps[nextAvailableCreep].posFixedX=(((int[])path[0].elementAt(path[0].size()-1 ))[0]*tileHeight+(tileHeight>>1)-((tempPos+1)*tileHeight))<<8;
creeps[nextAvailableCreep].posFixedY=(((int[])path[0].elementAt(path[0].size()-1 ))[1]*tileHeight+(tileHeight>>1))<<8;
creepGroups[currentCreepGroup].addElement(creeps[nextAvailableCreep]);

nextAvailableCreep++;
nextAvailableCreep%=creeps.length;
livingCreeps++;
}
added on the 2009-12-04 11:26:51 by Puryx Puryx
//
// gs_awScreen is assumed to be 256 x 192 x 16-bpp (RGB555) which
// is the screen res of the nintendo DSi.... which is what I might be coding
// on these days! :)


Code: void DrawRect(s32 nX1, s32 nY1, s32 nX2, s32 nY2, u16 wColor) { u16* pwDest = gs_awScreen; // // clip, swap, dwaaaaaappp poopadaaap! if (nX1 > nX2) { Swap32(&nX1, &nX2); } if (nY1 > nY2) { Swap32(&nY1, &nY2); } nX1 = MAX(0, nX1); nY1 = MAX(0, nY1); nX2 = MIN(255, nX2); nY2 = MIN(191, nY2); // // render horizontals u16* pwDest1 = pwDest + (nY1 << 8) + nX1; u16* pwDest2 = pwDest + (nY2 << 8) + nX1; s32 nCount = nX2 - nX1; while (nCount--) { *pwDest1++ = wColor; *pwDest2++ = wColor; } // // render verticals pwDest1 = pwDest + (nY1 << 8) + nX1; pwDest2 = pwDest + (nY1 << 8) + nX2; nCount = nY2 - nY1; while (nCount--) { *pwDest1 = wColor; *pwDest2 = wColor; pwDest1 += 256; pwDest2 += 256; } }
added on the 2009-12-04 16:32:16 by Phred Phred
Code: move.w #COOKI,$40(a6)


I prefer to stick to the topic
added on the 2009-12-04 20:00:48 by d0DgE d0DgE
switch (a[i].getActionType()) {
StateContainer::AT_INSERT:
//ok. look if this is a double insertion
break;
}
added on the 2009-12-15 10:29:04 by raer raer
Reminds me of this abomination:
Code:switch (foo) { case A: doit(); break; case B: doit(); break; case C: dosomethingelse(); break; case D: doit(); break; default: break; }
added on the 2009-12-15 13:21:14 by Joghurt Joghurt
Code: void (*FunctionArray[4])() = {&doit,&doit,&dosomethingelse,&doit}; (*FunctionArray[foo])(); //assuming "case" A,B,C,D consecutive
added on the 2009-12-15 13:58:52 by QUINTIX QUINTIX
Code: lea (CLIP_YMAX).w,a1 ; meh!
added on the 2009-12-15 14:13:00 by StingRay StingRay
Dunno which one is worse...
added on the 2009-12-15 17:10:10 by raer raer
Quote:
Code: void (*FunctionArray[4])() = {&doit,&doit,&dosomethingelse,&doit}; (*FunctionArray[foo])(); //assuming "case" A,B,C,D consecutive
You forgot the most interesting part:
Code:default: break;
added on the 2009-12-15 20:53:35 by Joghurt Joghurt
Code:If IsNumeric(SolveEquation(sParamLine)) Then Throw New Exception("Line " & iLine & ": pop <imm> is unsupported")
added on the 2009-12-15 21:04:45 by Marq Marq
Code: virtual getInfoString() { return "64-style snaredrum using (pitch-independent) timed loops"; }


(only 3 more dayz until the real coding recontinues :) )
added on the 2009-12-15 21:28:22 by xyz xyz
Code:hPutStrLn stderr "fuck everything"
added on the 2009-12-15 21:40:02 by blala blala
unsafe
{
for (int y = 0; y < bmData.Height; y++)
{
byte* ps = (byte*)bmData.Scan0.ToPointer() + bmData.Stride*y;
byte* pd = (byte*)gs.InternalData.ToPointer() + pitch*y;
for (int x = 0; x < bmData.Width; x++)
{
*pd = *ps;
pd++;
ps++;
*pd = *ps;
pd++;
ps++;
*pd = *ps;
pd++;
ps++;
*pd = 0;
pd++;
}
}
}

And fuck you, microsoft.
added on the 2009-12-15 23:40:17 by pan pan
Code:moveq #-$80,d2 ; ze pickzel
added on the 2009-12-15 23:53:16 by d0DgE d0DgE
Code: moveq #32-1,d6 ; Whole Wave !

added on the 2009-12-16 00:16:14 by xyz xyz
Code:$encSkip = self::convertLanguageEntities(self::$dstData[$tPtr][$k]['lang_id'],$s) ;


...work... *yawn*
added on the 2009-12-16 16:31:24 by d0DgE d0DgE
pan: doesn't the x86 have hardware (index registers) designed to work with arrays? the optimization guides I read from AMD suggest avoiding heavy use of pointer arithmetic
added on the 2009-12-16 16:38:53 by QUINTIX QUINTIX
void tiredeness()
{
int quarashee = 1;

for (int i=0; i<gamaton; i++)
phdaton(quarashee * sapila);

endcli(jump);
}
added on the 2009-12-16 17:04:29 by Optimonk Optimonk
for (int x = 31; x != -1; x--) { outp += (((uint)1 << x) & input) == ((uint)1 << x) ? "|" : "-"; if ((x % 8) == 0 ) { outp += " "; }; }
added on the 2009-12-22 21:16:42 by QUINTIX QUINTIX
Code:float random(int x) { int s = 71 * x; s = s * 8192 ^ s; return 1.0 - ((s*(s*s*15731+789221)+1376312589)&0x7fffffff)/1073741824.0; }
added on the 2009-12-22 21:52:41 by neoneye neoneye
Code: short rnd(int * seed) { return ((*seed = *seed * 214013L + 2531011L) >> 16) & 0x7fff; }
added on the 2009-12-22 22:04:15 by sigflup sigflup

login