import java.util.Random
fun main() {
val options = arrayOf("Rock", "Paper", "Scissors")
while (true) {
println("Enter your choice (Rock, Paper, Scissors) or 'exit' to quit:")
val userChoice = readLine()?.capitalize()
if (userChoice == "Exit") {
println("Thanks for playing. Goodbye!")
break
}
if (userChoice !in options) {
println("Invalid choice. Please enter Rock, Paper, or Scissors.")
continue
}
val random = Random().nextInt(options.size)
val computerChoice = options[random]
println("Computer chose: $computerChoice")
when {
userChoice == computerChoice -> println("It's a tie!")
(userChoice == "Rock" && computerChoice == "Scissors") ||
(userChoice == "Paper" && computerChoice == "Rock") ||
(userChoice == "Scissors" && computerChoice == "Paper") -> println("You win!")
else -> println("Computer wins!")
}
}
}