Author | Message |
---|---|
Eric Liao
Posts: 158
|
Posted 17:07 Mar 11, 2014 |
A few questions I got today are all pointing to the player variable in calculateMoney method. In calculateMoney method under AI_Teplate.java, you have a few parameters:
This variable is only going to be 1 or 2 indicating whether your bot is currently playing as player 1 or player 2. What is important because you have to assign myMoney and theirMoney at the end of this method. Say for example, player is equal to 1, which means your bot is playing as player 1. Then, you would need to assign myMoney equals to first_money and theirMoney equals to second_money. Remember that I have this first_money and second_money in the code that is going to be the money from the first player, and the second money from the second player. Reuse them wisely. But, that is not finished yet. At the end we only return the result as an array. Check the comment closely, we have to return the array in the correct format. The format is the first item in the result array is myMoney, second item in this array is theirMoney, and third item in this array is tieBreaker. And after you assigning them correctly, the rest of my code should take care of it.
|
ladodgersfan
Posts: 13
|
Posted 21:35 Mar 11, 2014 |
i have a problem returning the right amount of money according to the player if the player is 1, the tester returns the right result but when the player is two it does not. can anyone tell me what is wrong, i just need this to finish static int[] calculateMoney(int player, int[] first_moves, if (player == 1) first_money = result[0]; else if (player == 2)
}
return result;
|
Eric Liao
Posts: 158
|
Posted 21:38 Mar 11, 2014 |
You need to assign money to result not result to money. |