monopoly

somethings not working in it

Page 1 of 1

6 Replies - 8065 Views - Last Post: 21 January 2007 - 02:40 PM Rate Topic: -----

#1 orangeslide8  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 3
  • View blog
  • Posts: 203
  • Joined: 29-December 06

monopoly

Posted 20 January 2007 - 02:20 PM

i started monopoly but the pieces move to fast because all the message boxes don't come up and i think they don't move perfectly.could somone help.
Public Class Form1
Dim dice1 As Integer
Dim Dice2 As Integer
Dim Roll As Integer
Dim MyPosition As Integer
Dim AIPosition As Integer
Dim Left1 As Integer
Dim Top1 As Integer
Dim Yourmoney As Integer
Dim YourMoney1 As Double
Dim AIsMoney As Integer
Dim A As Boolean
Dim FreeParking As Boolean
Dim LuxuryTax As Boolean
Dim INcomeTax As Boolean
Dim CommunityChest As Boolean
Dim Chance As Boolean
Dim gotoJail As Boolean
Dim FreeParkingmoney As Integer
Dim WhichChanceCard As Integer
Dim WhichCommunityChestCard As Integer
Dim playerposition As Integer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Randomize()
dice1 = Int(Rnd() * 5) + 1
Label42.Text = dice1
Dice2 = Int(Rnd() * 5) + 1
Label43.Text = Dice2
Roll = dice1 + Dice2
MyPosition = MyPosition + Roll
If MyPosition > 37 Then
MyPosition = MyPosition - 37
End If
playerposition = MyPosition
If MyPosition > 36 Then
Yourmoney = Yourmoney + 200
MsgBox("You Passed Go You Collect 200 Dollars")
Label45.Text = Yourmoney
End If
Wherepiecegoes()
Label40.Left = Left1
Label40.Top = Top1
If playerposition = 19 Then
FreeParking = True
End If
If playerposition = 36 Then
LuxuryTax = True
End If
If playerposition = 4 Then
INcomeTax = True
End If
If playerposition = 2 Or MyPosition = 31 Or MyPosition = 17 Then
CommunityChest = True
End If
If playerposition = 7 Or MyPosition = 34 Or MyPosition = 20 Then
Chance = True
End If
If playerposition = 28 Then
gotoJail = True
End If
FreeParkingmoney = 500
If FreeParking = True Then
Yourmoney = Yourmoney + FreeParkingmoney
Label45.Text = Yourmoney
End If
If LuxuryTax = True Then
Yourmoney = Yourmoney - 75
Label45.Text = Yourmoney
FreeParkingmoney = FreeParkingmoney + 75
End If
If INcomeTax = True Then
Yourmoney = Yourmoney - 200
Label45.Text = Yourmoney
FreeParkingmoney = FreeParkingmoney + 200
End If
If CommunityChest = True Then
WhichCommunityChestCard = Int(Rnd() * 12) + 1
If WhichCommunityChestCard = 1 Then
MsgBox("Community Chest XMas Fund Matures Collect $100")
Yourmoney = Yourmoney + 100
Label45.Text = Yourmoney
End If
If WhichCommunityChestCard = 2 Then
MsgBox("Community Chest YouInherit $100 Dollars")
Yourmoney = Yourmoney + 100
Label45.Text = Yourmoney
End If
If WhichCommunityChestCard = 3 Then
MsgBox("Community Chest Pay Hospital $100")
Yourmoney = Yourmoney - 100
Label45.Text = Yourmoney
End If
If WhichCommunityChestCard = 4 Then
MsgBox("Community Chest Bank Error In Your Favor Collect $200")
Yourmoney = Yourmoney + 200
Label45.Text = Yourmoney
End If
If WhichCommunityChestCard = 5 Then
MsgBox("Community Chest Income Tax Refund Collect $20")
Yourmoney = Yourmoney + 20
Label45.Text = Yourmoney
End If
If WhichCommunityChestCard = 6 Then
MsgBox("Community Chest Grand Opera Opening Collect $50 From Every Player For Opening Night Seats")
Yourmoney = Yourmoney + 50
Label45.Text = Yourmoney
AIsMoney = AIsMoney - 50
Label46.Text = Yourmoney
End If
If WhichCommunityChestCard = 7 Then
MsgBox("Community Chest Advance To Go (Collect $200)")
Yourmoney = Yourmoney + 200
Label45.Text = Yourmoney
Label40.Left = 608
Label40.Top = 570
End If
If WhichCommunityChestCard = 8 Then
MsgBox("Community Chest Go To Jail Go Directly To Jail Do Not Pass Go Do not Collect $200")
Jail()
End If
If WhichCommunityChestCard = 9 Then
MsgBox("Community Chest You Have Won Second Prize In A Beauty Contest Collect $10")
Yourmoney = Yourmoney + 10
Label45.Text = Yourmoney
End If
If WhichCommunityChestCard = 10 Then
MsgBox("Community Chest Receive For Services $25")
Yourmoney = Yourmoney + 25
Label45.Text = Yourmoney
End If
If WhichCommunityChestCard = 11 Then
MsgBox("Community Chest Your Are Assessed For Street Repairs $40 Per House $115 Per Hotel")
' Gatta put some stuff here
MsgBox("you got one that won't work")
End If
If WhichCommunityChestCard = 12 Then
MsgBox("Community Chest From Sale Of Stock You Get $45")
Yourmoney = Yourmoney + 45
Label45.Text = Yourmoney
End If
If WhichCommunityChestCard = 13 Then
MsgBox("Community Chest Life Insurance Matures Collect $100")
Yourmoney = Yourmoney + 100
Label45.Text = Yourmoney
End If
End If
If Chance = True Then
WhichChanceCard = Int(Rnd() * 14) + 1
If WhichChanceCard = 1 Then
MsgBox("Chance Andvance To Go (Collect $200)")
Yourmoney = Yourmoney + 200
Label45.Text = Yourmoney
Label40.Left = 608
Label40.Top = 570
End If
If WhichChanceCard = 2 Then
MsgBox("Chance Go Directly To Jail Do Not Pass Go Do Not Collect $200")
Jail()
End If
If WhichChanceCard = 3 Then
MsgBox("Chance Your Building And Loan Matures Collect $150")
Yourmoney = +150
Label45.Text = Yourmoney
End If
If WhichChanceCard = 4 Or WhichChanceCard = 8 Then
MsgBox("chance Advance token to the nearest railroad and pay owner twice the reantal to which he/she is otherwise entitled. If RailRoad is Unowned, You May Buy It From The Bank.")
' need some stuff here
MsgBox("you got one that won't work")
End If
If WhichChanceCard = 5 Or WhichChanceCard = 10 Then
MsgBox("Chance This Card May be kept until needed Get out of jail free")
Label48.Visible = True
End If
If WhichChanceCard = 6 Then
MsgBox("Chance Go Back 3 Spaces")
MyPosition = -3
Wherepiecegoes()
Label40.Left = Left1
Label40.Top = Top1
End If
If WhichChanceCard = 7 Then
MsgBox("Chance Bank Pays You Diviend of $50")
Yourmoney = +50
Label45.Text = Yourmoney
End If
If WhichChanceCard = 9 Then
MsgBox("Chance Make General Repairs On All your Property For Each House Pay $25 For Each Hotel Pay $100")
' gatta put some stuff here
MsgBox("you got one that won't work")
End If
End If
If WhichChanceCard = 11 Then
MsgBox("Chance Pay Poor Tax Of $15")
Yourmoney = -15
Label45.Text = Yourmoney
End If
If WhichChanceCard = 12 Then
MsgBox("chance Advance to illinios Ave if you pass go collect $200.")
MyPosition = 22
Wherepiecegoes()
If AIPosition < 22 Then
AIsMoney = +200
Label46.Text = AIsMoney
AIPosition = MyPosition
Label40.Left = Left1
Label40.Top = Top1
End If
End If
If WhichChanceCard = 13 Then
MsgBox("Chance Take a ride on the reading rail road If you pass Go collect $200")
MyPosition = 5
Wherepiecegoes()
If AIPosition < 5 Then
AIsMoney = +200
Label46.Text = AIsMoney
AIPosition = MyPosition
Label40.Left = Left1
Label40.Top = Top1
End If
End If
If WhichChanceCard = 14 Then
MsgBox("Advance To St.Charles Place If You Pass GO Collect $200")
MyPosition = 10
Wherepiecegoes()
If AIPosition < 10 Then
AIsMoney = +200
Label46.Text = AIsMoney
AIPosition = MyPosition
Label40.Left = Left1
Label40.Top = Top1
End If
End If
If WhichChanceCard = 15 Then
MsgBox("Take A walk to Boardwalk Advance Token To BoardWalk")
MyPosition = 37
Wherepiecegoes()
If AIPosition < 37 Then
AIsMoney = +200
Label46.Text = AIsMoney
AIPosition = MyPosition
Label40.Left = Left1
Label40.Top = Top1
End If
End If
If gotoJail = True Then
Jail()
End If
MyPosition = 0
AIMove()
End Sub
Private Sub AIMove()
Randomize()
dice1 = Int(Rnd() * 5) + 1
Dice2 = Int(Rnd() * 5) + 1
Roll = dice1 + Dice2
MyPosition = MyPosition + Roll
If MyPosition > 37 Then
MyPosition = MyPosition - 37
End If
AIPosition = MyPosition
If MyPosition > 36 Then
AIsMoney = AIsMoney + 200
MsgBox("The Computer Passed Go and Collected 200 Dollars")
Label46.Text = AIsMoney
End If
Wherepiecegoes()
Label41.Left = Left1
Label41.Top = Top1
If MyPosition = 19 Then
FreeParking = True
End If
If AIPosition = 36 Then
LuxuryTax = True
End If
If AIPosition = 4 Then
INcomeTax = True
End If
If AIPosition = 2 Or MyPosition = 31 Or MyPosition = 17 Then
CommunityChest = True
End If
If AIPosition = 7 Or MyPosition = 34 Or MyPosition = 20 Then
Chance = True
End If
If AIPosition = 28 Then
gotoJail = True
End If
FreeParkingmoney = 500
If FreeParking = True Then
AIsMoney = AIsMoney + FreeParkingmoney
Label46.Text = AIsMoney
End If
If LuxuryTax = True Then
AIsMoney = AIsMoney - 75
Label46.Text = AIsMoney
FreeParkingmoney = FreeParkingmoney + 75
End If
If INcomeTax = True Then
AIsMoney = AIsMoney - 200
Label46.Text = AIsMoney
FreeParkingmoney = FreeParkingmoney + 200
End If
If CommunityChest = True Then
WhichCommunityChestCard = Int(Rnd() * 12) + 1
If WhichCommunityChestCard = 1 Then
MsgBox("Community Chest XMas Fund Matures Collect $100")
AIsMoney = AIsMoney + 100
Label46.Text = AIsMoney
End If
If WhichCommunityChestCard = 2 Then
MsgBox("Community Chest YouInherit $100 Dollars")
AIsMoney = AIsMoney + 100
Label46.Text = AIsMoney
End If
If WhichCommunityChestCard = 3 Then
MsgBox("Community Chest Pay Hospital $100")
AIsMoney = AIsMoney - 100
Label46.Text = AIsMoney
End If
If WhichCommunityChestCard = 4 Then
MsgBox("Community Chest Bank Error In Your Favor Collect $200")
AIsMoney = AIsMoney + 200
Label46.Text = AIsMoney
End If
If WhichCommunityChestCard = 5 Then
MsgBox("Community Chest Income Tax Refund Collect $20")
AIsMoney = AIsMoney + 20
Label46.Text = AIsMoney
End If
If WhichCommunityChestCard = 6 Then
MsgBox("Community Chest Grand Opera Opening Collect $50 From Every Player For Opening Night Seats")
AIsMoney = AIsMoney + 50
Label46.Text = AIsMoney
Yourmoney = Yourmoney - 50
Label45.Text = Yourmoney
End If
If WhichCommunityChestCard = 7 Then
MsgBox("Community Chest Advance To Go (Collect $200)")
AIsMoney = AIsMoney + 200
Label46.Text = AIsMoney
Label41.Left = 608
Label41.Top = 570
End If
If WhichCommunityChestCard = 8 Then
MsgBox("Community Chest Go To Jail Go Directly To Jail Do Not Pass Go Do not Collect $200")
Jail()
End If
If WhichCommunityChestCard = 9 Then
MsgBox("Community Chest You Have Won Second Prize In A Beauty Contest Collect $10")
AIsMoney = AIsMoney + 10
Label46.Text = AIsMoney
End If
If WhichCommunityChestCard = 10 Then
MsgBox("Community Chest Receive For Services $25")
AIsMoney = AIsMoney + 25
Label46.Text = AIsMoney
End If
If WhichCommunityChestCard = 11 Then
MsgBox("Community Chest Your Are Assessed For Street Repairs $40 Per House $115 Per Hotel")
' Gatta put some stuff here
MsgBox("you got one that won't work")
End If
If WhichCommunityChestCard = 12 Then
MsgBox("Community Chest From Sale Of Stock You Get $45")
AIsMoney = AIsMoney + 45
Label46.Text = AIsMoney
End If
If WhichCommunityChestCard = 13 Then
MsgBox("Community Chest Life Insurance Matures Collect $100")
AIsMoney = AIsMoney + 100
Label46.Text = AIsMoney
End If
End If
If Chance = True Then
WhichChanceCard = Int(Rnd() * 14) + 1
If WhichChanceCard = 1 Then
MsgBox("Chance Andvance To Go (Collect $200)")
AIsMoney = AIsMoney + 200
Label46.Text = AIsMoney
Label41.Left = 608
Label41.Top = 570
End If
If WhichChanceCard = 2 Then
MsgBox("Chance Go Directly To Jail Do Not Pass Go Do Not Collect $200")
Jail()
End If
If WhichChanceCard = 3 Then
MsgBox("Chance Your Building And Loan Matures Collect $150")
AIsMoney = +150
Label46.Text = AIsMoney
End If
If WhichChanceCard = 4 Or WhichChanceCard = 8 Then
MsgBox("chance Advance token to the nearest railroad and pay owner twice the reantal to which he/she is otherwise entitled. If RailRoad is Unowned, You May Buy It From The Bank.")
' need some stuff here
MsgBox("you got one that won't work")
End If
If WhichChanceCard = 5 Or WhichChanceCard = 10 Then
MsgBox("Chance This Card May be kept until needed Get out of jail free")
Label48.Visible = True
End If
If WhichChanceCard = 6 Then
MsgBox("Chance Go Back 3 Spaces")
MyPosition = -3
Wherepiecegoes()
Label41.Left = Left1
Label41.Top = Top1
End If
If WhichChanceCard = 7 Then
MsgBox("Chance Bank Pays You Diviend of $50")
AIsMoney = +50
Label46.Text = AIsMoney
End If
If WhichChanceCard = 9 Then
MsgBox("Chance Make General Repairs On All your Property For Each House Pay $25 For Each Hotel Pay $100")
' gatta put some stuff here
MsgBox("you got one that won't work")
End If
End If
If WhichChanceCard = 11 Then
MsgBox("Chance Pay Poor Tax Of $15")
AIsMoney = -15
Label46.Text = AIsMoney
End If
If WhichChanceCard = 12 Then
MsgBox("chance Advance to illinios Ave if you pass go collect $200.")
MyPosition = 22
Wherepiecegoes()
If AIPosition < 22 Then
AIsMoney = +200
Label46.Text = AIsMoney
AIPosition = MyPosition
Label41.Left = Left1
Label41.Top = Top1
End If
End If
If WhichChanceCard = 13 Then
MsgBox("Chance Take a ride on the reading rail road If you pass Go collect $200")
MyPosition = 5
Wherepiecegoes()
If AIPosition < 5 Then
AIsMoney = +200
Label46.Text = AIsMoney
AIPosition = MyPosition
Label41.Left = Left1
Label41.Top = Top1
End If
End If
If WhichChanceCard = 14 Then
MsgBox("Advance To St.Charles Place If You Pass GO Collect $200")
MyPosition = 10
Wherepiecegoes()
If AIPosition < 10 Then
AIsMoney = +200
Label46.Text = AIsMoney
AIPosition = MyPosition
Label41.Left = Left1
Label41.Top = Top1
End If
End If
If WhichChanceCard = 15 Then
MsgBox("Take A walk to Boardwalk Advance Token To BoardWalk")
MyPosition = 37
Wherepiecegoes()
If AIPosition < 37 Then
AIsMoney = +200
Label46.Text = AIsMoney
AIPosition = MyPosition
Label41.Left = Left1
Label41.Top = Top1
End If
End If
If gotoJail = True Then
Jail()
End If
End Sub
Private Sub Jail()
' Gatta put alll the jail stuff here
MsgBox("your in jail")
End Sub
Private Sub Wherepiecegoes()
If MyPosition = 0 Then
Left1 = 608
Top1 = 570
End If
If MyPosition = 37 Then
Left1 = 608
Top1 = 513
End If
If MyPosition = 36 Then
Left1 = 608
Top1 = 456
End If
If MyPosition = 35 Then
Left1 = 608
Top1 = 399
End If
If MyPosition = 34 Then
Left1 = 608
Top1 = 342
End If
If MyPosition = 33 Then
Left1 = 608
Top1 = 285
End If
If MyPosition = 32 Then
Left1 = 608
Top1 = 228
End If
If MyPosition = 31 Then
Left1 = 608
Top1 = 171
End If
If MyPosition = 30 Then
Left1 = 608
Top1 = 114
End If
If MyPosition = 29 Then
Left1 = 608
Top1 = 57
End If
If MyPosition = 28 Then
Left1 = 608
Top1 = 0
End If
If MyPosition = 27 Then
Left1 = 540
Top1 = 0
End If
If MyPosition = 26 Then
Left1 = 473
Top1 = 0
End If
If MyPosition = 25 Then
Left1 = 404
Top1 = 0
End If
If MyPosition = 24 Then
Left1 = 337
Top1 = 0
End If
If MyPosition = 23 Then
Left1 = 269
Top1 = 0
End If
If MyPosition = 22 Then
Left1 = 201
Top1 = 0
End If
If MyPosition = 21 Then
Left1 = 133
Top1 = 0
End If
If MyPosition = 20 Then
Left1 = 66
Top1 = 0
End If
If MyPosition = 19 Then
Left1 = -2
Top1 = 0
End If
If MyPosition = 18 Then
Left1 = -2
Top1 = 57
End If
If MyPosition = 17 Then
Left1 = -2
Top1 = 144
End If
If MyPosition = 16 Then
Left1 = -2
Top1 = 171
End If
If MyPosition = 15 Then
Left1 = -2
Top1 = 228
End If
If MyPosition = 14 Then
Left1 = -2
Top1 = 285
End If
If MyPosition = 13 Then
Left1 = -2
Top1 = 342
End If
If MyPosition = 12 Then
Left1 = -2
Top1 = 399
End If
If MyPosition = 11 Then
Left1 = -2
Top1 = 456
End If
If MyPosition = 10 Then
Left1 = -2
Top1 = 513
End If
If MyPosition = 9 Then
Left1 = -2
Top1 = 570
End If
If MyPosition = 8 Then
Left1 = 66
Top1 = 570
End If
If MyPosition = 7 Then
Left1 = 134
Top1 = 570
End If
If MyPosition = 6 Then
Left1 = 202
Top1 = 570
End If
If MyPosition = 5 Then
Left1 = 269
Top1 = 570
End If
If MyPosition = 4 Then
Left1 = 337
Top1 = 570
End If
If MyPosition = 3 Then
Left1 = 405
Top1 = 570
End If
If MyPosition = 2 Then
Left1 = 473
Top1 = 570
End If
If MyPosition = 1 Then
Left1 = 540
Top1 = 570
End If
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Yourmoney = 5000
Label45.Text = Yourmoney
AIsMoney = 5000
Label46.Text = AIsMoney
End Sub

End Class


if someone could help i'd greatly appreachiate it
thnx
john

Is This A Good Question/Topic? 0
  • +

Replies To: monopoly

#2 Amadeus  Icon User is offline

  • g+ + -o drink whiskey.cpp
  • member icon

Reputation: 248
  • View blog
  • Posts: 13,507
  • Joined: 12-July 02

Re: monopoly

Posted 20 January 2007 - 03:05 PM

I've deleted the duplicate posts, but could you please provide a detailed description of the problem? Perhaps a descriptive example of what you mean?
Was This Post Helpful? 0
  • +
  • -

#3 orangeslide8  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 3
  • View blog
  • Posts: 203
  • Joined: 29-December 06

Re: monopoly

Posted 20 January 2007 - 03:10 PM

the problem is when i roll i move more than 12 spaces. Also when the chance card comes up to move it moves to a rong place
thnx
john
Was This Post Helpful? 0
  • +
  • -

#4 skyhawk133  Icon User is offline

  • Head DIC Head
  • member icon

Reputation: 1877
  • View blog
  • Posts: 20,284
  • Joined: 17-March 01

Re: monopoly

Posted 20 January 2007 - 03:51 PM

Do you not indent your code? Nobody is going to want to help troubleshoot all that. How about showing us your class for the dice roll, and the chance card. Then if we need all the code we'll ask :) That's a LOT of code for someone to look over in their free time ;)
Was This Post Helpful? 0
  • +
  • -

#5 orangeslide8  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 3
  • View blog
  • Posts: 203
  • Joined: 29-December 06

Re: monopoly

Posted 20 January 2007 - 05:31 PM

Heres The FUll Code For Anyone Who wants it
Public Class Form1
	Dim dice1 As Integer
	Dim Dice2 As Integer
	Dim Roll As Integer
	Dim MyPosition As Integer
	Dim AIPosition As Integer
	Dim Left1 As Integer
	Dim Top1 As Integer
	Dim Yourmoney As Integer
	Dim YourMoney1 As Double
	Dim AIsMoney As Integer
	Dim A As Boolean
	Dim FreeParking As Boolean
	Dim LuxuryTax As Boolean
	Dim INcomeTax As Boolean
	Dim CommunityChest As Boolean
	Dim Chance As Boolean
	Dim gotoJail As Boolean
	Dim FreeParkingmoney As Integer
	Dim WhichChanceCard As Integer
	Dim WhichCommunityChestCard As Integer
	Dim playerposition As Integer
	Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
		Randomize()
		dice1 = Int(Rnd() * 5) + 1
		Label42.Text = dice1
		Dice2 = Int(Rnd() * 5) + 1
		Label43.Text = Dice2
		Roll = dice1 + Dice2
		MyPosition = MyPosition + Roll
		If MyPosition > 37 Then
			MyPosition = MyPosition - 37
		End If
		playerposition = MyPosition
		If MyPosition > 36 Then
			Yourmoney = Yourmoney + 200
			MsgBox("You Passed Go You Collect 200 Dollars")
			Label45.Text = Yourmoney
		End If
		Wherepiecegoes()
		Label40.Left = Left1
		Label40.Top = Top1
		If playerposition = 19 Then
			FreeParking = True
		End If
		If playerposition = 36 Then
			LuxuryTax = True
		End If
		If playerposition = 4 Then
			INcomeTax = True
		End If
		If playerposition = 2 Or MyPosition = 31 Or MyPosition = 17 Then
			CommunityChest = True
		End If
		If playerposition = 7 Or MyPosition = 34 Or MyPosition = 20 Then
			Chance = True
		End If
		If playerposition = 28 Then
			gotoJail = True
		End If
		FreeParkingmoney = 500
		If FreeParking = True Then
			Yourmoney = Yourmoney + FreeParkingmoney
			Label45.Text = Yourmoney
		End If
		If LuxuryTax = True Then
			Yourmoney = Yourmoney - 75
			Label45.Text = Yourmoney
			FreeParkingmoney = FreeParkingmoney + 75
		End If
		If INcomeTax = True Then
			Yourmoney = Yourmoney - 200
			Label45.Text = Yourmoney
			FreeParkingmoney = FreeParkingmoney + 200
		End If
		If CommunityChest = True Then
			WhichCommunityChestCard = Int(Rnd() * 12) + 1
			If WhichCommunityChestCard = 1 Then
				MsgBox("Community Chest XMas Fund Matures Collect $100")
				Yourmoney = Yourmoney + 100
				Label45.Text = Yourmoney
			End If
			If WhichCommunityChestCard = 2 Then
				MsgBox("Community Chest YouInherit $100 Dollars")
				Yourmoney = Yourmoney + 100
				Label45.Text = Yourmoney
			End If
			If WhichCommunityChestCard = 3 Then
				MsgBox("Community Chest Pay Hospital $100")
				Yourmoney = Yourmoney - 100
				Label45.Text = Yourmoney
			End If
			If WhichCommunityChestCard = 4 Then
				MsgBox("Community Chest Bank Error In Your Favor Collect $200")
				Yourmoney = Yourmoney + 200
				Label45.Text = Yourmoney
			End If
			If WhichCommunityChestCard = 5 Then
				MsgBox("Community Chest Income Tax Refund Collect $20")
				Yourmoney = Yourmoney + 20
				Label45.Text = Yourmoney
			End If
			If WhichCommunityChestCard = 6 Then
				MsgBox("Community Chest Grand Opera Opening Collect $50 From Every Player For Opening Night Seats")
				Yourmoney = Yourmoney + 50
				Label45.Text = Yourmoney
				AIsMoney = AIsMoney - 50
				Label46.Text = Yourmoney
			End If
			If WhichCommunityChestCard = 7 Then
				MsgBox("Community Chest Advance To Go (Collect $200)")
				Yourmoney = Yourmoney + 200
				Label45.Text = Yourmoney
				Label40.Left = 608
				Label40.Top = 570
			End If
			If WhichCommunityChestCard = 8 Then
				MsgBox("Community Chest Go To Jail Go Directly To Jail Do Not Pass Go Do not Collect $200")
				Jail()
			End If
			If WhichCommunityChestCard = 9 Then
				MsgBox("Community Chest You Have Won Second Prize In A Beauty Contest Collect $10")
				Yourmoney = Yourmoney + 10
				Label45.Text = Yourmoney
			End If
			If WhichCommunityChestCard = 10 Then
				MsgBox("Community Chest Receive For Services $25")
				Yourmoney = Yourmoney + 25
				Label45.Text = Yourmoney
			End If
			If WhichCommunityChestCard = 11 Then
				MsgBox("Community Chest Your Are Assessed For Street Repairs $40 Per House $115 Per Hotel")
				' Gatta put some stuff here
				MsgBox("you got one that won't work")
			End If
			If WhichCommunityChestCard = 12 Then
				MsgBox("Community Chest From Sale Of Stock You Get $45")
				Yourmoney = Yourmoney + 45
				Label45.Text = Yourmoney
			End If
			If WhichCommunityChestCard = 13 Then
				MsgBox("Community Chest Life Insurance Matures Collect $100")
				Yourmoney = Yourmoney + 100
				Label45.Text = Yourmoney
			End If
		End If
		If Chance = True Then
			WhichChanceCard = Int(Rnd() * 14) + 1
			If WhichChanceCard = 1 Then
				MsgBox("Chance Andvance To Go (Collect $200)")
				Yourmoney = Yourmoney + 200
				Label45.Text = Yourmoney
				Label40.Left = 608
				Label40.Top = 570
			End If
			If WhichChanceCard = 2 Then
				MsgBox("Chance Go Directly To Jail Do Not Pass Go Do Not Collect $200")
				Jail()
			End If
			If WhichChanceCard = 3 Then
				MsgBox("Chance Your Building And Loan Matures Collect $150")
				Yourmoney = +150
				Label45.Text = Yourmoney
			End If
			If WhichChanceCard = 4 Or WhichChanceCard = 8 Then
				MsgBox("chance Advance token to the nearest railroad and pay owner twice the reantal to which he/she is otherwise entitled. If RailRoad is Unowned, You May Buy It From The Bank.")
				' need some stuff here
				MsgBox("you got one that won't work")
			End If
			If WhichChanceCard = 5 Or WhichChanceCard = 10 Then
				MsgBox("Chance This Card May be kept until needed Get out of jail free")
				Label48.Visible = True
			End If
			If WhichChanceCard = 6 Then
				MsgBox("Chance Go Back 3 Spaces")
				MyPosition = -3
				Wherepiecegoes()
				Label40.Left = Left1
				Label40.Top = Top1
			End If
			If WhichChanceCard = 7 Then
				MsgBox("Chance Bank Pays You Diviend of $50")
				Yourmoney = +50
				Label45.Text = Yourmoney
			End If
			If WhichChanceCard = 9 Then
				MsgBox("Chance Make General Repairs On All your Property For Each House Pay $25 For Each Hotel Pay $100")
				' gatta put some stuff here
				MsgBox("you got one that won't work")
			End If
		End If
		If WhichChanceCard = 11 Then
			MsgBox("Chance Pay Poor Tax Of $15")
			Yourmoney = -15
			Label45.Text = Yourmoney
		End If
		If WhichChanceCard = 12 Then
			MsgBox("chance Advance to illinios Ave if you pass go collect $200.")
			MyPosition = 22
			Wherepiecegoes()
			If playerposition < 22 Then
				Yourmoney = +200
				Label45.Text = Yourmoney
				playerposition = MyPosition
				Label40.Left = Left1
				Label40.Top = Top1
			End If
		End If
		If WhichChanceCard = 13 Then
			MsgBox("Chance Take a ride on the reading rail road If you pass Go collect $200")
			MyPosition = 5
			Wherepiecegoes()
			If playerposition < 5 Then
				Yourmoney = +200
				Label45.Text = Yourmoney
				playerposition = MyPosition
				Label40.Left = Left1
				Label40.Top = Top1
			End If
		End If
		If WhichChanceCard = 14 Then
			MsgBox("Advance To St.Charles Place If You Pass GO Collect $200")
			MyPosition = 10
			Wherepiecegoes()
			If playerposition < 10 Then
				Yourmoney = +200
				Label45.Text = Yourmoney
				playerposition = MyPosition
				Label40.Left = Left1
				Label40.Top = Top1
			End If
		End If
		If WhichChanceCard = 15 Then
			MsgBox("Take A walk to Boardwalk Advance Token To BoardWalk")
			MyPosition = 37
			Wherepiecegoes()
			If AIPosition < 37 Then
				Yourmoney = +200
				Label45.Text = Yourmoney
				playerposition = MyPosition
				Label40.Left = Left1
				Label40.Top = Top1
			End If
		End If
		If gotoJail = True Then
			Jail()
		End If
		MyPosition = 0
		MsgBox("Computers Turn")
		AIMove()
	End Sub
	Private Sub AIMove()
		Randomize()
		dice1 = Int(Rnd() * 5) + 1
		Label43.Text = dice1
		Dice2 = Int(Rnd() * 5) + 1
		Label42.Text = Dice2
		Roll = dice1 + Dice2
		MyPosition = MyPosition + Roll
		If MyPosition > 37 Then
			MyPosition = MyPosition - 37
		End If
		AIPosition = MyPosition
		If MyPosition > 36 Then
			AIsMoney = AIsMoney + 200
			MsgBox("The Computer Passed Go and Collected 200 Dollars")
			Label46.Text = AIsMoney
		End If
		Wherepiecegoes()
		Label41.Left = Left1
		Label41.Top = Top1
		If MyPosition = 19 Then
			FreeParking = True
		End If
		If AIPosition = 36 Then
			LuxuryTax = True
		End If
		If AIPosition = 4 Then
			INcomeTax = True
		End If
		If AIPosition = 2 Or MyPosition = 31 Or MyPosition = 17 Then
			CommunityChest = True
		End If
		If AIPosition = 7 Or MyPosition = 34 Or MyPosition = 20 Then
			Chance = True
		End If
		If AIPosition = 28 Then
			gotoJail = True
		End If
		FreeParkingmoney = 500
		If FreeParking = True Then
			AIsMoney = AIsMoney + FreeParkingmoney
			Label46.Text = AIsMoney
		End If
		If LuxuryTax = True Then
			AIsMoney = AIsMoney - 75
			Label46.Text = AIsMoney
			FreeParkingmoney = FreeParkingmoney + 75
		End If
		If INcomeTax = True Then
			AIsMoney = AIsMoney - 200
			Label46.Text = AIsMoney
			FreeParkingmoney = FreeParkingmoney + 200
		End If
		If CommunityChest = True Then
			WhichCommunityChestCard = Int(Rnd() * 12) + 1
			If WhichCommunityChestCard = 1 Then
				MsgBox("Community Chest XMas Fund Matures Collect $100")
				AIsMoney = AIsMoney + 100
				Label46.Text = AIsMoney
			End If
			If WhichCommunityChestCard = 2 Then
				MsgBox("Community Chest YouInherit $100 Dollars")
				AIsMoney = AIsMoney + 100
				Label46.Text = AIsMoney
			End If
			If WhichCommunityChestCard = 3 Then
				MsgBox("Community Chest Pay Hospital $100")
				AIsMoney = AIsMoney - 100
				Label46.Text = AIsMoney
			End If
			If WhichCommunityChestCard = 4 Then
				MsgBox("Community Chest Bank Error In Your Favor Collect $200")
				AIsMoney = AIsMoney + 200
				Label46.Text = AIsMoney
			End If
			If WhichCommunityChestCard = 5 Then
				MsgBox("Community Chest Income Tax Refund Collect $20")
				AIsMoney = AIsMoney + 20
				Label46.Text = AIsMoney
			End If
			If WhichCommunityChestCard = 6 Then
				MsgBox("Community Chest Grand Opera Opening Collect $50 From Every Player For Opening Night Seats")
				AIsMoney = AIsMoney + 50
				Label46.Text = AIsMoney
				Yourmoney = Yourmoney - 50
				Label45.Text = Yourmoney
			End If
			If WhichCommunityChestCard = 7 Then
				MsgBox("Community Chest Advance To Go (Collect $200)")
				AIsMoney = AIsMoney + 200
				Label46.Text = AIsMoney
				Label41.Left = 608
				Label41.Top = 570
			End If
			If WhichCommunityChestCard = 8 Then
				MsgBox("Community Chest Go To Jail Go Directly To Jail Do Not Pass Go Do not Collect $200")
				Jail()
			End If
			If WhichCommunityChestCard = 9 Then
				MsgBox("Community Chest You Have Won Second Prize In A Beauty Contest Collect $10")
				AIsMoney = AIsMoney + 10
				Label46.Text = AIsMoney
			End If
			If WhichCommunityChestCard = 10 Then
				MsgBox("Community Chest Receive For Services $25")
				AIsMoney = AIsMoney + 25
				Label46.Text = AIsMoney
			End If
			If WhichCommunityChestCard = 11 Then
				MsgBox("Community Chest Your Are Assessed For Street Repairs $40 Per House $115 Per Hotel")
				' Gatta put some stuff here
				MsgBox("you got one that won't work")
			End If
			If WhichCommunityChestCard = 12 Then
				MsgBox("Community Chest From Sale Of Stock You Get $45")
				AIsMoney = AIsMoney + 45
				Label46.Text = AIsMoney
			End If
			If WhichCommunityChestCard = 13 Then
				MsgBox("Community Chest Life Insurance Matures Collect $100")
				AIsMoney = AIsMoney + 100
				Label46.Text = AIsMoney
			End If
		End If
		If Chance = True Then
			WhichChanceCard = Int(Rnd() * 14) + 1
			If WhichChanceCard = 1 Then
				MsgBox("Chance Andvance To Go (Collect $200)")
				AIsMoney = AIsMoney + 200
				Label46.Text = AIsMoney
				Label41.Left = 608
				Label41.Top = 570
			End If
			If WhichChanceCard = 2 Then
				MsgBox("Chance Go Directly To Jail Do Not Pass Go Do Not Collect $200")
				Jail()
			End If
			If WhichChanceCard = 3 Then
				MsgBox("Chance Your Building And Loan Matures Collect $150")
				AIsMoney = +150
				Label46.Text = AIsMoney
			End If
			If WhichChanceCard = 4 Or WhichChanceCard = 8 Then
				MsgBox("chance Advance token to the nearest railroad and pay owner twice the reantal to which he/she is otherwise entitled. If RailRoad is Unowned, You May Buy It From The Bank.")
				' need some stuff here
				MsgBox("you got one that won't work")
			End If
			If WhichChanceCard = 5 Or WhichChanceCard = 10 Then
				MsgBox("Chance This Card May be kept until needed Get out of jail free")
				Label48.Visible = True
			End If
			If WhichChanceCard = 6 Then
				MsgBox("Chance Go Back 3 Spaces")
				MyPosition = -3
				Wherepiecegoes()
				Label41.Left = Left1
				Label41.Top = Top1
			End If
			If WhichChanceCard = 7 Then
				MsgBox("Chance Bank Pays You Diviend of $50")
				AIsMoney = +50
				Label46.Text = AIsMoney
			End If
			If WhichChanceCard = 9 Then
				MsgBox("Chance Make General Repairs On All your Property For Each House Pay $25 For Each Hotel Pay $100")
				' gatta put some stuff here
				MsgBox("you got one that won't work")
			End If
		End If
		If WhichChanceCard = 11 Then
			MsgBox("Chance Pay Poor Tax Of $15")
			AIsMoney = -15
			Label46.Text = AIsMoney
		End If
		If WhichChanceCard = 12 Then
			MsgBox("chance Advance to illinios Ave if you pass go collect $200.")
			MyPosition = 22
			Wherepiecegoes()
			If AIPosition < 22 Then
				AIsMoney = +200
				Label46.Text = AIsMoney
				AIPosition = MyPosition
				Label41.Left = Left1
				Label41.Top = Top1
			End If
		End If
		If WhichChanceCard = 13 Then
			MsgBox("Chance Take a ride on the reading rail road If you pass Go collect $200")
			MyPosition = 5
			Wherepiecegoes()
			If AIPosition < 5 Then
				AIsMoney = +200
				Label46.Text = AIsMoney
				AIPosition = MyPosition
				Label41.Left = Left1
				Label41.Top = Top1
			End If
		End If
		If WhichChanceCard = 14 Then
			MsgBox("Advance To St.Charles Place If You Pass GO Collect $200")
			MyPosition = 10
			Wherepiecegoes()
			If AIPosition < 10 Then
				AIsMoney = +200
				Label46.Text = AIsMoney
				AIPosition = MyPosition
				Label41.Left = Left1
				Label41.Top = Top1
			End If
		End If
		If WhichChanceCard = 15 Then
			MsgBox("Take A walk to Boardwalk Advance Token To BoardWalk")
			MyPosition = 37
			Wherepiecegoes()
			If AIPosition < 37 Then
				AIsMoney = +200
				Label46.Text = AIsMoney
				AIPosition = MyPosition
				Label41.Left = Left1
				Label41.Top = Top1
			End If
		End If
		If gotoJail = True Then
			Jail()
		End If
		MsgBox("your Turn")
	End Sub
	Private Sub Jail()
		MyPosition = 9
		Wherepiecegoes()
	End Sub
	Private Sub Wherepiecegoes()
		If MyPosition = 0 Then
			Left1 = 608
			Top1 = 570
		End If
		If MyPosition = 37 Then
			Left1 = 608
			Top1 = 513
		End If
		If MyPosition = 36 Then
			Left1 = 608
			Top1 = 456
		End If
		If MyPosition = 35 Then
			Left1 = 608
			Top1 = 399
		End If
		If MyPosition = 34 Then
			Left1 = 608
			Top1 = 342
		End If
		If MyPosition = 33 Then
			Left1 = 608
			Top1 = 285
		End If
		If MyPosition = 32 Then
			Left1 = 608
			Top1 = 228
		End If
		If MyPosition = 31 Then
			Left1 = 608
			Top1 = 171
		End If
		If MyPosition = 30 Then
			Left1 = 608
			Top1 = 114
		End If
		If MyPosition = 29 Then
			Left1 = 608
			Top1 = 57
		End If
		If MyPosition = 28 Then
			Left1 = 608
			Top1 = 0
		End If
		If MyPosition = 27 Then
			Left1 = 540
			Top1 = 0
		End If
		If MyPosition = 26 Then
			Left1 = 473
			Top1 = 0
		End If
		If MyPosition = 25 Then
			Left1 = 404
			Top1 = 0
		End If
		If MyPosition = 24 Then
			Left1 = 337
			Top1 = 0
		End If
		If MyPosition = 23 Then
			Left1 = 269
			Top1 = 0
		End If
		If MyPosition = 22 Then
			Left1 = 201
			Top1 = 0
		End If
		If MyPosition = 21 Then
			Left1 = 133
			Top1 = 0
		End If
		If MyPosition = 20 Then
			Left1 = 66
			Top1 = 0
		End If
		If MyPosition = 19 Then
			Left1 = -2
			Top1 = 0
		End If
		If MyPosition = 18 Then
			Left1 = -2
			Top1 = 57
		End If
		If MyPosition = 17 Then
			Left1 = -2
			Top1 = 144
		End If
		If MyPosition = 16 Then
			Left1 = -2
			Top1 = 171
		End If
		If MyPosition = 15 Then
			Left1 = -2
			Top1 = 228
		End If
		If MyPosition = 14 Then
			Left1 = -2
			Top1 = 285
		End If
		If MyPosition = 13 Then
			Left1 = -2
			Top1 = 342
		End If
		If MyPosition = 12 Then
			Left1 = -2
			Top1 = 399
		End If
		If MyPosition = 11 Then
			Left1 = -2
			Top1 = 456
		End If
		If MyPosition = 10 Then
			Left1 = -2
			Top1 = 513
		End If
		If MyPosition = 9 Then
			Left1 = -2
			Top1 = 570
		End If
		If MyPosition = 8 Then
			Left1 = 66
			Top1 = 570
		End If
		If MyPosition = 7 Then
			Left1 = 134
			Top1 = 570
		End If
		If MyPosition = 6 Then
			Left1 = 202
			Top1 = 570
		End If
		If MyPosition = 5 Then
			Left1 = 269
			Top1 = 570
		End If
		If MyPosition = 4 Then
			Left1 = 337
			Top1 = 570
		End If
		If MyPosition = 3 Then
			Left1 = 405
			Top1 = 570
		End If
		If MyPosition = 2 Then
			Left1 = 473
			Top1 = 570
		End If
		If MyPosition = 1 Then
			Left1 = 540
			Top1 = 570
		End If
	End Sub
	Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
		Yourmoney = 5000
		Label45.Text = Yourmoney
		AIsMoney = 5000
		Label46.Text = AIsMoney
	End Sub
End Class

Was This Post Helpful? 1
  • +
  • -

#6 orangeslide8  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 3
  • View blog
  • Posts: 203
  • Joined: 29-December 06

Re: monopoly

Posted 20 January 2007 - 05:38 PM

Heres Where I think the problem is
Public Class Form1
	Dim dice1 As Integer
	Dim Dice2 As Integer
	Dim Roll As Integer
	Dim MyPosition As Integer
	Dim AIPosition As Integer
	Dim Left1 As Integer
	Dim Top1 As Integer
	Dim Yourmoney As Integer
	Dim YourMoney1 As Double
	Dim AIsMoney As Integer
	Dim A As Boolean
	Dim FreeParking As Boolean
	Dim LuxuryTax As Boolean
	Dim INcomeTax As Boolean
	Dim CommunityChest As Boolean
	Dim Chance As Boolean
	Dim gotoJail As Boolean
	Dim FreeParkingmoney As Integer
	Dim WhichChanceCard As Integer
	Dim WhichCommunityChestCard As Integer
	Dim playerposition As Integer
	Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
		Randomize()
		dice1 = Int(Rnd() * 5) + 1
		Label42.Text = dice1
		Dice2 = Int(Rnd() * 5) + 1
		Label43.Text = Dice2
		Roll = dice1 + Dice2
		MyPosition = MyPosition + Roll
		If MyPosition > 37 Then
			MyPosition = MyPosition - 37
		End If
		playerposition = MyPosition
		If MyPosition > 36 Then
			Yourmoney = Yourmoney + 200
			MsgBox("You Passed Go You Collect 200 Dollars")
			Label45.Text = Yourmoney
		End If
		Wherepiecegoes()
		Label40.Left = Left1
		Label40.Top = Top1
		If playerposition = 19 Then
			FreeParking = True
		End If
		If playerposition = 36 Then
			LuxuryTax = True
		End If
		If playerposition = 4 Then
			INcomeTax = True
		End If
		If playerposition = 2 Or MyPosition = 31 Or MyPosition = 17 Then
			CommunityChest = True
		End If
		If playerposition = 7 Or MyPosition = 34 Or MyPosition = 20 Then
			Chance = True
		End If
		If playerposition = 28 Then
			gotoJail = True
		End If
		FreeParkingmoney = 500
		If FreeParking = True Then
			Yourmoney = Yourmoney + FreeParkingmoney
			Label45.Text = Yourmoney
		End If
		If LuxuryTax = True Then
			Yourmoney = Yourmoney - 75
			Label45.Text = Yourmoney
			FreeParkingmoney = FreeParkingmoney + 75
		End If
		If INcomeTax = True Then
			Yourmoney = Yourmoney - 200
			Label45.Text = Yourmoney
			FreeParkingmoney = FreeParkingmoney + 200
		End If
		If CommunityChest = True Then
			WhichCommunityChestCard = Int(Rnd() * 12) + 1
			If WhichCommunityChestCard = 1 Then
				MsgBox("Community Chest XMas Fund Matures Collect $100")
				Yourmoney = Yourmoney + 100
				Label45.Text = Yourmoney
			End If
			If WhichCommunityChestCard = 2 Then
				MsgBox("Community Chest YouInherit $100 Dollars")
				Yourmoney = Yourmoney + 100
				Label45.Text = Yourmoney
			End If
			If WhichCommunityChestCard = 3 Then
				MsgBox("Community Chest Pay Hospital $100")
				Yourmoney = Yourmoney - 100
				Label45.Text = Yourmoney
			End If
			If WhichCommunityChestCard = 4 Then
				MsgBox("Community Chest Bank Error In Your Favor Collect $200")
				Yourmoney = Yourmoney + 200
				Label45.Text = Yourmoney
			End If
			If WhichCommunityChestCard = 5 Then
				MsgBox("Community Chest Income Tax Refund Collect $20")
				Yourmoney = Yourmoney + 20
				Label45.Text = Yourmoney
			End If
			If WhichCommunityChestCard = 6 Then
				MsgBox("Community Chest Grand Opera Opening Collect $50 From Every Player For Opening Night Seats")
				Yourmoney = Yourmoney + 50
				Label45.Text = Yourmoney
				AIsMoney = AIsMoney - 50
				Label46.Text = Yourmoney
			End If
			If WhichCommunityChestCard = 7 Then
				MsgBox("Community Chest Advance To Go (Collect $200)")
				Yourmoney = Yourmoney + 200
				Label45.Text = Yourmoney
				Label40.Left = 608
				Label40.Top = 570
			End If
			If WhichCommunityChestCard = 8 Then
				MsgBox("Community Chest Go To Jail Go Directly To Jail Do Not Pass Go Do not Collect $200")
				Jail()
			End If
			If WhichCommunityChestCard = 9 Then
				MsgBox("Community Chest You Have Won Second Prize In A Beauty Contest Collect $10")
				Yourmoney = Yourmoney + 10
				Label45.Text = Yourmoney
			End If
			If WhichCommunityChestCard = 10 Then
				MsgBox("Community Chest Receive For Services $25")
				Yourmoney = Yourmoney + 25
				Label45.Text = Yourmoney
			End If
			If WhichCommunityChestCard = 11 Then
				MsgBox("Community Chest Your Are Assessed For Street Repairs $40 Per House $115 Per Hotel")
				' Gatta put some stuff here
				MsgBox("you got one that won't work")
			End If
			If WhichCommunityChestCard = 12 Then
				MsgBox("Community Chest From Sale Of Stock You Get $45")
				Yourmoney = Yourmoney + 45
				Label45.Text = Yourmoney
			End If
			If WhichCommunityChestCard = 13 Then
				MsgBox("Community Chest Life Insurance Matures Collect $100")
				Yourmoney = Yourmoney + 100
				Label45.Text = Yourmoney
			End If
		End If
		If Chance = True Then
			WhichChanceCard = Int(Rnd() * 14) + 1
			If WhichChanceCard = 1 Then
				MsgBox("Chance Andvance To Go (Collect $200)")
				Yourmoney = Yourmoney + 200
				Label45.Text = Yourmoney
				Label40.Left = 608
				Label40.Top = 570
			End If
			If WhichChanceCard = 2 Then
				MsgBox("Chance Go Directly To Jail Do Not Pass Go Do Not Collect $200")
				Jail()
			End If
			If WhichChanceCard = 3 Then
				MsgBox("Chance Your Building And Loan Matures Collect $150")
				Yourmoney = +150
				Label45.Text = Yourmoney
			End If
			If WhichChanceCard = 4 Or WhichChanceCard = 8 Then
				MsgBox("chance Advance token to the nearest railroad and pay owner twice the reantal to which he/she is otherwise entitled. If RailRoad is Unowned, You May Buy It From The Bank.")
				' need some stuff here
				MsgBox("you got one that won't work")
			End If
			If WhichChanceCard = 5 Or WhichChanceCard = 10 Then
				MsgBox("Chance This Card May be kept until needed Get out of jail free")
				Label48.Visible = True
			End If
			If WhichChanceCard = 6 Then
				MsgBox("Chance Go Back 3 Spaces")
				MyPosition = -3
				Wherepiecegoes()
				Label40.Left = Left1
				Label40.Top = Top1
			End If
			If WhichChanceCard = 7 Then
				MsgBox("Chance Bank Pays You Diviend of $50")
				Yourmoney = +50
				Label45.Text = Yourmoney
			End If
			If WhichChanceCard = 9 Then
				MsgBox("Chance Make General Repairs On All your Property For Each House Pay $25 For Each Hotel Pay $100")
				' gatta put some stuff here
				MsgBox("you got one that won't work")
			End If
		End If
		If WhichChanceCard = 11 Then
			MsgBox("Chance Pay Poor Tax Of $15")
			Yourmoney = -15
			Label45.Text = Yourmoney
		End If
		If WhichChanceCard = 12 Then
			MsgBox("chance Advance to illinios Ave if you pass go collect $200.")
			MyPosition = 22
			Wherepiecegoes()
			If playerposition < 22 Then
				Yourmoney = +200
				Label45.Text = Yourmoney
				playerposition = MyPosition
				Label40.Left = Left1
				Label40.Top = Top1
			End If
		End If
		If WhichChanceCard = 13 Then
			MsgBox("Chance Take a ride on the reading rail road If you pass Go collect $200")
			MyPosition = 5
			Wherepiecegoes()
			If playerposition < 5 Then
				Yourmoney = +200
				Label45.Text = Yourmoney
				playerposition = MyPosition
				Label40.Left = Left1
				Label40.Top = Top1
			End If
		End If
		If WhichChanceCard = 14 Then
			MsgBox("Advance To St.Charles Place If You Pass GO Collect $200")
			MyPosition = 10
			Wherepiecegoes()
			If playerposition < 10 Then
				Yourmoney = +200
				Label45.Text = Yourmoney
				playerposition = MyPosition
				Label40.Left = Left1
				Label40.Top = Top1
			End If
		End If
		If WhichChanceCard = 15 Then
			MsgBox("Take A walk to Boardwalk Advance Token To BoardWalk")
			MyPosition = 37
			Wherepiecegoes()
			If AIPosition < 37 Then
				Yourmoney = +200
				Label45.Text = Yourmoney
				playerposition = MyPosition
				Label40.Left = Left1
				Label40.Top = Top1
			End If
		End If
		If gotoJail = True Then
			Jail()
		End If
		MyPosition = 0
		MsgBox("Computers Turn")
		AIMove()
	End Sub
	Private Sub AIMove()
		Randomize()
		dice1 = Int(Rnd() * 5) + 1
		Label43.Text = dice1
		Dice2 = Int(Rnd() * 5) + 1
		Label42.Text = Dice2
		Roll = dice1 + Dice2
		MyPosition = MyPosition + Roll
		If MyPosition > 37 Then
			MyPosition = MyPosition - 37
		End If
		AIPosition = MyPosition
		If MyPosition > 36 Then
			AIsMoney = AIsMoney + 200
			MsgBox("The Computer Passed Go and Collected 200 Dollars")
			Label46.Text = AIsMoney
		End If
		Wherepiecegoes()
		Label41.Left = Left1
		Label41.Top = Top1
		If MyPosition = 19 Then
			FreeParking = True
		End If
		If AIPosition = 36 Then
			LuxuryTax = True
		End If
		If AIPosition = 4 Then
			INcomeTax = True
		End If
		If AIPosition = 2 Or MyPosition = 31 Or MyPosition = 17 Then
			CommunityChest = True
		End If
		If AIPosition = 7 Or MyPosition = 34 Or MyPosition = 20 Then
			Chance = True
		End If
		If AIPosition = 28 Then
			gotoJail = True
		End If
		FreeParkingmoney = 500
		If FreeParking = True Then
			AIsMoney = AIsMoney + FreeParkingmoney
			Label46.Text = AIsMoney
		End If
		If LuxuryTax = True Then
			AIsMoney = AIsMoney - 75
			Label46.Text = AIsMoney
			FreeParkingmoney = FreeParkingmoney + 75
		End If
		If INcomeTax = True Then
			AIsMoney = AIsMoney - 200
			Label46.Text = AIsMoney
			FreeParkingmoney = FreeParkingmoney + 200
		End If
		If CommunityChest = True Then
			WhichCommunityChestCard = Int(Rnd() * 12) + 1
			If WhichCommunityChestCard = 1 Then
				MsgBox("Community Chest XMas Fund Matures Collect $100")
				AIsMoney = AIsMoney + 100
				Label46.Text = AIsMoney
			End If
			If WhichCommunityChestCard = 2 Then
				MsgBox("Community Chest YouInherit $100 Dollars")
				AIsMoney = AIsMoney + 100
				Label46.Text = AIsMoney
			End If
			If WhichCommunityChestCard = 3 Then
				MsgBox("Community Chest Pay Hospital $100")
				AIsMoney = AIsMoney - 100
				Label46.Text = AIsMoney
			End If
			If WhichCommunityChestCard = 4 Then
				MsgBox("Community Chest Bank Error In Your Favor Collect $200")
				AIsMoney = AIsMoney + 200
				Label46.Text = AIsMoney
			End If
			If WhichCommunityChestCard = 5 Then
				MsgBox("Community Chest Income Tax Refund Collect $20")
				AIsMoney = AIsMoney + 20
				Label46.Text = AIsMoney
			End If
			If WhichCommunityChestCard = 6 Then
				MsgBox("Community Chest Grand Opera Opening Collect $50 From Every Player For Opening Night Seats")
				AIsMoney = AIsMoney + 50
				Label46.Text = AIsMoney
				Yourmoney = Yourmoney - 50
				Label45.Text = Yourmoney
			End If
			If WhichCommunityChestCard = 7 Then
				MsgBox("Community Chest Advance To Go (Collect $200)")
				AIsMoney = AIsMoney + 200
				Label46.Text = AIsMoney
				Label41.Left = 608
				Label41.Top = 570
			End If
			If WhichCommunityChestCard = 8 Then
				MsgBox("Community Chest Go To Jail Go Directly To Jail Do Not Pass Go Do not Collect $200")
				Jail()
			End If
			If WhichCommunityChestCard = 9 Then
				MsgBox("Community Chest You Have Won Second Prize In A Beauty Contest Collect $10")
				AIsMoney = AIsMoney + 10
				Label46.Text = AIsMoney
			End If
			If WhichCommunityChestCard = 10 Then
				MsgBox("Community Chest Receive For Services $25")
				AIsMoney = AIsMoney + 25
				Label46.Text = AIsMoney
			End If
			If WhichCommunityChestCard = 11 Then
				MsgBox("Community Chest Your Are Assessed For Street Repairs $40 Per House $115 Per Hotel")
				' Gatta put some stuff here
				MsgBox("you got one that won't work")
			End If
			If WhichCommunityChestCard = 12 Then
				MsgBox("Community Chest From Sale Of Stock You Get $45")
				AIsMoney = AIsMoney + 45
				Label46.Text = AIsMoney
			End If
			If WhichCommunityChestCard = 13 Then
				MsgBox("Community Chest Life Insurance Matures Collect $100")
				AIsMoney = AIsMoney + 100
				Label46.Text = AIsMoney
			End If
		End If
		If Chance = True Then
			WhichChanceCard = Int(Rnd() * 14) + 1
			If WhichChanceCard = 1 Then
				MsgBox("Chance Andvance To Go (Collect $200)")
				AIsMoney = AIsMoney + 200
				Label46.Text = AIsMoney
				Label41.Left = 608
				Label41.Top = 570
			End If
			If WhichChanceCard = 2 Then
				MsgBox("Chance Go Directly To Jail Do Not Pass Go Do Not Collect $200")
				Jail()
			End If
			If WhichChanceCard = 3 Then
				MsgBox("Chance Your Building And Loan Matures Collect $150")
				AIsMoney = +150
				Label46.Text = AIsMoney
			End If
			If WhichChanceCard = 4 Or WhichChanceCard = 8 Then
				MsgBox("chance Advance token to the nearest railroad and pay owner twice the reantal to which he/she is otherwise entitled. If RailRoad is Unowned, You May Buy It From The Bank.")
				' need some stuff here
				MsgBox("you got one that won't work")
			End If
			If WhichChanceCard = 5 Or WhichChanceCard = 10 Then
				MsgBox("Chance This Card May be kept until needed Get out of jail free")
				Label48.Visible = True
			End If
			If WhichChanceCard = 6 Then
				MsgBox("Chance Go Back 3 Spaces")
				MyPosition = -3
				Wherepiecegoes()
				Label41.Left = Left1
				Label41.Top = Top1
			End If
			If WhichChanceCard = 7 Then
				MsgBox("Chance Bank Pays You Diviend of $50")
				AIsMoney = +50
				Label46.Text = AIsMoney
			End If
			If WhichChanceCard = 9 Then
				MsgBox("Chance Make General Repairs On All your Property For Each House Pay $25 For Each Hotel Pay $100")
				' gatta put some stuff here
				MsgBox("you got one that won't work")
			End If
		End If
		If WhichChanceCard = 11 Then
			MsgBox("Chance Pay Poor Tax Of $15")
			AIsMoney = -15
			Label46.Text = AIsMoney
		End If
		If WhichChanceCard = 12 Then
			MsgBox("chance Advance to illinios Ave if you pass go collect $200.")
			MyPosition = 22
			Wherepiecegoes()
			If AIPosition < 22 Then
				AIsMoney = +200
				Label46.Text = AIsMoney
				AIPosition = MyPosition
				Label41.Left = Left1
				Label41.Top = Top1
			End If
		End If
		If WhichChanceCard = 13 Then
			MsgBox("Chance Take a ride on the reading rail road If you pass Go collect $200")
			MyPosition = 5
			Wherepiecegoes()
			If AIPosition < 5 Then
				AIsMoney = +200
				Label46.Text = AIsMoney
				AIPosition = MyPosition
				Label41.Left = Left1
				Label41.Top = Top1
			End If
		End If
		If WhichChanceCard = 14 Then
			MsgBox("Advance To St.Charles Place If You Pass GO Collect $200")
			MyPosition = 10
			Wherepiecegoes()
			If AIPosition < 10 Then
				AIsMoney = +200
				Label46.Text = AIsMoney
				AIPosition = MyPosition
				Label41.Left = Left1
				Label41.Top = Top1
			End If
		End If
		If WhichChanceCard = 15 Then
			MsgBox("Take A walk to Boardwalk Advance Token To BoardWalk")
			MyPosition = 37
			Wherepiecegoes()
			If AIPosition < 37 Then
				AIsMoney = +200
				Label46.Text = AIsMoney
				AIPosition = MyPosition
				Label41.Left = Left1
				Label41.Top = Top1
			End If
		End If
		If gotoJail = True Then
			Jail()
		End If
		MsgBox("your Turn")
	End Sub
	Private Sub Jail()
		MyPosition = 9
		Wherepiecegoes()
	End Sub
	Private Sub Wherepiecegoes() '  this is just saying where all the different labels are
		If MyPosition = 0 Then
			Left1 = 608
			Top1 = 570
		End If
		If MyPosition = 37 Then
			Left1 = 608
			Top1 = 513
		End If
		If MyPosition = 36 Then
			Left1 = 608
			Top1 = 456
		End If
		If MyPosition = 35 Then
			Left1 = 608
			Top1 = 399
		End If
		If MyPosition = 34 Then
			Left1 = 608
			Top1 = 342
		End If
		If MyPosition = 33 Then
			Left1 = 608
			Top1 = 285
		End If
		If MyPosition = 32 Then
			Left1 = 608
			Top1 = 228
		End If
		If MyPosition = 31 Then
			Left1 = 608
			Top1 = 171
		End If
		If MyPosition = 30 Then
			Left1 = 608
			Top1 = 114
		End If
		If MyPosition = 29 Then
			Left1 = 608
			Top1 = 57
		End If
		If MyPosition = 28 Then
			Left1 = 608
			Top1 = 0
		End If
		If MyPosition = 27 Then
			Left1 = 540
			Top1 = 0
		End If
		If MyPosition = 26 Then
			Left1 = 473
			Top1 = 0
		End If
		If MyPosition = 25 Then
			Left1 = 404
			Top1 = 0
		End If
		If MyPosition = 24 Then
			Left1 = 337
			Top1 = 0
		End If
		If MyPosition = 23 Then
			Left1 = 269
			Top1 = 0
		End If
		If MyPosition = 22 Then
			Left1 = 201
			Top1 = 0
		End If
		If MyPosition = 21 Then
			Left1 = 133
			Top1 = 0
		End If
		If MyPosition = 20 Then
			Left1 = 66
			Top1 = 0
		End If
		If MyPosition = 19 Then
			Left1 = -2
			Top1 = 0
		End If
		If MyPosition = 18 Then
			Left1 = -2
			Top1 = 57
		End If
		If MyPosition = 17 Then
			Left1 = -2
			Top1 = 144
		End If
		If MyPosition = 16 Then
			Left1 = -2
			Top1 = 171
		End If
		If MyPosition = 15 Then
			Left1 = -2
			Top1 = 228
		End If
		If MyPosition = 14 Then
			Left1 = -2
			Top1 = 285
		End If
		If MyPosition = 13 Then
			Left1 = -2
			Top1 = 342
		End If
		If MyPosition = 12 Then
			Left1 = -2
			Top1 = 399
		End If
		If MyPosition = 11 Then
			Left1 = -2
			Top1 = 456
		End If
		If MyPosition = 10 Then
			Left1 = -2
			Top1 = 513
		End If
		If MyPosition = 9 Then
			Left1 = -2
			Top1 = 570
		End If
		If MyPosition = 8 Then
			Left1 = 66
			Top1 = 570
		End If
		If MyPosition = 7 Then
			Left1 = 134
			Top1 = 570
		End If
		If MyPosition = 6 Then
			Left1 = 202
			Top1 = 570
		End If
		If MyPosition = 5 Then
			Left1 = 269
			Top1 = 570
		End If
		If MyPosition = 4 Then
			Left1 = 337
			Top1 = 570
		End If
		If MyPosition = 3 Then
			Left1 = 405
			Top1 = 570
		End If
		If MyPosition = 2 Then
			Left1 = 473
			Top1 = 570
		End If
		If MyPosition = 1 Then
			Left1 = 540
			Top1 = 570
		End If
	End Sub


What happens is the form appears i click roll and a random amount on the dice comes up. Then the AI goes and works fine. Then i roll again and something happens. Sometimes the ai or player
won't move sometimes moves more than dice sometimes it moves backwards. Could anyone help me. I'd Really appreciate it
Thnx
John
Was This Post Helpful? 0
  • +
  • -

#7 m2s87  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 21
  • View blog
  • Posts: 390
  • Joined: 28-November 06

Re: monopoly

Posted 21 January 2007 - 02:40 PM

First the code is vb.net not vb classic, and it should be posted there. It would be much easier if would make your GUI at runtime by code - so it would be a lot easier to start debugging.

You can use System.Threading.Thread.Sleep(100), to let the system sleep 0,1 second.

But it is probably better if you use listbox to contain data. not show it with msgbox. And do remember you can set Me.Button1.Enabled = False and = True again, so that user could just play like holding key "enter" down.

Hope it helped :D
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1