David Cosner
I plan to be able to learn how to better apply functions and applications to a user's interactivity with an application created from copying and pasting a code. Eventually once I've learned exactly how the code works and what applies to what through the use of analysis and small tweaks to the code itself I hope to be able to teach this prospect as well. The coding aspect at this point is in fact my weakest area in the use of flash, and with this project I feel I can get around that. The structure of the application will remain virtually the same, while the look and aesthetics will change to something a little more quirky. All in all I hope to be able to incorporate all of the artistic and programmable aspects that I've learned over the time I've spent in this class into one single project that spans a primarily mathematical function.
| Art: |
The art I plan on using for this will consist of typically weird and / or "scary" themes, centered around a rotoscoped video of a few oddities for loser doors as well as a less quintessentially "scary" object behind the winner door. On top of this I hope to change the background to utilize an illusion of reflective imagery as well as possibly animated movie clips of strange and distracting things to happen. Finally, I hope for there to be highlights and lowlights as well as shadowing to give a cartoony look to it, while maintaining good artwork. The use of symbols will be abundant and hopefully the new application will be interesting and fun. |
| Math: |
The math in this application is centered around one thing specifically… probability. This probability is known as the "Monty Hall Door" problem in which the user can make a single choice between 1 of 3 doors, at which point a losing door is opened… the user can then choose to switch between the doors, or stay on the door he picked. One door has a winning object, and the other door has a losing object in it. The probability of this matter has to be expressed by picking a number between 0 and 2 to determine 1 correct door and 2 incorrect doors, then to respond to a user interaction (click) which door has been picked and which door opens. Once one wrong door is opened the user can then click again which puts the mathematical probability into play, a win or a loss. The total winning percentage is then displayed at the bottom of the screen to show how many times the user has won by switching, and how many the user has won by staying. |
| Programming: |
The program for this begins by creating door symbol movie clips that have a static, marked, winning, and losing door pose. Once this is created, the code needs to a specific number of doors together in an array.
var numDoors:int = 3;
var doors:Array = new Array();
The number can be changed by the user by way of an input text field. Once the array is created, the coding for placement of the door array, sizing, and number of doors can begin
for (i = 0; i < num; i++) {
Now the start button and doors need an event listener for a mouse click. This will give the doors their button-like properties and start the game:
btnStartGame.addEventListener(MouseEvent.CLICK, startClicked);
After we have the event listener added, we can begin with the mathematical function that determines the probability of whether or not the doors are correct or incorrect:
correct = Math.floor(Math.random() * numDoors);
When the mathematical probability is inserted, testing can begin by using a number of trace statements that will show in the output line at the bottom of the screen whether or not the function is operating within itself with no syntax errors. (An example of a trace statement being "trace ("this function is working")"). When all bugs are worked out and the code lines are placed where they need to be to initiate the application, we can begin to play the game for the first time… Hopefully we'll win on the first try, but it's even more important that the functions work correctly. In order to have the game on a timer to reset itself after 2 seconds of display to tell you that you've clicked on the correct door, you need a code such as this one:
function resetGame():void {
This allows the doors to reset themselves after 2 seconds by giving the game a timer, set for 2 seconds, and when that timer is over it simply replaces the current game with the game that you started out with. |