Jump to content

JAVA coding help

Azzah44100

Hey guys i need some help with this programme i am trying to write. Any help would be greatly appreciated..

so i have 3 ints w,l and d and they count the wins, losses and draws in a game of rock paper scissors. i have the calculations done but i just need a way to display a winner based on the number of wins and losses the user has and then display the winner on th screen as eaither the user , computer or a tie... if that makes any sense your contribution will help me alot..

SYSTEM SPECS

CPU> Intel 4790k< GPU> EVGA GTX970< SSD> Crucial MX200 250Gb< HDD> Seagate Barracuda 2Tb<
Cooling> Corsair H100i< Case> Corsair Air 540< PSU> Seasonic X-Series 650W< RAM> 8Gb Kingston HyperX<
Link to comment
Share on other sites

Link to post
Share on other sites

if (w > l) {    //player wins} else if (w == l) {    //tie} else {    //computer wins}

OMG thank you so much, i was up utill 3 am last night trying to get this to work... my game now works perfectly!

SYSTEM SPECS

CPU> Intel 4790k< GPU> EVGA GTX970< SSD> Crucial MX200 250Gb< HDD> Seagate Barracuda 2Tb<
Cooling> Corsair H100i< Case> Corsair Air 540< PSU> Seasonic X-Series 650W< RAM> 8Gb Kingston HyperX<
Link to comment
Share on other sites

Link to post
Share on other sites

turn notifications on, on threads you make ;)

They are usually on i dont know why i didnt get one... i was still on this page so maybe it thought i saw it already?

SYSTEM SPECS

CPU> Intel 4790k< GPU> EVGA GTX970< SSD> Crucial MX200 250Gb< HDD> Seagate Barracuda 2Tb<
Cooling> Corsair H100i< Case> Corsair Air 540< PSU> Seasonic X-Series 650W< RAM> 8Gb Kingston HyperX<
Link to comment
Share on other sites

Link to post
Share on other sites

if (w > l) {    //player wins} else if (w == l) {    //tie} else {    //computer wins}

oh hang on this works fine but the way i was trying to do it includes a boolean that prevents the outcome of the game from being displayed constantly.. say after i press a button it sets the boolean to true allowing the programme to display the out come of the game... i tried adding that to these if statements and it caused them to always disply it as the computer winning??? any suggestions?

Edited by Azzah44100

SYSTEM SPECS

CPU> Intel 4790k< GPU> EVGA GTX970< SSD> Crucial MX200 250Gb< HDD> Seagate Barracuda 2Tb<
Cooling> Corsair H100i< Case> Corsair Air 540< PSU> Seasonic X-Series 650W< RAM> 8Gb Kingston HyperX<
Link to comment
Share on other sites

Link to post
Share on other sites


boolean done = true;

if (done) {

if (w > l) {

//player wins

} else if (w == l) {

//tie

} else {

//computer wins

}

}

Mini-Desktop: NCASE M1 Build Log
Mini-Server: M350 Build Log

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×