a war event takes place, no points are assigned
Where are the events detected? Would that be the place to assign points?
NormR1
Posting Sage
7,742 posts since Jun 2010
Reputation Points: 1,158
Solved Threads: 793
Skill Endorsements: 16
As you see the player
Sorry, I don't see where the output is wrong.
Can you explain where the problem is shown in the print out you posted?
And post an example of what the output should be.
NormR1
Posting Sage
7,742 posts since Jun 2010
Reputation Points: 1,158
Solved Threads: 793
Skill Endorsements: 16
Actually the program is correct, but what i need is what i am not able to figure out where the change should be.
That doesn't make sense to me. If the program is correct, why does it need to be changed?
Do you understand what i want to achieve?
No, can you add comments to the current output showing what it should be?
For example, current output on left, desired output to right of <<<<<:
Score: 10 - 6 <<<<<<<<<<< This should be 22-12
Where in the code does it detect the event so it can change the score as you want?
NormR1
Posting Sage
7,742 posts since Jun 2010
Reputation Points: 1,158
Solved Threads: 793
Skill Endorsements: 16
When you detect a war (line 137) you could set a boolean to mean "previous game resulted in war". Then next time through you can check that boolean to whether to score double points (and reset the boolean)
JamesCherrill
... trying to help
8,516 posts since Apr 2008
Reputation Points: 2,583
Solved Threads: 1,455
Skill Endorsements: 30
What values of what varibles tells the program that an event has happened?
When an event happens, where else in the code should the fact that there was an event change what the code does? Does there need to be a way to remember the event happened so that other code can execute differently? Some where the value of a variable needs to be set to remember the event.
NormR1
Posting Sage
7,742 posts since Jun 2010
Reputation Points: 1,158
Solved Threads: 793
Skill Endorsements: 16
Where are the return statements for the case where the first or second if statement is true?
There is ony one return statement for when neither of the if statements are true.
NormR1
Posting Sage
7,742 posts since Jun 2010
Reputation Points: 1,158
Solved Threads: 793
Skill Endorsements: 16
Look at yor logic... unless both if tests are false you never execute that return. Keep it simple and just set your variables in the if/else tests and have a single return as the last line of the method.
ps I don't see why you are returning warCards anyway - why not just treat that variable like playerScore or compScore?
JamesCherrill
... trying to help
8,516 posts since Apr 2008
Reputation Points: 2,583
Solved Threads: 1,455
Skill Endorsements: 30
Latest version has completely lost all the stuff about remembering that the previous game as a war.
(I'm finishing now for this evening, someone else will probably step in...)
JamesCherrill
... trying to help
8,516 posts since Apr 2008
Reputation Points: 2,583
Solved Threads: 1,455
Skill Endorsements: 30
In the compare() method there seems to be two sets of identical if statements. Is that intended?
That wouldn't be a normal way to write a method.
How is the program working with the new code?
NormR1
Posting Sage
7,742 posts since Jun 2010
Reputation Points: 1,158
Solved Threads: 793
Skill Endorsements: 16
Can you explain what the "war event" is and what determines it?
When a "war event" is detected you need a way to remember it so it can be used later in the program to change the way scores are changed.
NormR1
Posting Sage
7,742 posts since Jun 2010
Reputation Points: 1,158
Solved Threads: 793
Skill Endorsements: 16