rt300@0
|
1 //
|
rt300@0
|
2 // TestController.mm
|
rt300@0
|
3 // tweakathlon
|
rt300@0
|
4 //
|
rt300@0
|
5 // Created by Robert Tubb on 16/01/2014.
|
rt300@0
|
6 //
|
rt300@0
|
7 //
|
rt300@0
|
8
|
rt300@0
|
9 #include "TestController.h"
|
rt300@0
|
10 const int TestController::numDifferentTests = 80;
|
rt300@0
|
11 const int TestController::totalNumTests = 80;
|
rt300@0
|
12
|
rt300@0
|
13
|
rt300@0
|
14 vector<vector <bool> > makeCombinations(){
|
rt300@0
|
15 // make all unordered pairs
|
rt300@0
|
16 int N = TOTAL_NUM_PARAMS;
|
rt300@0
|
17
|
rt300@0
|
18 vector<vector <bool> > table;
|
rt300@0
|
19 for(int n=0; n < N-1; n++){
|
rt300@0
|
20
|
rt300@0
|
21 vector<bool> c(6, false);
|
rt300@0
|
22 for(int m=n+1; m<N; m++){
|
rt300@0
|
23
|
rt300@0
|
24 // reset all to false
|
rt300@0
|
25 for(int i=0; i<N; i++){
|
rt300@0
|
26 c[i] = false;
|
rt300@0
|
27 }
|
rt300@0
|
28
|
rt300@0
|
29 c[n] = true;
|
rt300@0
|
30 c[m] = true;
|
rt300@0
|
31
|
rt300@0
|
32 table.push_back(c);
|
rt300@0
|
33
|
rt300@0
|
34 }
|
rt300@0
|
35
|
rt300@0
|
36 }
|
rt300@0
|
37 return table;
|
rt300@0
|
38 }
|
rt300@22
|
39
|
rt300@0
|
40 //----------------------------------------------------------------------------------------
|
rt300@0
|
41
|
rt300@0
|
42 void TestController::generate2DRandomTests(){
|
rt300@0
|
43
|
rt300@0
|
44 controlPanelType panelType;
|
rt300@0
|
45 int numDimensions = 2;
|
rt300@0
|
46
|
rt300@0
|
47 vector<vector <bool> > ap = makeCombinations();
|
rt300@0
|
48 // 4 tests for each
|
rt300@0
|
49 int testsPerSpace = 2;
|
rt300@0
|
50 int numTests = 2 * testsPerSpace * ap.size();
|
rt300@0
|
51 int testNum = testList.size();
|
rt300@0
|
52 panelType = REVISITABLE;
|
rt300@0
|
53 for(int i=0;i<numTests/2; i++){
|
rt300@0
|
54 char letter = char(testNum+65);
|
rt300@0
|
55
|
rt300@0
|
56 testList.push_back(Test(letter,20, panelType, numDimensions, ap[floor(i/testsPerSpace)]));
|
rt300@0
|
57 testNum++;
|
rt300@0
|
58 }
|
rt300@0
|
59 panelType = SIMULTANEOUS;
|
rt300@0
|
60 for(int i=numTests/2+1;i<numTests; i++){
|
rt300@0
|
61 char letter = char(i+65);
|
rt300@0
|
62
|
rt300@0
|
63 testList.push_back(Test(letter,20, panelType, numDimensions, ap[floor((i-numTests/2)/testsPerSpace)]));
|
rt300@0
|
64
|
rt300@0
|
65 }
|
rt300@0
|
66 };
|
rt300@0
|
67 //------------------------------------------
|
rt300@0
|
68 // much better contruction!
|
rt300@0
|
69 void TestController::generateSomeTests(int howManyTests,
|
rt300@0
|
70 int numDimensions,
|
rt300@0
|
71 controlPanelType panelType,
|
rt300@0
|
72 int whichSpace,
|
rt300@0
|
73 bool scored,
|
rt300@0
|
74 bool aHint,
|
rt300@0
|
75 bool aMemoryTest){
|
rt300@0
|
76 int testNum = testList.size();
|
rt300@0
|
77
|
rt300@2
|
78 vector<bool> adjustables = makeVector(false, false, false, false, false, false, false, false);
|
rt300@2
|
79 vector<int> target = makeVector(40,64, 10, 74, 21, 80,45 ,45 ); // the default target
|
rt300@0
|
80
|
rt300@0
|
81 // big if - good spaces for each num of dimensions
|
rt300@0
|
82 if(numDimensions == 1){
|
rt300@0
|
83 // def 64,64, 30, 55, 42, 43;
|
rt300@0
|
84
|
rt300@0
|
85 adjustables[whichSpace-1] = true;
|
rt300@0
|
86
|
rt300@0
|
87 }else if(numDimensions == 2){
|
rt300@0
|
88
|
rt300@0
|
89 if (whichSpace == 1){
|
rt300@2
|
90 target = makeVector(64,64, 30, 55, 40, 43, 0, 0);
|
rt300@0
|
91 adjustables[0] = true; // pitch
|
rt300@0
|
92 adjustables[3] = true; // decay
|
rt300@0
|
93 }else if(whichSpace == 2){
|
rt300@0
|
94
|
rt300@0
|
95
|
rt300@2
|
96 target = makeVector(64,64, 0, 90, 20, 127, 0, 0);
|
rt300@0
|
97 adjustables[3] = true; // decay
|
rt300@0
|
98 adjustables[5] = true; // cutoff
|
rt300@0
|
99 }else if(whichSpace == 3){
|
rt300@2
|
100 target = makeVector(56,64, 20, 64, 10, 90, 0, 0);
|
rt300@0
|
101
|
rt300@0
|
102 adjustables[1] = true; // pulse
|
rt300@0
|
103 adjustables[2] = true; // attack
|
rt300@0
|
104 }else if(whichSpace == 4){
|
rt300@2
|
105 target = makeVector(64,64, 0, 55, 40, 43, 0, 0);
|
rt300@0
|
106 adjustables[1] = true; // pulse
|
rt300@0
|
107 adjustables[4] = true; // ftype
|
rt300@0
|
108 }
|
rt300@0
|
109 }else if(numDimensions == 3){
|
rt300@0
|
110 if(whichSpace == 1){
|
rt300@2
|
111 target = makeVector(64,64, 10, 64, 41, 43, 0, 0);
|
rt300@0
|
112 adjustables[0] = true; // pitch
|
rt300@0
|
113 adjustables[3] = true; // decay
|
rt300@0
|
114 adjustables[5] = true; // cutoff
|
rt300@0
|
115 }else if(whichSpace == 2){
|
rt300@2
|
116 target = makeVector(12,64, 10, 67, 41, 64, 0, 0);
|
rt300@0
|
117 adjustables[1] = true; // pulse
|
rt300@0
|
118 adjustables[2] = true; // attack
|
rt300@0
|
119 adjustables[4] = true; // ftype
|
rt300@0
|
120 }
|
rt300@42
|
121
|
rt300@2
|
122 }else {
|
rt300@2
|
123 for (int i = 0; i < numDimensions; i++){
|
rt300@2
|
124 adjustables[i] = true; // pitch
|
rt300@2
|
125 }
|
rt300@0
|
126 }
|
rt300@2
|
127
|
rt300@2
|
128
|
rt300@0
|
129
|
rt300@0
|
130 for(int i=0; i < howManyTests; i++){
|
rt300@0
|
131 char letter = char(testNum+65);
|
rt300@0
|
132 testList.push_back(Test(letter,20, panelType, numDimensions, adjustables, target, scored, aHint, aMemoryTest));
|
rt300@0
|
133 }
|
rt300@0
|
134 }
|
rt300@0
|
135
|
rt300@0
|
136
|
rt300@0
|
137 //-------------------------------------------
|
rt300@0
|
138 void TestController::generate4DTests(){
|
rt300@0
|
139 // 4d seq - learnable??
|
rt300@0
|
140 } |