Task 4 Added comments

This commit is contained in:
Immanuel Alvaro Bhirawa 2023-03-24 11:55:16 +11:00
parent 822f040609
commit 9e33b57ce7

View File

@ -118,6 +118,12 @@ public class BlueLagoon {
public static boolean isMoveStringWellFormed(String moveString){ public static boolean isMoveStringWellFormed(String moveString){
if(!moveString.matches("[ST] \\d{1,2},\\d{1,2}"))return false; if(!moveString.matches("[ST] \\d{1,2},\\d{1,2}"))return false;
return true; return true;
// If the 1st element of moveString is neither a "S" nor a "T" return false
// if the 2nd element is not a whitespace return false
// if the 3rd and/or 4th element (as long as it is before ",") are not
// digits, return false
// if the 6th and/or 7th element (as long as it is after ",") are not digits,
// return false
} }
/** /**