Add endGame function that sets endOfGame variable to true. endGame function is run if turns == maxturn on #grow click. endOfGame is maybe an unnecessary variable. Keep for now in case end dialog boxes depend on it.
Minor changes
altered climateChange function with if else statement. IF Fran wants auto-created climateArray, set autoFill to true. If she wants to manually enter values, set to false.
Add set bonus payments section to global variables, create bonusOne and bonusTwo
Add Real Dollars Earned section to show and set initial dollars earned.
Fix makeThresholdArray function so that thresholdArray fills in using i-1 and flexibly manual-or-auto value of climateArray
Add function to calculate the Indifference Point, where A and B are equally good choices considering the probability of dry weather. Function triggers an alert if the indifference point is greater than 1 or less than 0.
First pass at creating a test function for Fran to use to test the game. I want it to work in the console, but it doesnt yet.
Altered value inside span dollars_counter
Work in progress on a function that finds the turn at which the indifference point is achieved or passed
Completed sequence of functions that calculates expected points made during random play, totalRandomPoints. This is bonus one.
Changed all turnProbability references to pWet for consistency with pDry
Finished first pass at calculateOptimalPlayPoints, with 4 if-else statements that calculate the first and then the second optimal choice points
Refactored code so that else-if statements inside calculateOptimalPlayPoints RUN the functions that calculate optimal choice point arrays, instead of just listing them. Those functions are now listed above calculateOptimalPlayPoints.
All math in bonus calculation section working correctly according to doublechecking in Excel. However, totalOptimalPoints cannot exceed maxScore, and current it does. WTF.
Changing for loop to read i > indifferentTurn && i < maxturn + 1 causes NaN to result. Noting that this change caused NaN. Will now try to fix the length of optimalChoice2, which was causing optimalPoints to exceed maxScore, without resulting in NaN.
Tonys suggestions for optimalChoice function with parameters, pass in min max indifferentTurn pDry pWet payoutDry and payoutWet as arguments
Lines 260 through 410 not working, for loop inside optimalChoice function overwriting 0s with undefined