PER HERE

I didn’t find out about this contest until it was a month old.

Then I did a little digging on the subject (just a small bit of time) and took notes.

Later after I had the solution to one of the problems I had (unfortunately three weeks later or so) I decided to enter the contest.

Well I am here to report it is hours away from being due (and I am almost done) but I am not going to make it. I just wanted a new computer that wasn’t backdoored as all hell. But fuck, oh well. Alot of shit happened this past week so I have spent only a few hours for about 3 days out of the week writing this. Anyhow, the code is below, and since my site modifies shit I post a source file will also be located HERE. Like I said it is unfinished, and was really the first real world problem I have solved using java.

import java.util.*;

public class Decathlon {

/* Create the vector called vectorData to store the first run of names */

Vector vectorData = new Vector();

/* Create the vectors for each event SET ONE OF TWO */

Vector vector100m = new Vector(),

vector110m = new Vector(),

vector400m = new Vector(),

vector1500m = new Vector(),

vectorDiscus = new Vector(),

vectorJavelin = new Vector(),

vectorShot = new Vector(),

vectorLong = new Vector(),

vectorHigh = new Vector(),

vectorPole = new Vector();

/* Creation of constants for use in calculating scores */

/* Throwing */

double discusA = 12.91d;

double javelinA = 10.14d;

double shotA = 51.39d;

int discusB = 4;

int javelinB = 7;

double shotB = 1.5d;

double discusC = 1.1d;

double javelinC = 1.08d;

double shotC = 1.05d;

/* Running */

double A100mA = 25.4347d;

double A110mA = 5.74352d;

double A400mA = 1.53775d;

double A1500mA = 0.03768d;

int B100mB = 18;

double B110mB = 28.5d;

int B400mB = 82;

int B1500mB = 180;

double C100mC = 1.81d;

double C110mC = 1.92d;

double C400mC = 1.81d;

double C1500mC = 1.85d;

/* Jumping */

double longA = 0.14354d;

double highA = 0.8465d;

double poleA = 0.2797d;

int longB = 220;

int highB = 75;

int poleB = 100;

double longC = 1.4d;

double highC = 1.42d;

double poleC = 1.35d;

/* Creation of hashmap set for scores to be stored with name */

Map map100m = new HashMap(),

map110m = new HashMap(),

map400m = new HashMap(),

map1500m = new HashMap(),

mapDiscus = new HashMap(),

mapJavelin = new HashMap(),

mapShot = new HashMap(),

mapLong = new HashMap(),

mapHigh = new HashMap(),

mapPole = new HashMap();

try {

/* Load file into scanner */

Scanner scanner = new Scanner(new File(“Decathlon.dat”));

} catch (java.io.FileNotFoundException fileMissing) {

System.exit(1);

}

public void scanFile() {

/* While loops to load the first data dump. Runs until # is encountered */

while (!scanner.hasNext(“#”))

{

String upper = scanner.next();

vectorData.addElement(upper.toUpperCase());

}

}

public void loadVectors() {

/* Create vaiable to hold size of vectorData divided by 3 */

int vectorDataSize = vectorData.size() / 3;

/* Create variable tempCount which is used in each run */

int tempCount = 1;

/* Search every 3 buckets for name of event, then move on to next event and repeat */

while(vectorDataSize != 0)

{

if(vectorData.get(tempCount).contains(“100M”))

{

vector100m.addElement(new String(vectorData.get(tempCount -1)));

vector100m.addElement(new String(vectorData.get(tempCount)));

vector100m.addElement(new String(vectorData.get(tempCount +1)));

}

–vectorDataSize;

tempCount = tempCount + 3;

}

/* re-initialize vectorDataSize */

vectorDataSize = vectorData.size() / 3;

/* re-initialize tempCount */

tempCount = 1;

while(vectorDataSize != 0)

{

if(vectorData.get(tempCount).contains(“110M”))

{

vector110m.addElement(new String(vectorData.get(tempCount -1)));

vector110m.addElement(new String(vectorData.get(tempCount)));

vector110m.addElement(new String(vectorData.get(tempCount +1)));

}

–vectorDataSize;

tempCount = tempCount + 3;

}

/* re-initialize vectorDataSize */

vectorDataSize = vectorData.size() / 3;

/* re-initialize tempCount */

tempCount = 1;

while(vectorDataSize != 0)

{

if(vectorData.get(tempCount).contains(“400M”))

{

vector400m.addElement(new String(vectorData.get(tempCount -1)));

vector400m.addElement(new String(vectorData.get(tempCount)));

vector400m.addElement(new String(vectorData.get(tempCount +1)));

}

–vectorDataSize;

tempCount = tempCount + 3;

}

/* re-initialize vectorDataSize */

vectorDataSize = vectorData.size() / 3;

/* re-initialize tempCount */

tempCount = 1;

while(vectorDataSize != 0)

{

int tempCount = 1;

if(vectorData.get(tempCount).contains(“1500M”))

{

vector1500m.addElement(new String(vectorData.get(tempCount -1)));

vector1500m.addElement(new String(vectorData.get(tempCount)));

vector1500m.addElement(new String(vectorData.get(tempCount +1)));

}

–vectorDataSize;

tempCount = tempCount + 3;

}

/* re-initialize vectorDataSize */

vectorDataSize = vectorData.size() / 3;

/* re-initialize tempCount */

tempCount = 1;

while(vectorDataSize != 0)

{

if(vectorData.get(tempCount).contains(“DISCUS”))

{

vectorDiscus.addElement(new String(vectorData.get(tempCount -1)));

vectorDiscus.addElement(new String(vectorData.get(tempCount)));

vectorDiscus.addElement(new String(vectorData.get(tempCount +1)));

}

–vectorDataSize;

tempCount = tempCount + 3;

}

/* re-initialize vectorDataSize */

vectorDataSize = vectorData.size() / 3;

/* re-initialize tempCount */

tempCount = 1;

while(vectorDataSize != 0)

{

if(vectorData.get(tempCount).contains(“JAVELIN”))

{

vectorJavelin.addElement(new String(vectorData.get(tempCount -1)));

vectorJavelin.addElement(new String(vectorData.get(tempCount)));

vectorJavelin.addElement(new String(vectorData.get(tempCount +1)));

}

–vectorDataSize;

tempCount = tempCount + 3;

}

/* re-initialize vectorDataSize */

vectorDataSize = vectorData.size() / 3;

/* re-initialize tempCount */

tempCount = 1;

while(vectorDataSize != 0)

{

if(vectorData.get(tempCount).contains(“SHOT”))

{

vectorShot.addElement(new String(vectorData.get(tempCount -1)));

vectorShot.addElement(new String(vectorData.get(tempCount)));

vectorShot.addElement(new String(vectorData.get(tempCount +1)));

}

–vectorDataSize;

tempCount = tempCount + 3;

}

/* re-initialize vectorDataSize */

vectorDataSize = vectorData.size() / 3;

/* re-initialize tempCount */

tempCount = 1;

while(vectorDataSize != 0)

{

if(vectorData.get(tempCount).contains(“LONG”))

{

vectorLong.addElement(new String(vectorData.get(tempCount -1)));

vectorLong.addElement(new String(vectorData.get(tempCount)));

vectorLong.addElement(new String(vectorData.get(tempCount +1)));

}

–vectorDataSize;

tempCount = tempCount + 3;

}

/* re-initialize vectorDataSize */

vectorDataSize = vectorData.size() / 3;

/* re-initialize tempCount */

tempCount = 1;

while(vectorDataSize != 0)

{

if(vectorData.get(tempCount).contains(“HIGH”))

{

vectorHigh.addElement(new String(vectorData.get(tempCount -1)));

vectorHigh.addElement(new String(vectorData.get(tempCount)));

vectorHigh.addElement(new String(vectorData.get(tempCount +1)));

}

–vectorDataSize;

tempCount = tempCount + 3;

}

/* re-initialize vectorDataSize */

vectorDataSize = vectorData.size() / 3;

/* re-initialize tempCount */

tempCount = 1;

while(vectorDataSize != 0)

{

if(vectorData.get(tempCount).contains(“100M”))

{

vector100m.addElement(new String(vectorData.get(tempCount -1)));

vector100m.addElement(new String(vectorData.get(tempCount)));

vector100m.addElement(new String(vectorData.get(tempCount +1)));

}

–vectorDataSize;

tempCount = tempCount + 3;

}

/* re-initialize vectorDataSize */

vectorDataSize = vectorData.size() / 3;

/* re-initialize tempCount */

tempCount = 1;

while(vectorDataSize != 0)

{

if(vectorData.get(tempCount).contains(“POLE”))

{

vectorPole.addElement(new String(vectorData.get(tempCount -1)));

vectorPole.addElement(new String(vectorData.get(tempCount)));

vectorPole.addElement(new String(vectorData.get(tempCount +1)));

}

–vectorDataSize;

tempCount = tempCount + 3;

}

}

public void runScores() {

/* Creation of variable dataPointer to be used as a pointer into the data structure */

/* Initial value is 2 because it will point to the first score in the data set */

/* Afterwards it will be incremented by three until variable currentVectorSize is 0 */

int dataPointer = 2;

/* Creation of variable tempScore to temporarily hold the score we are working on */

/* Data type is int so it drops the remainder of the double to round down per rules */

int tempScore;

/* Creation of variables for helping in the calculation of D-B, B-T, and M-B */

double tempDB;

double tempBT;

double tempMB;

/* Code to calculate the scores for the Throwing events*/

/* Code to calculate score for event Discus */

/* Create vaiable to hold size of vectorDiscus divided by 3 */

int vectorDiscusSize = vectorDiscus.size() / 3;

/* Search every 3 buckets for name of event, then move on to next event and repeat */

while(vectorDiscusSize != 0)

{

tempDB = discusB – vectorDiscus.get(dataPointer);

tempExponent = Math.pow((double)tempDB, (double)discusC));

tempScore = discusA * tempExponent;

–vectorDiscusSize;

String nameDiscus = vectorDiscus.get(dataPointer -2)

dataPointer = dataPointer + 3;

mapDiscus.put(nameDiscus, tempScore);

}

tempCount2 = 2;

/* Create vaiable to hold size of vectorDiscus divided by 3 */

int vectorJavelinSize = vectorJavelin.size() / 3;

while(vectorJavelin != 0)

{

/* Code to calculate score for event Javelin */

tempDB = javelinB – vectorJavelin.get(dataPointer);

tempExponent = Math.pow((double)tempDB, (double)javelinC));

tempScore = javelinA * tempExponent;

–vectorJavelinSize;

String nameJavelin = vectorJavelin.get(dataPointer -2)

dataPointer = dataPointer + 3;

mapJavelin.put(nameJavelin, tempScore);

}

tempCount2 = 2;

/* Create vaiable to hold size of vectorShot divided by 3 */

int vectorShotSize = vectorJavelin.size() / 3;

while(vectorShot != 0)

{

/* Code to calculate score for event Shot */

tempDB = shotB – vectorShot.get(dataPointer);

tempExponent = Math.pow((double)tempDB, (double)shotC));

tempScore = shotA * tempExponent;

–vectorShotSize;

String nameShot = vectorShot.get(dataPointer -2)

dataPointer = dataPointer + 3;

mapShot.put(nameShot, tempScore);

}

tempCount2 = 2;

/* Create vaiable to hold size of vector100m divided by 3 */

int vector100mSize = vector100m.size() / 3;

while(vector100m != 0)

{

/* Code to calculate the scores for the Running events */

/* Code to calculate score for event 100m */

tempBT = B100mB – vector100m.get(dataPointer);

tempExponent = Math.pow((double)tempBT, (double)C100mC));

tempScore = A100mA * tempExponent;

–vectorShotSize;

String name100m = vector100m.get(dataPointer -2)

dataPointer = dataPointer + 3;

map100m.put(name100m, tempScore);

}

tempCount2 = 2;

/* Create vaiable to hold size of vector110m divided by 3 */

int vector110mSize = vector110m.size() / 3;

while(vector110m != 0)

{

/* Code to calculate score for event 110m */

tempBT = B110mB – vector110m.get(dataPointer);

tempExponent = Math.pow((double)tempBT, (double)C110mC));

tempScore = A110mA * tempExponent;

–vector110mSize;

String name110m = vector110m.get(dataPointer -2)

dataPointer = dataPointer + 3;

map110m.put(name110mm, tempScore);

}

tempCount2 = 2;

/* Create vaiable to hold size of vector400m divided by 3 */

int vector400mSize = vector400m.size() / 3;

while(vector400m != 0)

{

/* Code to calculate score for event 400m */

tempBT = B400mB – vector400m.get(dataPointer);

tempExponent = Math.pow((double)tempBT, (double)C400mC));

tempScore = A400mA * tempExponent;

–vector400mSize;

String name400m = vector400m.get(dataPointer -2)

dataPointer = dataPointer + 3;

map400m.put(name400m, tempScore);

}

tempCount2 = 2;

/* Create vaiable to hold size of vector1500m divided by 3 */

int vector1500mSize = vector1500m.size() / 3;

while(vector1500m != 0)

{

/* Code to calculate score for event 1500m */

tempBT = B1500mB – vector1500m.get(dataPointer);

tempExponent = Math.pow((double)tempBT, (double)C1500mC));

tempScore = A1500mA * tempExponent;

–vector1500mSize;

String name1500m = vector1500m.get(dataPointer -2)

dataPointer = dataPointer + 3;

map1500m.put(name1500m, tempScore);

}

tempCount2 = 2;

/* Create vaiable to hold size of vectorLong divided by 3 */

int vectorLongSize = vectorLong.size() / 3;

while(vectorLong != 0)

{

/* Code to calculate the scores for the Jumping events */

/* Code to calculate score for event Long */

tempMB = longB – vectorLong.get(dataPointer);

tempExponent = Math.pow((double)tempMB, (double)longC));

tempScore = longA * tempExponent;

–vectorLongSize;

String nameLong = vectorLong.get(dataPointer -2)

dataPointer = dataPointer + 3;

mapLong.put(nameLong, tempScore);

}

tempCount2 = 2;

/* Create vaiable to hold size of vectorHigh divided by 3 */

int vectorHighSize = vectorHigh.size() / 3;

while(vectorHigh != 0)

{

/* Code to calculate score for event High */

tempMB = highB – vectorHigh.get(dataPointer);

tempExponent = Math.pow((double)tempMB, (double)highC));

tempScore = highA * tempExponent;

–vectorHighSize;

String nameHigh = vectorHigh.get(dataPointer -2)

dataPointer = dataPointer + 3;

mapHigh.put(nameHigh, tempScore);

}

tempCount2 = 2;

/* Create vaiable to hold size of vectorPole divided by 3 */

int vectorPoleSize = vectorPole.size() / 3;

while(vectorPole != 0)

{

/* Code to calculate score for event Pole */

tempMB = poleB – vectorPole.get(dataPointer);

tempExponent = Math.pow((double)tempMB, (double)poleC));

tempScore = poleA * tempExponent;

–vectorPoleSize;

String namePole = vectorPole.get(dataPointer -2)

dataPointer = dataPointer + 3;

mapPole.put(namePole, tempScore);

}

}

public void oneLargeVector() {

/* Creation of variable int called tempLength to temporarily store the length of the maps */

int tempLength;

/* Creation of vector called vectorNames to temporarily store names */

Vector vectorNames = new Vector();

/* Make one large vector called vectorNamesAndScores to hold all calculated names and scores */

Vector vectorNamesAndScores = new Vector();

/* Code to process names and scores for map100m */

tempLength = map100m.size() -1;

vectorNames.addAll(map100m.keySet());

while (tempLength != -1) {

final1.add(vectorNames.get(tempLength));

final1.add(map100m.get(vectorNames.get(tempLength)));

–tempLength;

}

map100m.clear();

vectorNames.removeAllElements();

/* Code to process names and scores for map110m */

tempLength = map110m.size() -1;

vectorNames.addAll(map100m.keySet());

while (tempLength != -1) {

final1.add(vectorNames.get(tempLength));

final1.add(map110m.get(vectorNames.get(tempLength)));

–tempLength;

}

map110m.clear();

vectorNames.removeAllElements();

/* Code to process names and scores for map400m */

tempLength = map400m.size() -1;

vectorNames.addAll(map400m.keySet());

while (tempLength != -1) {

final1.add(vectorNames.get(tempLength));

final1.add(map400m.get(vectorNames.get(tempLength)));

–tempLength;

}

map400m.clear();

vectorNames.removeAllElements();

/* Code to process names and scores for map1500m */

tempLength = map1500m.size() -1;

vectorNames.addAll(map1500m.keySet());

while (tempLength != -1) {

final1.add(vectorNames.get(tempLength));

final1.add(map1500m.get(vectorNames.get(tempLength)));

–tempLength;

}

map1500m.clear();

vectorNames.removeAllElements();

/* Code to process names and scores for mapDiscus */

tempLength = mapDiscus.size() -1;

vectorNames.addAll(mapDiscus.keySet());

while (tempLength != -1) {

final1.add(vectorNames.get(tempLength));

final1.add(mapDiscus.get(vectorNames.get(tempLength)));

–tempLength;

}

mapDiscus.clear();

vectorNames.removeAllElements();

/* Code to process names and scores for mapJavelin */

tempLength = mapJavelin.size() -1;

vectorNames.addAll(mapJavelin.keySet());

while (tempLength != -1) {

final1.add(vectorNames.get(tempLength));

final1.add(mapJavelin.get(vectorNames.get(tempLength)));

–tempLength;

}

mapJavelin.clear();

vectorNames.removeAllElements();

/* Code to process names and scores for mapShot */

tempLength = mapShot.size() -1;

vectorNames.addAll(mapShot.keySet());

while (tempLength != -1) {

final1.add(vectorNames.get(tempLength));

final1.add(mapShot.get(vectorNames.get(tempLength)));

–tempLength;

}

mapShot.clear();

vectorNames.removeAllElements();

/* Code to process names and scores for mapLong */

tempLength = mapLong.size() -1;

vectorNames.addAll(mapLong.keySet());

while (tempLength != -1) {

final1.add(vectorNames.get(tempLength));

final1.add(mapLong.get(vectorNames.get(tempLength)));

–tempLength;

}

mapLong.clear();

vectorNames.removeAllElements();

/* Code to process names and scores for mapHigh */

tempLength = mapHigh.size() -1;

vectorNames.addAll(mapHigh.keySet());

while (tempLength != -1) {

final1.add(vectorNames.get(tempLength));

final1.add(mapHigh.get(vectorNames.get(tempLength)));

–tempLength;

}

mapHigh.clear();

vectorNames.removeAllElements();

/* Code to process names and scores for mapPole */

tempLength = mapPole.size() -1;

vectorNames.addAll(mapPole.keySet());

while (tempLength != -1) {

final1.add(vectorNames.get(tempLength));

final1.add(mapPole.get(vectorNames.get(tempLength)));

–tempLength;

}

mapPole.clear();

vectorNames.removeAllElements();

}

}