Clear-Host $playGame="True" $number=0 $randomNo = New-Object System.Random $guess="" $playerMove="" $computerMove="" $kaigud="R","P","K" while($playGame -ne "False"){ $number=$randomNo.Next(1, 4) if($number -eq 1){$computerMove="Kivi"} if($number -eq 2){$computerMove="Paber"} if($number -eq 3){$computerMove="Käärid"} while($guess -eq ""){ Clear-Host Write-Host "´n" Write-Host "Sisesta üks järgnevatest valikutest ´n" Write-Host "---------" Write-Host "R = Kivi" Write-Host "P = Paber" Write-Host "S = Käärid" Write-Host "---------`n`n" $guess=Read-Host " Tee käik" if($kaigud -contains $guess){Write-Host "korras"} else{ continue} if($guess -eq "R"){$playerMove="Kivi"} if($guess -eq "P"){$playerMove="Paber"} if($guess -eq "S"){$playerMove="Käärid"} Write-Host "Valisid: ",$playerMove Write-Host "Arvuti: ",$computerMove switch($computerMove){ "Kivi" {switch($playerMove){ "Kivi"{Write-Host "Viik"} "Paber"{Write-Host "Sinu võit"} "Käärid"{Write-Host "Sinu kaotus"} }} "Paber" {switch($playerMove){ "Kivi"{Write-Host "Arvuti võit"} "Paber"{Write-Host "Viik"} "Käärid"{Write-Host "Sinu võit"} }} "Paber" {switch($playerMove){ "Kivi"{Write-Host "Arvuti võit"} "Paber"{Write-Host "Viik"} "Käärid"{Write-Host "Sinu võit"} }} } Write-Host "ots 1" } Write-host "ots 2" }