ий шлях/у - другий шлях/у - третій шлях/г - пункт призначення
а - вільний, їдемо безпосередньо-зайнятий, встаємо на наступний шлях
Малюнок 2 - Автомат Мура
. Блок схема
Вільний Зайнятий
Вільний Зайнятий
5. Лістинг програми
Option Explicit
Dim w, hk, dlmass () As Single, i%, j%, sv%, sv1%, ti%, fl As Booleany1 (x As Single) As Single = 0Functiony2 (x As Single ) As Single = (x - w/2) Functiony3 (x As Single) As Single = - (x - w/2) Function
Sub Combo1_Click () = Combo1mass (1 To 2, 1 To k) j = 0 To 9 (j). Visible = Falsejj = 0 To k - 1 (j). Visible = TruejSub p>
Sub Combo2_Click () = Combo2.ListIndex + 1SubSub Command2_Click (). Enabled = Not (Timer1.Enabled) Sub
Sub Form_Load (). AutoRedraw = True.Width = 2 * Picture1.Height.Scale (0, -500) - (1000, 500). DrawWidth = 4: Picture1.ForeColor = & HC0C0C0
= Picture1.ScaleWidth: h = Picture1.ScaleHeight.Width = w: Shape2.Height = h.FillColor = Picture1.BackColor.Width = Picture1.Width + 100.Height = Picture1.Height + 1000 . Enabled = False.Interval = 10
i = 0 To 2 (i). Left = (Picture2.ScaleWidth - Shape1 (i). Width)/2 (i). Top = Shape1 (i). Height/2 + 1.5 * i * Shape1 (i). Height (i). BackStyle = 1 (i). BackColor = vbRed (i). BackColor = Me.BackColor (i). Visible = Falsei
. Left = w/2 + Picture2.Width.Top =-Picture2.Height/2 = 17.Line (0, 0) - (w, 0). Line (w/2, 0 ) - (w, h/2). Line (w/2, 0) - (w,-h/2)
i = 1 To 10.AddItem i.AddItem i * 10 + 40 & "km/u" i.ListIndex = 7 = Combo1mass (1 To 2, 1 To k) j = 0 To 9 (j). Visible = Falsejj = 1 To k (j - 1). Visible = Truej.ListIndex = 4 = Combo2.ListIndex + 1
= FalseSub
Sub Option1_Click (Index As Integer) = Index (sv). Value = True.Left = Option1 (Index). Lefti = 0 To 2 (i). Visible = IndexiSub
Sub Option2_Click (Index As Integer) fl = True Then sv1 = IndexSub
Sub Timer1_Timer () mass (1, UBound (mass) - 1)> w * 1.1 Then
mass (1 To 2, 1 To k) If
(1, 1) = mass (1, 1) + ti (2, 1) = mass (1, 1) - dli = 2 To k (1, i) = mass (1, 1) - (i - 1) * (dl + 10) (2, i) = mass (1, i) - dli
mass (1, 1)
fl = False Then: sv = Int (Rnd * 3) = sv1Ifi = 0 To 2 (i). BackColor = vbRedi (sv). BackColor = vbGreenIf
i = 1 To kmass (1, i...