Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Shavit Borisov
- // CW
- public class SheshBesh
- {
- boolean[][] games;
- public SheshBesh()
- {
- games = new boolean[7][10];
- }
- public void updateGame(int day, int game, boolean result)
- {
- games[day][game] = result;
- }
- public boolean moreWins()
- {
- int wins = 0;
- for(int i = 0; i < 7; i++)
- for(int j = 0; j < 10; j++)
- if(games[i][j])
- wins++;
- return wins >= 35 ? true : false; // true - Hagit, false - Liron
- }
- public int luckyDay()
- {
- int wins = 0;
- int max = -1;
- int luckyDay = 0;
- for(int i = 0; i < 7; i++)
- {
- wins = 0;
- for(int j = 0; j < 10; j++)
- if(games[i][j])
- wins++;
- if(wins > max)
- {
- max = wins;
- luckyDay = i + 1;
- }
- }
- return luckyDay;
- }
- public int luckyGame()
- {
- int wins = 0;
- int max = -1;
- int luckyGame = 0;
- for(int j = 0; j < 10; j++)
- {
- wins = 0;
- for(int i = 0; i < 7; i++)
- if(!(games[i][j]))
- wins++;
- if(wins > max)
- {
- max = wins;
- luckyGame = j + 1;
- }
- }
- return luckyGame;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement