Skip to content

Commit 176efa3

Browse files
committed
fixed final winner message
1 parent 953016e commit 176efa3

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

ch13/War.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ public static void main(String[] args) {
7171
}
7272

7373
}
74+
7475
System.out.println("size of p1: "+p1.size());
7576
System.out.println("size of p2: "+p2.size());
7677
System.out.println("size of warList: "+warList.size());
@@ -80,8 +81,10 @@ public static void main(String[] args) {
8081
// display the winner
8182
if (p2.isEmpty()) {
8283
System.out.println("Player 1 wins!");
83-
} else {
84+
} else if (p1.isEmpty()) {
8485
System.out.println("Player 2 wins!");
86+
} else {
87+
System.out.println("TIE!");
8588
}
8689
}
8790

0 commit comments

Comments
 (0)