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

Fun /prog/ Activity

Name: Anonymous 2010-06-06 5:18

Read these three code excerpts and attempt a guess at what the full program is designed to do. I do not intend to reveal the nature of the program, because I have great confidence that after a bit of discussion /prog/ will inevitably come to the right conclusion.

Segment 1:
for(i = 0; i < gridSize; i++)
        {
            for(j = 0; j < gridSize; j++)
            {
                for(k = 0; k < 6; k++)
                {
                    if(k < 5)
                        bufferGraphics.drawLine((int)testHex[i][j].xPoints[k], (int)testHex[i][j].yPoints[k], (int)testHex[i][j].xPoints[k+1], (int)testHex[i][j].yPoints[k+1]);
                    else
                        bufferGraphics.drawLine((int)testHex[i][j].xPoints[k], (int)testHex[i][j].yPoints[k], (int)testHex[i][j].xPoints[0], (int)testHex[i][j].yPoints[0]);
                }
            }
        }


Segment 2:
if(mouseY > testHex[i][j].yPoints[1] && mouseY < testHex[i][j].yPoints[2])
                {
                    vector = (mouseY - testHex[i][j].yPoints[5])/(Math.sin(300*Math.PI/180));
                    xTest1 = testHex[i][j].xPoints[5] + vector*Math.cos(300*Math.PI/180);
                    vector = (mouseY - testHex[i][j].yPoints[1])/(Math.sin(60*Math.PI/180));
                    xTest2 = testHex[i][j].xPoints[1] + vector*Math.cos(60*Math.PI/180);
                   
                    if(mouseX > xTest1 && mouseX < xTest2)
                    {
                        detected(i, j);
                    }
                }
                if(mouseY > testHex[i][j].yPoints[2] && mouseY < testHex[i][j].yPoints[3])
                {
                    vector = (mouseY - testHex[i][j].yPoints[4])/(Math.sin(240*Math.PI/180));
                    xTest1 = testHex[i][j].xPoints[4] + vector*Math.cos(240*Math.PI/180);
                    vector = (mouseY - testHex[i][j].yPoints[2])/(Math.sin(120*Math.PI/180));
                    xTest2 = testHex[i][j].xPoints[2] + vector*Math.cos(120*Math.PI/180);
                   
                    if(mouseX > xTest1 && mouseX < xTest2)
                    {
                        detected(i, j);
                    }
                }


Segment 3:
public hex(hex Copy)
    {
        iIndex = Copy.iIndex;
        jIndex = Copy.jIndex;
        threatLevel = Copy.threatLevel;
        hexSize = Copy.hexSize;
        terrain = Copy.terrain;
        currentVPBuffer = Copy.currentVPBuffer;
        victoryPoints = Copy.victoryPoints;
        defLevel = Copy.defLevel;
        defPoints = Copy.defPoints;
        heldBy = Copy.heldBy;
        NPC = Copy.NPC;
        this.setLocation(Copy.yPoints[0], Copy.xPoints[0], Copy.hexSize);
    }

Name: level 2 2010-06-06 11:03


[bits 16]
[org 0x100]
; %define VAL1 ???
; %define VAL2 ???

; ...

; On entry:
;   Args:
;   ax = 0 or 1
;   dx = 0 or 1
;   [ds:bx] = char*
   
;   Returns:
;   ax = char*
   
    start:
        push si            
        push di            
        push ax
        neg  ax
        mov  si, ax
        shl  ax, 1
        inc  ax
        mov  di, ax
        pop  ax
        xor  ax, dx
        jnz  .baab0
        jmp  .abba0
       
    .abba1:
        add  bx, di
    .abba0:
        mov  al, [bx+si]
        cmp  al, VAL1
        je   .abba1
        cmp  al, VAL2
        je   .abba1
        jmp  .abba2
   
    .abba2:
        add  bx, di
        mov  al, [bx+si]
        cmp  al, VAL1
        je   .return
        cmp  al, VAL2
        je   .return
        jmp  .abba2
       
    .baab1:
        add  bx, di
    .baab0:
        mov  al, [bx+si]
        cmp  al, VAL1
        je   .baab2
        cmp  al, VAL2
        je   .baab2
        jmp  .baab1
   
    .baab2:
        add  bx, di
        mov  al, [bx+si]
        cmp  al, VAL1
        je   .baab2
        cmp  al, VAL2
        je   .baab2
        jmp  .return
       
    .return:
        mov  ax, bx
        pop  di
        pop  si
        retn


What does it do, and what are val1 and val2 most likely to be?

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