53 lines
1.7 KiB
Java
53 lines
1.7 KiB
Java
import java.io.*;
|
|
import java.io.IOException;
|
|
import java.nio.file.Files;
|
|
import java.nio.file.Path;
|
|
|
|
public class tuer2 {
|
|
|
|
public static void main(String[] args) throws IOException {
|
|
String input = Files.readString(Path.of(args[0]));
|
|
|
|
int multiplier=5;
|
|
if(args.length>1) multiplier = Integer.parseInt(args[1]);
|
|
|
|
int score = 0;
|
|
int realScore = 0;
|
|
int tmp = 0;
|
|
|
|
for(int i=0;i <= (input.length()/multiplier); i++) {
|
|
tmp++;
|
|
switch(input.charAt(i*multiplier)) {
|
|
case 'A':
|
|
switch(input.charAt((i*multiplier) + 2)) {
|
|
case 'X': score += 4; realScore += 3; break;
|
|
case 'Y': score += 8; realScore += 4; break;
|
|
case 'Z': score += 3; realScore += 8; break;
|
|
default: throw new IOException("Hilfe. i=" + i);
|
|
}
|
|
break;
|
|
case 'B':
|
|
switch(input.charAt((i*multiplier) + 2)) {
|
|
case 'X': score += 1; realScore += 1; break;
|
|
case 'Y': score += 5; realScore += 5; break;
|
|
case 'Z': score += 9; realScore += 9; break;
|
|
default: throw new IOException("Hilfe. i=" + i);
|
|
}
|
|
break;
|
|
case 'C':
|
|
switch(input.charAt((i*multiplier) + 2)) {
|
|
case 'X': score += 7; realScore += 2; break;
|
|
case 'Y': score += 2; realScore += 6; break;
|
|
case 'Z': score += 6; realScore += 7; break;
|
|
default: throw new IOException("Hilfe. i=" + i);
|
|
}
|
|
break;
|
|
default: throw new IOException("Hilfe. i=" + i);
|
|
}
|
|
}
|
|
|
|
System.out.println("Your final score, my master! ~UwU : " + score);
|
|
System.out.println("W- Wait master! OwO' Here is your number of iterations! ^.^ : " + tmp);
|
|
System.out.println("Hold on m- master. One last time! This is it! Really UwU~~ : " + realScore);
|
|
}
|
|
} |