Tuesday, September 20, 2011

Assignment- Scissors, paper, rock game

This is my game for scissors, paper, rock


This is the screen shot before game started
 When you click an option, it can say "it was a draw"

It can say "You Win!"



It can say " computer wins
Public Class Form1Dim userselected As IntegerDim gameresult As Integer
ComboBox1.SelectedIndex = 0
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.LoadEnd Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.ClickDim Random As New Random











Dim computerchoice = Random.Next(3)If computerchoice = userselected Then gameresult = 0Select Case computerchoiceCase 0If userselected = 1 Then gameresult = 2If userselected = 2 Then gameresult = 1Case 1If userselected = 0 Then gameresult = 1If userselected = 2 Then gameresult = 2Case 2If userselected = 0 Then gameresult = 2If userselected = 1 Then gameresult = 1End Select

Label1.Text = Select Case gameresultCase 0"It Was A Draw"
Label1.Text = Case 1"Computer Wins"
Label1.Text = Case 2"You Win!"End SelectEnd Sub
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChangedEnd SubEnd Class

This is the code it is set on computer choice which means that the computer chooses the result which can either be "It Was A Draw", "Computer Wins", "You Win!"


This a flowchart of what happens