I need to create a scoreboard in Java and I don’t know how or where to add it, please help. This is my code where it needs to be added somewhere. This is a rock, paper, scissors game
Hi @MeMyselfandI , welcome to the forum.
Unfortunately, without more information it’s a bit difficult to help you. We are lacking the context in which you are calling that function. But, I guess, you’d call it whenever one of the players score a point.
I suggest you to put your code (html, CSS and JavaScript) in a codepen project or a jsfiddle and than share it with us. That way we’ll be able to help you.
Also note that Java is different than JavaScript. What you are using is JavaScript.
The basicComputerPlayer function needs to return the random number. Its function definition also has a parameter (basicComputerPlayerChoice) that isn’t being used.
// Call site of basicComputerPlayer, the function should return the value to be captured
var computerPlayerChoice = basicComputerPlayer();
// The return value is used here
var winner = checkWinner(humanPlayerChoice, computerPlayerChoice);
function basicComputerPlayer() {
...start of code
// return the value so it can be captured at the call site
return randomNumber;
}