pouët.net

Go to bottom

Random line of code thread

category: code [glöplog]
For all two player games..

Code:int sch_AlphaBeta(int depth, int alpha, int beta) { if (depth == 0) return Evaluate(); GenerateLegalMoves(); while (MovesLeft()) { MakeNextMove(); val = -sch_AlphaBeta(depth - 1, -beta, -alpha); UnmakeMove(); if (val >= beta) return beta; if (val > alpha) alpha = val; } return alpha; }
added on the 2025-07-18 00:24:41 by orac81 orac81
Code:love.graphics.draw(starBuffer, (x + size + (size / 10)), y + (size / 10), 0, .1, .1)
added on the 2025-07-18 00:48:59 by lynn lynn
Code:move.l .opc(pc),a4 ; points to "move.w d5,d6;lsl.w #8,d6" = $3c05e14e, treated as $5e14e (68000 only)
added on the 2025-07-18 08:48:27 by losso losso
Code: [BAR * 25, "Hard to hear from you clearly, feel it really"], [BAR * 25.5, "If we're never worlds apart"], [BAR * 28, "[extended keytar noodling]"], [BAR * 36, "[yes, it's still going]"],
added on the 2025-07-19 01:35:52 by gasman gasman
Code:wine ~/Downloads/winuae64_6.0.0.exe -f runner.uae -G
added on the 2025-07-30 17:05:53 by Blueberry Blueberry
0x0842, // 3: jmp x--, 2 side 1
added on the 2025-08-01 10:29:49 by Mystran Mystran
Code: errors[charset][character][charline] = __builtin_popcount(character ^ charsets[charset][convert[charset][character][charline]][charline]);
added on the 2025-08-03 18:10:50 by Krill Krill
Code:tst.l ReturnCode(pc)
added on the 2025-08-08 13:51:24 by Blueberry Blueberry
1poke 53280,0:poke53281,0:print chr$(5)
2print mid$("NM",1-(rnd(1)>.5),1);:goto2
3rem c64, any cbm. thats shift NM
added on the 2025-08-25 11:41:27 by orac81 orac81
Code:stop #$2700
added on the 2025-08-26 22:19:56 by Blueberry Blueberry
Code:rs (:++ - :+) / 2
added on the 2025-08-30 20:57:51 by DevEd DevEd
Code:450 IF whtn6=>100 THEN 'here comes the great mountain of shit
added on the 2025-09-12 15:10:48 by juanp32 juanp32
Code:ldh [rNR{d:CNUM}2],a
added on the 2025-09-13 08:48:50 by DevEd DevEd
Code:const numLines = ev.target.value.trim().split("\n").map((line) => Math.ceil((line.trim().length + 1) / charsPerLine)).reduce((a,b) => a+b, 0);
added on the 2025-10-01 21:11:41 by KeyJ KeyJ
This is my random number generator.

Code: short rnd(int *seed) { return ((*seed = *seed * 214013L + 2521011L)>>16)&0x7fff; }
added on the 2025-10-02 03:32:00 by sigflup sigflup
Not one line, but one row:
Code:move.l (a1)+,d2 move.l (a1)+,d3 divu.w #1,d0 movem.l (a1)+,d4-d6 lsl.w d0,d7 movem.l (a1)+,d7/a0/a2 movem.l (a1)+,a3-a5 lsl.w d0,d1 lea.l 44(a6),a6 move.w (a1)+,d1 movem.l d2-d7/a0/a2-a5,-(a6) move.w d1,(a7)

Courtesy of Hannibal :)
added on the 2025-10-02 10:43:50 by Blueberry Blueberry
Code:sub.l (a4),a1 add.l -(a4),a1
added on the 2025-10-21 21:20:57 by Depeche Depeche
Code:bsr ecx, eax add ecx, byte 2 bts eax, ecx
added on the 2025-10-23 22:36:07 by Blueberry Blueberry
Blueberry is optimizing Crinkler headers again!
added on the 2025-10-23 22:55:18 by revival revival
The code is actually from Jingler, not Crinkler. ;)

A beverage to the first person to describe its purpose!
added on the 2025-10-23 23:10:56 by Blueberry Blueberry
Code:%if __BITS__ == 32 %define rax eax %define rbx ebx %define rcx ecx %define rdx edx %define rsi esi %define rdi edi %define rbp ebp %define rsp esp
added on the 2025-11-25 20:51:10 by Blueberry Blueberry
It is an index of bit strings prefixed with '101'? I don't know it's purpose beyond that. From looking at the repo, it selects some special set of opcodes under certain conditions.
added on the 2025-11-26 17:39:32 by id_less id_less
This is how I did triangle shading on daytrip/megadrive

Code: #define V1 vert_rot[cube_tris[i].v1] #define V2 vert_rot[cube_tris[i].v2] #define V3 vert_rot[cube_tris[i].v3] z_normal = ((V2.x-V1.x) * (V3.y-V2.y)) -((V3.x-V2.x) * (V2.y-V1.y)); color = 7-(abs(z_normal>>9)%7); color++; if(z_normal < 0) { flat_triangle(p, &cube_tris[i], color | (color<<4) ); }
added on the 2025-11-27 02:02:39 by sigflup sigflup
Code: ldh a,[hHeldButtons] ld a,[Player_ControlBitFlipMask] xor b
added on the 2025-11-27 05:32:10 by DevEd DevEd
Quote:
It is an index of bit strings prefixed with '101'? I don't know it's purpose beyond that. From looking at the repo, it selects some special set of opcodes under certain conditions.

Close enough. It's part of the decoding of the "implicit" bytecodes, for which the opcode (third byte of the encoding) of the corresponding SSE2 instruction is determined by the bytecode value. It just so happens that (almost) all of the relevant SSE2 instructions have opcodes that start with 101, so in order to save space in the bytecode encoding, I chop off the most significant 1 when encoding the bytecodes. Those three instructions then put it back during decoding.
added on the 2025-11-27 10:46:47 by Blueberry Blueberry

login

Go to top