Develope game branch #33
			
				
			
		
		
		
	|  | @ -94,18 +94,18 @@ public class Tournament implements Serializable { | ||||||
|     private void calcGameSchedule() { |     private void calcGameSchedule() { | ||||||
|         Collections.shuffle(participants); |         Collections.shuffle(participants); | ||||||
| 
 | 
 | ||||||
|         for (int i = 0; i < (Math.log(participants.size()) / Math.log(2)); i++) { |         for (int i = 0; i <= (Math.log(participants.size()) / Math.log(2)); i++) { | ||||||
|             List<Game> gameRound = new ArrayList<>(); |             List<Game> gameRound = new ArrayList<>(); | ||||||
|             if (i == 0) { |             if (i == 0) { | ||||||
|                 for (int j = 0; j < participants.size() - 1; j += 2) { |                 for (int j = 0; j < participants.size() - 1; j += 2) { | ||||||
|                     gameRound.add(new Game(participants.get(j), participants.get(j+1))); |                     gameRound.add(new Game(participants.get(j), participants.get(j+1))); | ||||||
|                 } |                 } | ||||||
|                 gameList.add(gameRound); |  | ||||||
|             } else { |             } else { | ||||||
|                 for (int j = 0; j < (participants.size() / Math.pow(2,i)); j++) { |                 for (int j = 0; j < (participants.size() / Math.pow(2,i)); j++) { | ||||||
|                     gameRound.add(new Game(null,null)); |                     gameRound.add(new Game(null,null)); | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|  |             gameList.add(gameRound); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  | @ -37,11 +37,17 @@ public class GameDecorator { | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     public String getParticipantOne() { |     public String getParticipantOne() { | ||||||
|         return game.getParticipant1().getName(); |         if (game.getParticipant1() != null) { | ||||||
|  |             return game.getParticipant1().getName(); | ||||||
|  |         } | ||||||
|  |         return "1"; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     public String getParticipantTwo() { |     public String getParticipantTwo() { | ||||||
|         return game.getParticipant2().getName(); |         if (game.getParticipant2() != null) { | ||||||
|  |             return game.getParticipant2().getName(); | ||||||
|  |         } | ||||||
|  |         return "2"; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     public Place getLocation() { |     public Place getLocation() { | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue