-
Notifications
You must be signed in to change notification settings - Fork 0
/
Round.java
96 lines (83 loc) · 2.39 KB
/
Round.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
package round;
import java.awt.Color;
import java.io.File;
public class Round
{
public static int numberOfRounds = 0;
private Notes notes;
private Question question;
private MultipleChoices multipleChoices;
private FreeTile freeTile;
private boolean freeTileInitialization;
private int[] getRandomInt(int maximumOfANumber, int numberOfRandomNumbers)
{
int[] randomNumbers = new int[numberOfRandomNumbers];
for(int index = 0; index < randomNumbers.length; index++)
{
randomNumbers[index] = (int)(Math.random()*(((maximumOfANumber-1)-0)+1))+0; // 0 is the minimum index so maximumOfANumber-1
}
return randomNumbers.clone();
}
public Round(int row, int column)
{
numberOfRounds++;
this.notes = new Notes(row);
this.question = new Question(row, column, getRandomInt(row, column));
this.multipleChoices = new MultipleChoices(question);
this.freeTileInitialization = false;
this.freeTile = new FreeTile(question.getRow(), question.getColumn());
}
public int getRow()
{
return question.getRow();
}
public int getColumn()
{
return question.getColumn();
}
public File getNote(int noteIndex)
{
return notes.getNotes().get(noteIndex);
}
public int getNumberOfMultipleChoices()
{
return multipleChoices.getNumberOfChoices();
}
public Color getQuestionTileColor(int row, int column)
{
return question.getPicture().getTileColor()[row][column].getColor();
}
public Color getMultipleChoicesTileColor(int row, int column, int choiceIndex) // choiceIndex < 3
{
return multipleChoices.getChoices().get(choiceIndex).getTileColor()[row][column].getColor();
}
public String getQuestionPictureToString()
{
return this.question.getPicture().toString();
}
public String getMultipleChoicesPictureToString(int choiceIndex)
{
return this.multipleChoices.getChoices().get(choiceIndex).toString();
}
public String getFreeTilePictureToString()
{
if(this.freeTileInitialization != true)
{
System.out.println("Call setFreeTilePicture(int[] userChoiceIntArray) first");
}
else
{
return this.freeTile.getPicture().toString();
}
return "Error";
}
public void setFreeTilePicture(int[] userChoiceIntArray)
{
this.freeTile.setPicture(userChoiceIntArray);
this.freeTileInitialization = true;
}
public void closeNotesFiles()
{
this.notes.closeFiles();
}
}