mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-10-16 10:55:09 +00:00
converted tabs to spaces
This commit is contained in:
1 parent
afc37306a8
commit
8e3bd6076f
4 files changed
+300
-300
No files matched your search
@@ -1,37 +1,37 @@
|
||||
package defactored3;
|
||||
|
||||
public class TennisGame {
|
||||
|
||||
private int p2;
|
||||
private int p1;
|
||||
private String p1N;
|
||||
private String p2N;
|
||||
|
||||
private int p2;
|
||||
private int p1;
|
||||
private String p1N;
|
||||
private String p2N;
|
||||
|
||||
public TennisGame(String p1N, String p2N) {
|
||||
this.p1N = p1N;
|
||||
this.p2N = p2N;
|
||||
}
|
||||
public TennisGame(String p1N, String p2N) {
|
||||
this.p1N = p1N;
|
||||
this.p2N = p2N;
|
||||
}
|
||||
|
||||
public String getScore() {
|
||||
String s;
|
||||
if (p1 < 4 && p2 < 4) {
|
||||
String[] p = new String[]{"Love", "Fifteen", "Thirty", "Forty"};
|
||||
s = p[p1];
|
||||
return (p1 == p2) ? s + "-All" : s + "-" + p[p2];
|
||||
} else {
|
||||
if (p1 == p2)
|
||||
return "Deuce";
|
||||
s = p1 > p2 ? p1N : p2N;
|
||||
return ((p1-p2)*(p1-p2) == 1) ? "Advantage " + s : "Win for " + s;
|
||||
}
|
||||
}
|
||||
|
||||
public void wonPoint(String playerName) {
|
||||
if (playerName == "player1")
|
||||
this.p1 += 1;
|
||||
else
|
||||
this.p2 += 1;
|
||||
|
||||
}
|
||||
public String getScore() {
|
||||
String s;
|
||||
if (p1 < 4 && p2 < 4) {
|
||||
String[] p = new String[]{"Love", "Fifteen", "Thirty", "Forty"};
|
||||
s = p[p1];
|
||||
return (p1 == p2) ? s + "-All" : s + "-" + p[p2];
|
||||
} else {
|
||||
if (p1 == p2)
|
||||
return "Deuce";
|
||||
s = p1 > p2 ? p1N : p2N;
|
||||
return ((p1-p2)*(p1-p2) == 1) ? "Advantage " + s : "Win for " + s;
|
||||
}
|
||||
}
|
||||
|
||||
public void wonPoint(String playerName) {
|
||||
if (playerName == "player1")
|
||||
this.p1 += 1;
|
||||
else
|
||||
this.p2 += 1;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user