reset password
Author Message
lakerfan94
Posts: 143
Posted 21:16 Mar 05, 2014 |

When doing the JUnit test for the AI template, what's the initial amount of money each player  has?

Eric Liao
Posts: 158
Posted 21:24 Mar 05, 2014 |

Initial amount of money is 100 for both player.

ytsai8
Posts: 47
Posted 21:26 Mar 05, 2014 |

Initialize 100 in your method, so you don't have to initialize again in JUnit Test (and so you can calculate the results?).

You are suppose to calculate the result by this method, so there should not be any initialization in the process of calling the method too o.O

Eric Liao
Posts: 158
Posted 21:34 Mar 05, 2014 |

Initialize both player's money as 100 in the method.

Since this method is a static method, you don't need to initialize/create the object to use the static method. Next week I will go over the detail of static vs instance using java example.

So, in your calculateMoney. You would need to initialize the p1money to be 100, p2 money to be 100 too.

At the end you return an array of integer containing p1money, p2money, and who has the tie breaker later.