|
001 packagepackage is used to name the directory or folder a class is in Derrick;
002
003 importimport means to make the classes and/or packages available in this program fang.*;
004 importimport means to make the classes and/or packages available in this program java.awt.*;
005 importimport means to make the classes and/or packages available in this program java.awt.geom.*;
006
007 /**
008 * All about my game.
009 * @authorthis is the Javadoc tag for documenting who created the source code Derrick Dixon
010 */
011 publicpublic is used to indicate unrestricted access (any other class can have access) classclass is a group of fields and methods used for making objects Assignmentfivemontyhall extendsextends means to customize or extend the functionality of a class Game
012 {open braces start code blocks and must be matched with a close brace
013
014 privateprivate is used to restrict access to the current class only StringSprite pickadoor;
015 privateprivate is used to restrict access to the current class only StringSprite pickagain;
016 privateprivate is used to restrict access to the current class only Sound clapping;
017 privateprivate is used to restrict access to the current class only intint is the type for whole numbers and it is short for integer numClicks;
018 privateprivate is used to restrict access to the current class only intint is the type for whole numbers and it is short for integer prize;
019 privateprivate is used to restrict access to the current class only ImageSprite money;
020 privateprivate is used to restrict access to the current class only ImageSprite shark1;
021 privateprivate is used to restrict access to the current class only ImageSprite shark2;
022 privateprivate is used to restrict access to the current class only StringSprite winner;
023 privateprivate is used to restrict access to the current class only StringSprite loser;
024 privateprivate is used to restrict access to the current class only ImageSprite doorright;
025 privateprivate is used to restrict access to the current class only ImageSprite doormiddle;
026 privateprivate is used to restrict access to the current class only ImageSprite doorleft;
027 privateprivate is used to restrict access to the current class only StringSprite door1;
028 privateprivate is used to restrict access to the current class only StringSprite door2;
029 privateprivate is used to restrict access to the current class only StringSprite door3;
030 privateprivate is used to restrict access to the current class only StringSprite playagain;
031
032 /**sets up the game*/
033 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value setup()
034 {open braces start code blocks and must be matched with a close brace
035
036
037 numClicks++this is the increment operator, which increases the variable by 1;
038
039 clapping=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor Sound("Applause2.wav");
040
041 money=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ImageSprite("Money.jpg");
042 money.setSize(0.20);
043 addSprite(money);
044
045
046 shark1=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ImageSprite("Shark.jpg");
047 shark1.setSize(0.20);
048 addSprite(shark1);
049
050 shark2=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ImageSprite("Shark.jpg");
051 shark2.setSize(0.20);
052 addSprite(shark2);
053
054 doorleft=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ImageSprite("Door123444.jpg ");
055 doorleft.setSize(0.50);
056 doorleft.setLocation(0.2, 0.5);
057 addSprite(doorleft);
058
059
060 doormiddle=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ImageSprite("Door123444.jpg ");
061 doormiddle.setSize(0.50);
062 doormiddle.setLocation(0.5, 0.5);
063 addSprite(doormiddle);
064
065
066 doorright=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor ImageSprite("Door123444.jpg ");
067 doorright.setSize(0.50);
068 doorright.setLocation(0.8, 0.5);
069 addSprite(doorright);
070
071
072 winner=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor StringSprite("You Win");
073 winner.setColor(Palette.getColor("White"));
074 winner.setSize(0.40);
075 winner.bottomJustify();
076 winner.setLocation(0.5,0.95);
077 addSprite(winner);
078 winner.setVisible(falsefalse is a value for the boolean type and means not true);
079
080 loser=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor StringSprite("You Lose");
081 loser.setColor(Palette.getColor("White"));
082 loser.setSize(0.40);
083 loser.bottomJustify();
084 loser.setLocation(0.5,0.95);
085 addSprite(loser);
086 loser.setVisible(falsefalse is a value for the boolean type and means not true);
087
088
089 pickadoor=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor StringSprite("Press Sound then Start & Pick any Door");
090 pickadoor.setColor(Palette.getColor("White"));
091 pickadoor.setSize(0.80);
092 pickadoor.bottomJustify();
093 pickadoor.setLocation(0.5,0.95);
094 addSprite(pickadoor);
095 pickadoor.setVisible(truetrue is the boolean value that is the opposite of false);
096
097 pickagain=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor StringSprite("Stay or Pick Another Door");
098 pickagain.setColor(Palette.getColor("White"));
099 pickagain.setSize(0.50);
100 pickagain.bottomJustify();
101 pickagain.setLocation(0.5,0.90);
102 addSprite(pickagain);
103 pickagain.setVisible(falsefalse is a value for the boolean type and means not true);
104
105 playagain=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor StringSprite("Click Reload and Start to Play Again");
106 playagain.setColor(Palette.getColor("White"));
107 playagain.setSize(0.50);
108 playagain.topJustify();
109 playagain.setLocation(0.5, 0.05);
110 addSprite(playagain);
111 playagain.setVisible(falsefalse is a value for the boolean type and means not true);
112
113
114 door1=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor StringSprite("1");
115 door1.setColor(Palette.getColor("White"));
116 door1.setSize(0.05);
117 door1.setLocation(0.2, 0.12);
118 addSprite(door1);
119
120 door2=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor StringSprite("2");
121 door2.setColor(Palette.getColor("White"));
122 door2.setSize(0.05);
123 door2.setLocation(0.5, 0.12);
124 addSprite(door2);
125
126 door3=this assignment operator makes the left side equal to the right sidenewnew is used to create objects by calling the constructor StringSprite("3");
127 door3.setColor(Palette.getColor("White"));
128 door3.setSize(0.05);
129 door3.setLocation(0.8, 0.12);
130 addSprite(door3);
131
132 prize=this assignment operator makes the left side equal to the right siderandom.nextInt(3)+adds two numbers together or concatenates Strings together1;
133
134 ifif executes the next statement only if the condition in parenthesis evaluates to true(prize==this is the comparison operator which evaluates to true if both sides are the same1)
135 {open braces start code blocks and must be matched with a close brace
136 money.setLocation(0.2, 0.5);
137 shark1.setLocation(0.5, 0.5);
138 shark2.setLocation(0.8, 0.5);
139 }close braces end code blocks and must match an earlier open brace
140 ifif executes the next statement only if the condition in parenthesis evaluates to true(prize==this is the comparison operator which evaluates to true if both sides are the same2)
141 {open braces start code blocks and must be matched with a close brace
142 shark2.setLocation(0.2, 0.5);
143 money.setLocation(0.5, 0.5);
144 shark1.setLocation(0.8, 0.5);
145 }close braces end code blocks and must match an earlier open brace
146 ifif executes the next statement only if the condition in parenthesis evaluates to true(prize==this is the comparison operator which evaluates to true if both sides are the same3)
147 {open braces start code blocks and must be matched with a close brace
148
149 shark1.setLocation(0.2, 0.5);
150 shark2.setLocation(0.5, 0.5);
151 money.setLocation(0.8, 0.5);
152
153 }close braces end code blocks and must match an earlier open brace
154 }close braces end code blocks and must match an earlier open brace
155 /**handle input and game events*/
156 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value advance()
157 {open braces start code blocks and must be matched with a close brace
158
159 ifif executes the next statement only if the condition in parenthesis evaluates to true (numClicks==this is the comparison operator which evaluates to true if both sides are the same1)
160
161 {open braces start code blocks and must be matched with a close brace
162 ifif executes the next statement only if the condition in parenthesis evaluates to true (prize==this is the comparison operator which evaluates to true if both sides are the same1)
163 {open braces start code blocks and must be matched with a close brace
164 ifif executes the next statement only if the condition in parenthesis evaluates to true (getClick2D()!=this is the not equals operator which evaluates to true if both sides are differentnullnull is the value used to refer to a non-existant object &this performs a bit-wise and (not the same as boolean and which is &&)&this performs a bit-wise and (not the same as boolean and which is &&) doorleft.intersects(getClick2D()))
165 {open braces start code blocks and must be matched with a close brace
166 doorright.setVisible(falsefalse is a value for the boolean type and means not true);
167 door3.setVisible(falsefalse is a value for the boolean type and means not true);
168 pickadoor.setVisible(falsefalse is a value for the boolean type and means not true);
169 pickagain.setVisible(truetrue is the boolean value that is the opposite of false);
170 numClicks=this assignment operator makes the left side equal to the right side2;
171 }close braces end code blocks and must match an earlier open brace
172 ifif executes the next statement only if the condition in parenthesis evaluates to true (getClick2D()!=this is the not equals operator which evaluates to true if both sides are differentnullnull is the value used to refer to a non-existant object &this performs a bit-wise and (not the same as boolean and which is &&)&this performs a bit-wise and (not the same as boolean and which is &&) doormiddle.intersects(getClick2D()))
173 {open braces start code blocks and must be matched with a close brace
174 doorright.setVisible(falsefalse is a value for the boolean type and means not true);
175 door3.setVisible(falsefalse is a value for the boolean type and means not true);
176
177 pickadoor.setVisible(falsefalse is a value for the boolean type and means not true);
178 pickagain.setVisible(truetrue is the boolean value that is the opposite of false);
179 numClicks=this assignment operator makes the left side equal to the right side2;
180 }close braces end code blocks and must match an earlier open brace
181 ifif executes the next statement only if the condition in parenthesis evaluates to true (getClick2D()!=this is the not equals operator which evaluates to true if both sides are differentnullnull is the value used to refer to a non-existant object &this performs a bit-wise and (not the same as boolean and which is &&)&this performs a bit-wise and (not the same as boolean and which is &&) doorright.intersects(getClick2D()))
182 {open braces start code blocks and must be matched with a close brace
183 doormiddle.setVisible(falsefalse is a value for the boolean type and means not true);
184 door2.setVisible(falsefalse is a value for the boolean type and means not true);
185
186 pickadoor.setVisible(falsefalse is a value for the boolean type and means not true);
187 pickagain.setVisible(truetrue is the boolean value that is the opposite of false);
188 numClicks=this assignment operator makes the left side equal to the right side2;
189 }close braces end code blocks and must match an earlier open brace
190 }close braces end code blocks and must match an earlier open brace
191 ifif executes the next statement only if the condition in parenthesis evaluates to true (prize==this is the comparison operator which evaluates to true if both sides are the same2)
192 {open braces start code blocks and must be matched with a close brace
193 ifif executes the next statement only if the condition in parenthesis evaluates to true (getClick2D()!=this is the not equals operator which evaluates to true if both sides are differentnullnull is the value used to refer to a non-existant object &this performs a bit-wise and (not the same as boolean and which is &&)&this performs a bit-wise and (not the same as boolean and which is &&) doorleft.intersects(getClick2D()))
194 {open braces start code blocks and must be matched with a close brace
195 doorright.setVisible(falsefalse is a value for the boolean type and means not true);
196 door3.setVisible(falsefalse is a value for the boolean type and means not true);
197
198 pickadoor.setVisible(falsefalse is a value for the boolean type and means not true);
199 pickagain.setVisible(truetrue is the boolean value that is the opposite of false);
200 numClicks=this assignment operator makes the left side equal to the right side2;
201 }close braces end code blocks and must match an earlier open brace
202 ifif executes the next statement only if the condition in parenthesis evaluates to true (getClick2D()!=this is the not equals operator which evaluates to true if both sides are differentnullnull is the value used to refer to a non-existant object &this performs a bit-wise and (not the same as boolean and which is &&)&this performs a bit-wise and (not the same as boolean and which is &&) doormiddle.intersects(getClick2D()))
203 {open braces start code blocks and must be matched with a close brace
204 doorleft.setVisible(falsefalse is a value for the boolean type and means not true);
205 door1.setVisible(falsefalse is a value for the boolean type and means not true);
206
207 pickadoor.setVisible(falsefalse is a value for the boolean type and means not true);
208 pickagain.setVisible(truetrue is the boolean value that is the opposite of false);
209 numClicks=this assignment operator makes the left side equal to the right side2;
210 }close braces end code blocks and must match an earlier open brace
211 ifif executes the next statement only if the condition in parenthesis evaluates to true (getClick2D()!=this is the not equals operator which evaluates to true if both sides are differentnullnull is the value used to refer to a non-existant object &this performs a bit-wise and (not the same as boolean and which is &&)&this performs a bit-wise and (not the same as boolean and which is &&) doorright.intersects(getClick2D()))
212 {open braces start code blocks and must be matched with a close brace
213 doorleft.setVisible(falsefalse is a value for the boolean type and means not true);
214 door1.setVisible(falsefalse is a value for the boolean type and means not true);
215
216 pickadoor.setVisible(falsefalse is a value for the boolean type and means not true);
217 pickagain.setVisible(truetrue is the boolean value that is the opposite of false);
218 numClicks=this assignment operator makes the left side equal to the right side2;
219 }close braces end code blocks and must match an earlier open brace
220 }close braces end code blocks and must match an earlier open brace
221 ifif executes the next statement only if the condition in parenthesis evaluates to true (prize==this is the comparison operator which evaluates to true if both sides are the same3)
222 {open braces start code blocks and must be matched with a close brace
223 ifif executes the next statement only if the condition in parenthesis evaluates to true (getClick2D()!=this is the not equals operator which evaluates to true if both sides are differentnullnull is the value used to refer to a non-existant object &this performs a bit-wise and (not the same as boolean and which is &&)&this performs a bit-wise and (not the same as boolean and which is &&) doorright.intersects(getClick2D()))
224 {open braces start code blocks and must be matched with a close brace
225 doormiddle.setVisible(falsefalse is a value for the boolean type and means not true);
226 door2.setVisible(falsefalse is a value for the boolean type and means not true);
227
228 pickadoor.setVisible(falsefalse is a value for the boolean type and means not true);
229 pickagain.setVisible(truetrue is the boolean value that is the opposite of false);
230 numClicks=this assignment operator makes the left side equal to the right side2;
231 }close braces end code blocks and must match an earlier open brace
232 ifif executes the next statement only if the condition in parenthesis evaluates to true (getClick2D()!=this is the not equals operator which evaluates to true if both sides are differentnullnull is the value used to refer to a non-existant object &this performs a bit-wise and (not the same as boolean and which is &&)&this performs a bit-wise and (not the same as boolean and which is &&) doormiddle.intersects(getClick2D()))
233 {open braces start code blocks and must be matched with a close brace
234 doorleft.setVisible(falsefalse is a value for the boolean type and means not true);
235 door1.setVisible(falsefalse is a value for the boolean type and means not true);
236
237 pickadoor.setVisible(falsefalse is a value for the boolean type and means not true);
238 pickagain.setVisible(truetrue is the boolean value that is the opposite of false);
239 numClicks=this assignment operator makes the left side equal to the right side2;
240 }close braces end code blocks and must match an earlier open brace
241 ifif executes the next statement only if the condition in parenthesis evaluates to true (getClick2D()!=this is the not equals operator which evaluates to true if both sides are differentnullnull is the value used to refer to a non-existant object &this performs a bit-wise and (not the same as boolean and which is &&)&this performs a bit-wise and (not the same as boolean and which is &&) doorleft.intersects(getClick2D()))
242 {open braces start code blocks and must be matched with a close brace
243 doormiddle.setVisible(falsefalse is a value for the boolean type and means not true);
244 door2.setVisible(falsefalse is a value for the boolean type and means not true);
245 pickadoor.setVisible(falsefalse is a value for the boolean type and means not true);
246 pickagain.setVisible(truetrue is the boolean value that is the opposite of false);
247 numClicks=this assignment operator makes the left side equal to the right side2;
248 }close braces end code blocks and must match an earlier open brace
249 }close braces end code blocks and must match an earlier open brace
250 }close braces end code blocks and must match an earlier open brace
251 elseelse is what happens when the if condition is false ifif executes the next statement only if the condition in parenthesis evaluates to true (numClicks==this is the comparison operator which evaluates to true if both sides are the same2)
252 {open braces start code blocks and must be matched with a close brace
253 ifif executes the next statement only if the condition in parenthesis evaluates to true (prize==this is the comparison operator which evaluates to true if both sides are the same1)
254 {open braces start code blocks and must be matched with a close brace
255 ifif executes the next statement only if the condition in parenthesis evaluates to true (getClick2D()!=this is the not equals operator which evaluates to true if both sides are differentnullnull is the value used to refer to a non-existant object &this performs a bit-wise and (not the same as boolean and which is &&)&this performs a bit-wise and (not the same as boolean and which is &&) doorright.intersects(getClick2D()))
256 {open braces start code blocks and must be matched with a close brace
257 doorright.setVisible(falsefalse is a value for the boolean type and means not true);
258 door3.setVisible(falsefalse is a value for the boolean type and means not true);
259 doorleft.setVisible(falsefalse is a value for the boolean type and means not true);
260 door1.setVisible(falsefalse is a value for the boolean type and means not true);
261 doormiddle.setVisible(falsefalse is a value for the boolean type and means not true);
262 door2.setVisible(falsefalse is a value for the boolean type and means not true);
263 winner.setVisible(falsefalse is a value for the boolean type and means not true);
264 playagain.setVisible(truetrue is the boolean value that is the opposite of false);
265
266 pickadoor.setVisible(falsefalse is a value for the boolean type and means not true);
267 pickagain.setVisible(falsefalse is a value for the boolean type and means not true);
268 numClicks=this assignment operator makes the left side equal to the right side0;
269 }close braces end code blocks and must match an earlier open brace
270 ifif executes the next statement only if the condition in parenthesis evaluates to true (getClick2D()!=this is the not equals operator which evaluates to true if both sides are differentnullnull is the value used to refer to a non-existant object &this performs a bit-wise and (not the same as boolean and which is &&)&this performs a bit-wise and (not the same as boolean and which is &&) doormiddle.intersects(getClick2D()))
271 {open braces start code blocks and must be matched with a close brace
272 doorright.setVisible(falsefalse is a value for the boolean type and means not true);
273 door3.setVisible(falsefalse is a value for the boolean type and means not true);
274 doorleft.setVisible(falsefalse is a value for the boolean type and means not true);
275 door1.setVisible(falsefalse is a value for the boolean type and means not true);
276 doormiddle.setVisible(falsefalse is a value for the boolean type and means not true);
277 door2.setVisible(falsefalse is a value for the boolean type and means not true);
278 loser.setVisible(truetrue is the boolean value that is the opposite of false);
279 playagain.setVisible(truetrue is the boolean value that is the opposite of false);
280 pickadoor.setVisible(falsefalse is a value for the boolean type and means not true);
281 pickagain.setVisible(falsefalse is a value for the boolean type and means not true);
282 numClicks=this assignment operator makes the left side equal to the right side0;
283
284 }close braces end code blocks and must match an earlier open brace
285 ifif executes the next statement only if the condition in parenthesis evaluates to true (getClick2D()!=this is the not equals operator which evaluates to true if both sides are differentnullnull is the value used to refer to a non-existant object &this performs a bit-wise and (not the same as boolean and which is &&)&this performs a bit-wise and (not the same as boolean and which is &&) doorleft.intersects(getClick2D()))
286 {open braces start code blocks and must be matched with a close brace
287 doorright.setVisible(falsefalse is a value for the boolean type and means not true);
288 door3.setVisible(falsefalse is a value for the boolean type and means not true);
289 doorleft.setVisible(falsefalse is a value for the boolean type and means not true);
290 door1.setVisible(falsefalse is a value for the boolean type and means not true);
291 doormiddle.setVisible(falsefalse is a value for the boolean type and means not true);
292 door2.setVisible(falsefalse is a value for the boolean type and means not true);
293 winner.setVisible(truetrue is the boolean value that is the opposite of false);
294 playagain.setVisible(truetrue is the boolean value that is the opposite of false);
295 pickadoor.setVisible(falsefalse is a value for the boolean type and means not true);
296 pickagain.setVisible(falsefalse is a value for the boolean type and means not true);
297 clapping.play();
298 numClicks=this assignment operator makes the left side equal to the right side0;
299 }close braces end code blocks and must match an earlier open brace
300
301 }close braces end code blocks and must match an earlier open brace
302 ifif executes the next statement only if the condition in parenthesis evaluates to true (prize==this is the comparison operator which evaluates to true if both sides are the same2)
303 {open braces start code blocks and must be matched with a close brace
304 ifif executes the next statement only if the condition in parenthesis evaluates to true (getClick2D()!=this is the not equals operator which evaluates to true if both sides are differentnullnull is the value used to refer to a non-existant object &this performs a bit-wise and (not the same as boolean and which is &&)&this performs a bit-wise and (not the same as boolean and which is &&) doorright.intersects(getClick2D()))
305 {open braces start code blocks and must be matched with a close brace
306 doorright.setVisible(falsefalse is a value for the boolean type and means not true);
307 door3.setVisible(falsefalse is a value for the boolean type and means not true);
308 doorleft.setVisible(falsefalse is a value for the boolean type and means not true);
309 door1.setVisible(falsefalse is a value for the boolean type and means not true);
310 doormiddle.setVisible(falsefalse is a value for the boolean type and means not true);
311 door2.setVisible(falsefalse is a value for the boolean type and means not true);
312 loser.setVisible(truetrue is the boolean value that is the opposite of false);
313 playagain.setVisible(truetrue is the boolean value that is the opposite of false);
314 pickadoor.setVisible(falsefalse is a value for the boolean type and means not true);
315 pickagain.setVisible(falsefalse is a value for the boolean type and means not true);
316 numClicks=this assignment operator makes the left side equal to the right side0;
317
318 }close braces end code blocks and must match an earlier open brace
319 ifif executes the next statement only if the condition in parenthesis evaluates to true (getClick2D()!=this is the not equals operator which evaluates to true if both sides are differentnullnull is the value used to refer to a non-existant object &this performs a bit-wise and (not the same as boolean and which is &&)&this performs a bit-wise and (not the same as boolean and which is &&) doormiddle.intersects(getClick2D()))
320 {open braces start code blocks and must be matched with a close brace
321 doorright.setVisible(falsefalse is a value for the boolean type and means not true);
322 door3.setVisible(falsefalse is a value for the boolean type and means not true);
323 doorleft.setVisible(falsefalse is a value for the boolean type and means not true);
324 door1.setVisible(falsefalse is a value for the boolean type and means not true);
325 doormiddle.setVisible(falsefalse is a value for the boolean type and means not true);
326 door2.setVisible(falsefalse is a value for the boolean type and means not true);
327 winner.setVisible(truetrue is the boolean value that is the opposite of false);
328 playagain.setVisible(truetrue is the boolean value that is the opposite of false);
329 pickadoor.setVisible(falsefalse is a value for the boolean type and means not true);
330 pickagain.setVisible(falsefalse is a value for the boolean type and means not true);
331 clapping.play();
332 numClicks=this assignment operator makes the left side equal to the right side0;
333
334 }close braces end code blocks and must match an earlier open brace
335 ifif executes the next statement only if the condition in parenthesis evaluates to true (getClick2D()!=this is the not equals operator which evaluates to true if both sides are differentnullnull is the value used to refer to a non-existant object &this performs a bit-wise and (not the same as boolean and which is &&)&this performs a bit-wise and (not the same as boolean and which is &&) doorleft.intersects(getClick2D()))
336 {open braces start code blocks and must be matched with a close brace
337 doorright.setVisible(falsefalse is a value for the boolean type and means not true);
338 door3.setVisible(falsefalse is a value for the boolean type and means not true);
339 doorleft.setVisible(falsefalse is a value for the boolean type and means not true);
340 door1.setVisible(falsefalse is a value for the boolean type and means not true);
341 doormiddle.setVisible(falsefalse is a value for the boolean type and means not true);
342 door2.setVisible(falsefalse is a value for the boolean type and means not true);
343 loser.setVisible(truetrue is the boolean value that is the opposite of false);
344 playagain.setVisible(truetrue is the boolean value that is the opposite of false);
345 pickadoor.setVisible(falsefalse is a value for the boolean type and means not true);
346 pickagain.setVisible(falsefalse is a value for the boolean type and means not true);
347 numClicks=this assignment operator makes the left side equal to the right side0;
348
349 }close braces end code blocks and must match an earlier open brace
350 }close braces end code blocks and must match an earlier open brace
351 ifif executes the next statement only if the condition in parenthesis evaluates to true (prize==this is the comparison operator which evaluates to true if both sides are the same3)
352 {open braces start code blocks and must be matched with a close brace
353 ifif executes the next statement only if the condition in parenthesis evaluates to true (getClick2D()!=this is the not equals operator which evaluates to true if both sides are differentnullnull is the value used to refer to a non-existant object &this performs a bit-wise and (not the same as boolean and which is &&)&this performs a bit-wise and (not the same as boolean and which is &&) doorleft.intersects(getClick2D()))
354 {open braces start code blocks and must be matched with a close brace
355 doorright.setVisible(falsefalse is a value for the boolean type and means not true);
356 door3.setVisible(falsefalse is a value for the boolean type and means not true);
357 doorleft.setVisible(falsefalse is a value for the boolean type and means not true);
358 door1.setVisible(falsefalse is a value for the boolean type and means not true);
359 doormiddle.setVisible(falsefalse is a value for the boolean type and means not true);
360 door2.setVisible(falsefalse is a value for the boolean type and means not true);
361 loser.setVisible(truetrue is the boolean value that is the opposite of false);
362 playagain.setVisible(truetrue is the boolean value that is the opposite of false);
363 pickadoor.setVisible(falsefalse is a value for the boolean type and means not true);
364 pickagain.setVisible(falsefalse is a value for the boolean type and means not true);
365 numClicks=this assignment operator makes the left side equal to the right side0;
366
367 }close braces end code blocks and must match an earlier open brace
368 ifif executes the next statement only if the condition in parenthesis evaluates to true (getClick2D()!=this is the not equals operator which evaluates to true if both sides are differentnullnull is the value used to refer to a non-existant object &this performs a bit-wise and (not the same as boolean and which is &&)&this performs a bit-wise and (not the same as boolean and which is &&) doormiddle.intersects(getClick2D()))
369 {open braces start code blocks and must be matched with a close brace
370 doorright.setVisible(falsefalse is a value for the boolean type and means not true);
371 door3.setVisible(falsefalse is a value for the boolean type and means not true);
372 doorleft.setVisible(falsefalse is a value for the boolean type and means not true);
373 door1.setVisible(falsefalse is a value for the boolean type and means not true);
374 doormiddle.setVisible(falsefalse is a value for the boolean type and means not true);
375 door2.setVisible(falsefalse is a value for the boolean type and means not true);
376 loser.setVisible(truetrue is the boolean value that is the opposite of false);
377 playagain.setVisible(truetrue is the boolean value that is the opposite of false);
378 pickadoor.setVisible(falsefalse is a value for the boolean type and means not true);
379 pickagain.setVisible(falsefalse is a value for the boolean type and means not true);
380 numClicks=this assignment operator makes the left side equal to the right side0;
381
382 }close braces end code blocks and must match an earlier open brace
383 ifif executes the next statement only if the condition in parenthesis evaluates to true (getClick2D()!=this is the not equals operator which evaluates to true if both sides are differentnullnull is the value used to refer to a non-existant object &this performs a bit-wise and (not the same as boolean and which is &&)&this performs a bit-wise and (not the same as boolean and which is &&) doorright.intersects(getClick2D()))
384 {open braces start code blocks and must be matched with a close brace
385 doorright.setVisible(falsefalse is a value for the boolean type and means not true);
386 door3.setVisible(falsefalse is a value for the boolean type and means not true);
387 doorleft.setVisible(falsefalse is a value for the boolean type and means not true);
388 door1.setVisible(falsefalse is a value for the boolean type and means not true);
389 doormiddle.setVisible(falsefalse is a value for the boolean type and means not true);
390 door2.setVisible(falsefalse is a value for the boolean type and means not true);
391 winner.setVisible(truetrue is the boolean value that is the opposite of false);
392 pickadoor.setVisible(falsefalse is a value for the boolean type and means not true);
393 pickagain.setVisible(falsefalse is a value for the boolean type and means not true);
394 clapping.play();
395 playagain.setVisible(truetrue is the boolean value that is the opposite of false);
396 numClicks=this assignment operator makes the left side equal to the right side0;
397
398 }close braces end code blocks and must match an earlier open brace
399 }close braces end code blocks and must match an earlier open brace
400 }close braces end code blocks and must match an earlier open brace
401 }close braces end code blocks and must match an earlier open brace
402 }close braces end code blocks and must match an earlier open brace
|