Skip to content

Euler 54 Main Routine (handtest)

package poker;
import java.io.*;

public class HandTest
{

/**
* @param args
*/
public static void main(String[] args)
{
int i = 0;
String[][] hands = new String[1000][10];
// TODO Auto-generated method stub
try
{
File myFile = new File("x:\\poker.txt");//finds file to open
FileReader fileReader = new FileReader(myFile);// prepares file for reading
BufferedReader reader = new BufferedReader(fileReader);//prepares container for reading
String line = null;
while((line = reader.readLine())!= null)//reads a line of text
{
String[] result = line.split(" ");//splits line into tokens.
for (int j = 0; j< 10; j++)
{
hands[i][j] = result[j];//stores tokens in array.

}
i++;
}
}
catch(Exception ex)
{
ex.printStackTrace();
}
int sum = 0;
for (i = 0; i < 1000; i++)
{
for (int k=0; k<10; k++)
{
System.out.print(hands[i][k]+" ");
}
System.out.println();
sum = sum + tests.testhand(hands[i]);
}
System.out.println(sum);
}

}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: