started with the TicTacToe_MinMax Project. Finished the rendering of the game.
TODO: Make a playable version and add MinMax
This commit is contained in:
42
TOOLS/fileReader/reader/NumberReader.java
Normal file
42
TOOLS/fileReader/reader/NumberReader.java
Normal file
@@ -0,0 +1,42 @@
|
||||
package reader;
|
||||
|
||||
import java.io.*;
|
||||
|
||||
public class NumberReader {
|
||||
|
||||
private String path;
|
||||
int i;
|
||||
|
||||
public NumberReader(String PATH) {
|
||||
this.path = PATH;
|
||||
}
|
||||
|
||||
public int read() {
|
||||
File file = new File(path);
|
||||
|
||||
BufferedReader br;
|
||||
try {
|
||||
br = new BufferedReader(new FileReader(file));
|
||||
String st;
|
||||
while ((st = br.readLine()) != null) {
|
||||
char[] chars = st.toCharArray();
|
||||
st = "";
|
||||
for (int i = 0; i < chars.length; i++) {
|
||||
String j = "" + chars[i];
|
||||
try {
|
||||
st += Integer.parseInt(j);
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
}
|
||||
i = Integer.parseInt(st);
|
||||
}
|
||||
} catch (FileNotFoundException ex) {
|
||||
ex.printStackTrace();
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user