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: Anonymous 2010-06-06 5:25


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