debug \t or \r problemes in puzzles answer

This commit is contained in:
jeffcheasey88 2023-09-19 19:57:46 +02:00
parent cfd0114590
commit 33a23af493
2 changed files with 6 additions and 3 deletions

View file

@ -65,9 +65,9 @@ public class Completion{
public void addTry(Puzzle currentPuzzle, byte[] response) {
if (score <= 0){
tries++;
System.out.println("debug try");
System.out.println("Puzzle anwer:");
System.out.println(Arrays.toString(currentPuzzle.getSoluce()));
System.out.println(Arrays.toString(response));
System.out.println(new String(currentPuzzle.getSoluce()));
if (response != null && Arrays.equals(currentPuzzle.getSoluce(), response)) {
if (tries > 1) { // Loose 5% each try with a minimum of 1 for score
score = (int) Math.ceil(currentPuzzle.getScoreMax() * (1 - ((tries - 1) / 20.)));

View file

@ -134,8 +134,11 @@ class ReceivedResponse {
puzzleId = Integer.parseInt(matcher.group(1));
List<String> multiPartData = reader.readMultiPartData();
if (multiPartData != null && multiPartData.size() > 0) {
if (multiPartData != null && multiPartData.size() > 0){
this.response = multiPartData.get(0).getBytes();
System.out.println("Puzzle response:");
System.out.println(Arrays.toString(response));
System.out.println(new String(response));
if (multiPartData.size() == 3) {
this.fileName = multiPartData.get(1);
this.sourceCode = multiPartData.get(2).getBytes();