7 Antworten
+ 3
Both are excellent, however, picky me finds redundant statements in both codes (😝), such as:
Thomas's:
"if ( (!isValid( user )) || (!isValid( opponent )) ) {
return false; }"
He's already checked if the users input is valid, and computer can't have invalid input. So this if statement does nothing.
Yours:
You have plentiful if statements that take into account all possible cases. However, there's no need to check EVERYTHING, you can cut short. For example, If you take into account all wins and ties then there's no need to check losses. You can just assume he lost.
(This is done with else if/ else statements, Which I suggest you use more often when necessary). You also have more if statements than needed.
Anyhow, Great Job, it works great!
+ 3
Practice surely makes better! It's a great code anyway. I suggest you practice OOP (object oriented programming), it will surely enhance your skills.
+ 2
love them both XD
+ 2
meh i dont feel like a pro coder the most thing that is advanced is creating methods using equal sign if statements (i cant proceed more becuase i cant find a way
+ 1
no the better
+ 1
as a code not the output
+ 1
the input