category fix

main
Jens 2024-05-06 15:57:22 +02:00
parent 40ff3b0779
commit e2b89266b1
15 changed files with 30 additions and 30 deletions

View File

@ -26,7 +26,7 @@ public class Category {
return scored;
}
public int getScore(){
public int getScore(int[] values){
return score;
}

View File

@ -20,11 +20,11 @@ public class Fives extends Category{
}
@Override
public int getScore(){
public int getScore(int[] values){
int score = 0;
for(int i : player.getDice().getValues()){
for(int i : values){
if( i == 5 ){
score += i;
score += 5;
}
}
return score;

View File

@ -34,7 +34,7 @@ public class FourPairs extends Category{
}
@Override
public int getScore(){
public int getScore(int[] values){
if(one == 4){
return 4;
}

View File

@ -20,11 +20,11 @@ public class Fours extends Category{
}
@Override
public int getScore(){
public int getScore(int[] values){
int score = 0;
for(int i : player.getDice().getValues()){
for(int i : values){
if( i == 4 ){
score += i;
score += 4;
}
}
return score;

View File

@ -33,7 +33,7 @@ public class FullHouse extends Category{
}
@Override
public int getScore(){
public int getScore(int[] values){
return 30;
}

View File

@ -20,11 +20,11 @@ public class Ones extends Category{
}
@Override
public int getScore(){
public int getScore(int[] values){
int score = 0;
for (int value : player.getDice().getValues()) {
if (value == 1) {
score += value;
for (int i : values) {
if (i == 1) {
score += 1;
}
}
return score;

View File

@ -11,7 +11,7 @@ public class RoyalStraightFlush extends Category{
int one = 0, two = 0, three = 0, four = 0, five = 0;
for(int i = 0; i < values.length; i++){
switch(i){
switch(values[i]){
case 1:
one += 1;
case 2:
@ -33,7 +33,7 @@ public class RoyalStraightFlush extends Category{
}
@Override
public int getScore(){
public int getScore(int[] values){
return 45;
}
}

View File

@ -20,11 +20,11 @@ public class Sixes extends Category{
}
@Override
public int getScore(){
public int getScore(int[] values){
int score = 0;
for(int i : player.getDice().getValues()){
for(int i : values){
if( i == 6 ){
score += i;
score += 6;
}
}
return score;

View File

@ -11,7 +11,7 @@ public class StraightFlush extends Category{
int one = 0, two = 0, three = 0, four = 0, five = 0;
for(int i = 0; i < values.length; i++){
switch(i){
switch(values[i]){
case 1:
one += 1;
case 2:
@ -33,7 +33,7 @@ public class StraightFlush extends Category{
}
@Override
public int getScore(){
public int getScore(int[] values){
return 35;
}
}

View File

@ -34,7 +34,7 @@ public class ThreePairs extends Category{
}
@Override
public int getScore(){
public int getScore(int[] values){
if(one == 4){
return 4;

View File

@ -20,11 +20,11 @@ public class Threes extends Category{
}
@Override
public int getScore(){
public int getScore(int[] values){
int score = 0;
for(int i : player.getDice().getValues()){
for(int i : values){
if( i == 3 ){
score += i;
score += 3;
}
}
return score;

View File

@ -36,7 +36,7 @@ public class TwoPairs extends Category{
}
@Override
public int getScore(){
public int getScore(int[] values){
if(one == 2){
return 2;

View File

@ -20,11 +20,11 @@ public class Twos extends Category{
}
@Override
public int getScore(){
public int getScore(int[] values){
int score = 0;
for(int i : player.getDice().getValues()){
for(int i : values){
if( i == 2 ){
score += i;
score += 2;
}
}
return score;

View File

@ -33,7 +33,7 @@ public class Yatzy extends Category{
}
@Override
public int getScore(){
public int getScore(int[] values){
return 75;
}
}

View File

@ -10,7 +10,7 @@ public class Yatzy_Sheet {
public void addScore(int categoryNumber, int score){
for(int i = 0; i < 14; i++){
if(i == categoryNumber){
tabelle[i] = categoryNumber;
tabelle[i] = score;
}
}
}