mirror of
https://github.com/ivabus/roulette
synced 2024-11-25 09:55:08 +03:00
Code cleanup
This commit is contained in:
parent
c325db2fd7
commit
1f84830c17
1 changed files with 109 additions and 89 deletions
|
@ -1,41 +1,49 @@
|
||||||
Imports System
|
|
||||||
|
|
||||||
Module Program
|
Module Program
|
||||||
'https://github.com/BushchikIvan/roulette
|
'https://github.com/BushchikIvan/roulette
|
||||||
Dim ring(,) As Integer = {{0, 32, 15, 19, 4, 21, 2, 25, 17, 34, 6, 27, 13, 36, 11, 30, 8, 23, 10, 5, 24, 16, 33, 1, 20, 14, 31, 9, 22,18, 29, 7, 28, 12, 35, 3, 26},
|
Dim ReadOnly _
|
||||||
{0, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2}}
|
ring(,) As Integer =
|
||||||
Dim colors() As ConsoleColor = {ConsoleColor.White, ConsoleColor.Red, ConsoleColor.Black}
|
{{0, 32, 15, 19, 4, 21, 2, 25, 17, 34, 6, 27, 13, 36, 11, 30, 8, 23, 10, 5, 24, 16, 33, 1, 20, 14, 31, 9, 22, 18, 29,
|
||||||
Dim ringRank0() As Integer = {0, 32, 15, 19, 4, 21, 2, 25, 17, 34, 6, 27, 13, 36, 11, 30, 8, 23, 10, 5, 24, 16, 33, 1, 20, 14, 31, 9, 22,18, 29, 7, 28, 12, 35, 3, 26}
|
7, 28, 12, 35, 3, 26},
|
||||||
|
{0, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2}}
|
||||||
|
|
||||||
|
Dim ReadOnly colors() As ConsoleColor = {ConsoleColor.White, ConsoleColor.Red, ConsoleColor.Black}
|
||||||
|
|
||||||
|
Dim ReadOnly _
|
||||||
|
ringRank0() As Integer =
|
||||||
|
{0, 32, 15, 19, 4, 21, 2, 25, 17, 34, 6, 27, 13, 36, 11, 30, 8, 23, 10, 5, 24, 16, 33, 1, 20, 14, 31, 9, 22, 18, 29,
|
||||||
|
7, 28, 12, 35, 3, 26}
|
||||||
'ringRank0 нужен, чтобы было удобно подавать массив в поиск индекса
|
'ringRank0 нужен, чтобы было удобно подавать массив в поиск индекса
|
||||||
Dim logo() As String = {
|
Dim ReadOnly logo() As String = { _
|
||||||
"#### ### # # # ##### ##### ##### #####",
|
"#### ### # # # ##### ##### ##### #####",
|
||||||
"# # # # # # # # # # # ",
|
"# # # # # # # # # # # ",
|
||||||
"# # # # # # # # # # # ",
|
"# # # # # # # # # # # ",
|
||||||
"# # # # # # # # # # # ",
|
"# # # # # # # # # # # ",
|
||||||
"#### # # # # # #### # # #### ",
|
"#### # # # # # #### # # #### ",
|
||||||
"## # # # # # # # # # ",
|
"## # # # # # # # # # ",
|
||||||
"# # # # # # # # # # # ",
|
"# # # # # # # # # # # ",
|
||||||
"# # # # # # # # # # # ",
|
"# # # # # # # # # # # ",
|
||||||
"# # ### ### ##### ##### # # ##### "}
|
"# # ### ### ##### ##### # # ##### "}
|
||||||
|
|
||||||
Function GetIndex(mass() As Integer, obj As Integer) As Integer 'Функция получает индекс объекта в массиве
|
Function GetIndex(mass() As Integer, obj As Integer) As Integer 'Функция получает индекс объекта в массиве
|
||||||
For i = 0 To UBound(mass)
|
For i = 0 To UBound(mass)
|
||||||
If mass(i) = obj Then Return i
|
If mass(i) = obj Then Return i
|
||||||
Next
|
Next
|
||||||
Return -1
|
Return - 1
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Sub displayHistory(history() As Integer)
|
Sub displayHistory(history() As Integer)
|
||||||
Console.ForegroundColor = ConsoleColor.DarkBlue
|
Console.ForegroundColor = ConsoleColor.DarkBlue
|
||||||
Console.Write("История выпадений (последние 15): ")
|
Console.Write("История выпадений (последние 15): ")
|
||||||
For i = If(Ubound(history) > 14, Ubound(history) - 14, 0) To UBound(history)
|
For i = If(Ubound(history) > 14, Ubound(history) - 14, 0) To UBound(history)
|
||||||
Console.ForegroundColor = colors(ring(1,getindex(ringRank0, history(i))))
|
Console.ForegroundColor = colors(ring(1, getindex(ringRank0, history(i))))
|
||||||
Console.Write(history(i) & " ")
|
Console.Write(history(i) & " ")
|
||||||
Next
|
Next
|
||||||
Console.ForegroundColor = ConsoleColor.DarkBlue
|
Console.ForegroundColor = ConsoleColor.DarkBlue
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Function RemoveAt(Of T)(ByVal arr As T(), ByVal index As Integer) As T()
|
Function RemoveAt (Of T)(arr As T(), index As Integer) As T()
|
||||||
Dim uBound = arr.GetUpperBound(0)
|
Dim uBound = arr.GetUpperBound(0)
|
||||||
Dim lBound = arr.GetLowerBound(0)
|
Dim lBound = arr.GetLowerBound(0)
|
||||||
Dim arrLen = uBound - lBound
|
Dim arrLen = uBound - lBound
|
||||||
|
@ -44,66 +52,70 @@ Module Program
|
||||||
Array.Copy(arr, index + 1, outArr, index, uBound - index)
|
Array.Copy(arr, index + 1, outArr, index, uBound - index)
|
||||||
Return outArr
|
Return outArr
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Sub sleep(d As Single)
|
Sub sleep(d As Single)
|
||||||
Dim t As Single = Timer
|
Dim t As Single = Timer
|
||||||
Do while Timer - t < d
|
Do while Timer - t < d
|
||||||
Loop
|
Loop
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Sub intro()
|
Sub intro()
|
||||||
Console.ForegroundColor = ConsoleColor.DarkBlue
|
Console.ForegroundColor = ConsoleColor.DarkBlue
|
||||||
Console.SetCursorPosition(Console.WindowWidth \ 2 - Len(logo(0))\2,Console.WindowHeight()\2 - UBound(logo) + 3)
|
Console.SetCursorPosition(Console.WindowWidth\2 - Len(logo(0))\2, Console.WindowHeight()\2 - UBound(logo) + 3)
|
||||||
For i = 0 To UBound(logo)
|
For i = 0 To UBound(logo)
|
||||||
Console.WriteLine(logo(i))
|
Console.WriteLine(logo(i))
|
||||||
Console.SetCursorPosition(Console.WindowWidth \ 2 - Len(logo(0))\2, Console.GetCursorPosition().Item2)
|
Console.SetCursorPosition(Console.WindowWidth\2 - Len(logo(0))\2, Console.GetCursorPosition().Item2)
|
||||||
sleep(0.04444)
|
sleep(0.04444)
|
||||||
Next
|
Next
|
||||||
'sleep(5)
|
'sleep(5)
|
||||||
Console.SetCursorPosition(0,0)
|
Console.SetCursorPosition(0, 0)
|
||||||
For i = 0 To (Console.WindowHeight()\2 - UBound(logo) + 2) \ 2
|
For i = 0 To (Console.WindowHeight()\2 - UBound(logo) + 2)\2
|
||||||
Console.WriteLine(StrDup(Console.WindowWidth-1, "#"))
|
Console.WriteLine(StrDup(Console.WindowWidth - 1, "#"))
|
||||||
sleep(0.04444)
|
sleep(0.04444)
|
||||||
Next
|
Next
|
||||||
For i = 0 To Console.WindowHeight - (Console.WindowHeight()\2 - UBound(logo) + 2) - 3
|
For i = 0 To Console.WindowHeight - (Console.WindowHeight()\2 - UBound(logo) + 2) - 3
|
||||||
Console.Write(StrDup((Console.WindowWidth \ 2 - Len(logo(0)) \ 2) \ 2, "#"))
|
Console.Write(StrDup((Console.WindowWidth\2 - Len(logo(0))\2)\2, "#"))
|
||||||
Console.SetCursorPosition(Console.WindowWidth - (Console.WindowWidth \ 2 - Len(logo(0)) \ 2) \ 2, (Console.GetCursorPosition().Item2))
|
Console.SetCursorPosition(Console.WindowWidth - (Console.WindowWidth\2 - Len(logo(0))\2)\2,
|
||||||
Console.WriteLine(StrDup((Console.WindowWidth \ 2 - Len(logo(0)) \ 2) \ 2 - 1, "#"))
|
(Console.GetCursorPosition().Item2))
|
||||||
|
Console.WriteLine(StrDup((Console.WindowWidth\2 - Len(logo(0))\2)\2 - 1, "#"))
|
||||||
sleep(0.04444)
|
sleep(0.04444)
|
||||||
Next
|
Next
|
||||||
For i = 0 To (Console.WindowHeight()\2 - UBound(logo) + 2) \ 2 - 1
|
For i = 0 To (Console.WindowHeight()\2 - UBound(logo) + 2)\2 - 1
|
||||||
Console.WriteLine(StrDup(Console.WindowWidth-1, "#"))
|
Console.WriteLine(StrDup(Console.WindowWidth - 1, "#"))
|
||||||
sleep(0.04444)
|
sleep(0.04444)
|
||||||
Next
|
Next
|
||||||
Dim entr As String = " Нажмите любую кнопку, чтобы начать игру! "
|
Dim entr = " Нажмите любую кнопку, чтобы начать игру! "
|
||||||
Console.SetCursorPosition((Console.WindowWidth \ 2) - Len(entr) \ 2,Console.WindowHeight - (Console.WindowHeight()\2 - UBound(logo) + 2) \ 4 - 3)
|
Console.SetCursorPosition((Console.WindowWidth\2) - Len(entr)\2,
|
||||||
|
Console.WindowHeight - (Console.WindowHeight()\2 - UBound(logo) + 2)\4 - 3)
|
||||||
Console.Write(StrDup(Len(entr) + 2, " "))
|
Console.Write(StrDup(Len(entr) + 2, " "))
|
||||||
|
|
||||||
Console.SetCursorPosition((Console.WindowWidth \ 2) - Len(entr) \ 2,Console.WindowHeight - (Console.WindowHeight()\2 - UBound(logo) + 2) \ 4 - 2)
|
Console.SetCursorPosition((Console.WindowWidth\2) - Len(entr)\2,
|
||||||
|
Console.WindowHeight - (Console.WindowHeight()\2 - UBound(logo) + 2)\4 - 2)
|
||||||
Console.Write(entr & " ")
|
Console.Write(entr & " ")
|
||||||
|
|
||||||
Console.SetCursorPosition((Console.WindowWidth \ 2) - Len(entr) \ 2,Console.WindowHeight - (Console.WindowHeight()\2 - UBound(logo) + 2) \ 4 - 1)
|
Console.SetCursorPosition((Console.WindowWidth\2) - Len(entr)\2,
|
||||||
|
Console.WindowHeight - (Console.WindowHeight()\2 - UBound(logo) + 2)\4 - 1)
|
||||||
Console.Write(StrDup(Len(entr) + 2, " "))
|
Console.Write(StrDup(Len(entr) + 2, " "))
|
||||||
Console.SetCursorPosition(0,0)
|
Console.SetCursorPosition(0, 0)
|
||||||
Console.ReadKey
|
Console.ReadKey
|
||||||
Console.Clear
|
Console.Clear
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Function spinWheel() As String()
|
Function spinWheel() As String()
|
||||||
Dim rnd As New Random
|
Dim rnd As New Random
|
||||||
Dim probability(36) As Double
|
Dim probability(36) As Double
|
||||||
Dim whatDropped As New List(Of String)
|
Dim whatDropped As New List(Of String)
|
||||||
|
|
||||||
For k = 0 To rnd.Next(1,5)
|
For k = 0 To rnd.Next(1, 5)
|
||||||
For i = 0 To rnd.Next(1,rnd.Next(5,100))
|
For i = 0 To rnd.Next(1, rnd.Next(5, 100))
|
||||||
rnd.NextDouble()
|
rnd.NextDouble()
|
||||||
Randomize
|
Randomize
|
||||||
Next
|
Next
|
||||||
Next
|
Next
|
||||||
|
|
||||||
Dim max As Double = 0
|
Dim max As Double = 0
|
||||||
Dim dropped As Integer
|
Dim dropped As Integer
|
||||||
|
|
||||||
For i = 0 To 36
|
For i = 0 To 36
|
||||||
probability(i) = rnd.NextDouble()
|
probability(i) = rnd.NextDouble()
|
||||||
if probability(i) > max then
|
if probability(i) > max then
|
||||||
|
@ -111,16 +123,16 @@ Module Program
|
||||||
dropped = i
|
dropped = i
|
||||||
End If
|
End If
|
||||||
Next
|
Next
|
||||||
|
|
||||||
whatDropped.Add(ring(0,dropped).ToString())
|
whatDropped.Add(ring(0, dropped).ToString())
|
||||||
|
|
||||||
If dropped = 0 Then return whatDropped.ToArray()
|
If dropped = 0 Then return whatDropped.ToArray()
|
||||||
If ring(0, dropped) mod 2 = 0 And dropped > 0
|
If ring(0, dropped) mod 2 = 0 And dropped > 0
|
||||||
whatDropped.Add("EVEN")
|
whatDropped.Add("EVEN")
|
||||||
Else
|
Else
|
||||||
whatDropped.Add("ODD")
|
whatDropped.Add("ODD")
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If ring(0, dropped) mod 3 = 0 And dropped > 0
|
If ring(0, dropped) mod 3 = 0 And dropped > 0
|
||||||
whatDropped.Add("3L")
|
whatDropped.Add("3L")
|
||||||
Else If ring(0, dropped) mod 3 = 1
|
Else If ring(0, dropped) mod 3 = 1
|
||||||
|
@ -128,38 +140,38 @@ Module Program
|
||||||
Else
|
Else
|
||||||
whatDropped.Add("1L")
|
whatDropped.Add("1L")
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If ring(1,dropped) = 1
|
If ring(1, dropped) = 1
|
||||||
whatDropped.Add("RED")
|
whatDropped.Add("RED")
|
||||||
Else If ring(1,dropped) = 2
|
Else If ring(1, dropped) = 2
|
||||||
whatDropped.Add("BLACK")
|
whatDropped.Add("BLACK")
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If ring(0, dropped) > 0 And ring(0, dropped) <= 12
|
If ring(0, dropped) > 0 And ring(0, dropped) <= 12
|
||||||
whatDropped.Add("F12")
|
whatDropped.Add("F12")
|
||||||
Else If ring(0, dropped) > 12 And ring(0, dropped) <= 24
|
Else If ring(0, dropped) > 12 And ring(0, dropped) <= 24
|
||||||
whatDropped.Add("S12")
|
whatDropped.Add("S12")
|
||||||
Else If ring(0, dropped) > 24
|
Else If ring(0, dropped) > 24
|
||||||
whatDropped.Add("T12")
|
whatDropped.Add("T12")
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If ring(0,dropped) > 0 And ring(0,dropped) < 19
|
If ring(0, dropped) > 0 And ring(0, dropped) < 19
|
||||||
whatDropped.Add("TO18")
|
whatDropped.Add("TO18")
|
||||||
ElseIf ring(0,dropped) > 18
|
ElseIf ring(0, dropped) > 18
|
||||||
whatDropped.Add("FROM18")
|
whatDropped.Add("FROM18")
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Return whatDropped.ToArray()
|
Return whatDropped.ToArray()
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Sub display(dropped As Integer)
|
Sub display(dropped As Integer)
|
||||||
Console.BackgroundColor = ConsoleColor.Green
|
Console.BackgroundColor = ConsoleColor.Green
|
||||||
Console.Clear()
|
Console.Clear()
|
||||||
|
|
||||||
If ring(0,0) <> dropped
|
If ring(0, 0) <> dropped
|
||||||
Console.BackgroundColor = ConsoleColor.Black
|
Console.BackgroundColor = ConsoleColor.Black
|
||||||
Console.ForegroundColor = colors(ring(1,0))
|
Console.ForegroundColor = colors(ring(1, 0))
|
||||||
Console.Write(ring(0,0) & " ")
|
Console.Write(ring(0, 0) & " ")
|
||||||
Console.BackgroundColor = ConsoleColor.Green
|
Console.BackgroundColor = ConsoleColor.Green
|
||||||
Else
|
Else
|
||||||
Console.BackgroundColor = ConsoleColor.White
|
Console.BackgroundColor = ConsoleColor.White
|
||||||
|
@ -170,12 +182,12 @@ Module Program
|
||||||
End If
|
End If
|
||||||
|
|
||||||
For i = 1 To 36
|
For i = 1 To 36
|
||||||
If ring(0,i) <> dropped
|
If ring(0, i) <> dropped
|
||||||
Console.ForegroundColor = colors(ring(1,i))
|
Console.ForegroundColor = colors(ring(1, i))
|
||||||
Console.Write(ring(0,i) & " ")
|
Console.Write(ring(0, i) & " ")
|
||||||
Else
|
Else
|
||||||
Console.BackgroundColor = ConsoleColor.White
|
Console.BackgroundColor = ConsoleColor.White
|
||||||
Console.ForegroundColor = colors(ring(1,i))
|
Console.ForegroundColor = colors(ring(1, i))
|
||||||
Console.Write(ring(0, i))
|
Console.Write(ring(0, i))
|
||||||
Console.BackgroundColor = ConsoleColor.Green
|
Console.BackgroundColor = ConsoleColor.Green
|
||||||
Console.Write(" ")
|
Console.Write(" ")
|
||||||
|
@ -189,11 +201,11 @@ Module Program
|
||||||
For i = 3 To 36 Step 3
|
For i = 3 To 36 Step 3
|
||||||
temp = GetIndex(ringRank0, i)
|
temp = GetIndex(ringRank0, i)
|
||||||
If i <> dropped
|
If i <> dropped
|
||||||
Console.ForegroundColor = colors(ring(1,temp))
|
Console.ForegroundColor = colors(ring(1, temp))
|
||||||
Console.Write("{0,2:G} ", i)
|
Console.Write("{0,2:G} ", i)
|
||||||
Else
|
Else
|
||||||
Console.BackgroundColor = ConsoleColor.White
|
Console.BackgroundColor = ConsoleColor.White
|
||||||
Console.ForegroundColor = colors(ring(1,temp))
|
Console.ForegroundColor = colors(ring(1, temp))
|
||||||
Console.Write("{0,2:G}", i)
|
Console.Write("{0,2:G}", i)
|
||||||
Console.BackgroundColor = ConsoleColor.Green
|
Console.BackgroundColor = ConsoleColor.Green
|
||||||
Console.Write(" ")
|
Console.Write(" ")
|
||||||
|
@ -207,11 +219,11 @@ Module Program
|
||||||
For i = 2 To 36 Step 3
|
For i = 2 To 36 Step 3
|
||||||
temp = GetIndex(ringRank0, i)
|
temp = GetIndex(ringRank0, i)
|
||||||
If i <> dropped
|
If i <> dropped
|
||||||
Console.ForegroundColor = colors(ring(1,temp))
|
Console.ForegroundColor = colors(ring(1, temp))
|
||||||
Console.Write("{0,2:G} ", i)
|
Console.Write("{0,2:G} ", i)
|
||||||
Else
|
Else
|
||||||
Console.BackgroundColor = ConsoleColor.White
|
Console.BackgroundColor = ConsoleColor.White
|
||||||
Console.ForegroundColor = colors(ring(1,temp))
|
Console.ForegroundColor = colors(ring(1, temp))
|
||||||
Console.Write("{0,2:G}", i)
|
Console.Write("{0,2:G}", i)
|
||||||
Console.BackgroundColor = ConsoleColor.Green
|
Console.BackgroundColor = ConsoleColor.Green
|
||||||
Console.Write(" ")
|
Console.Write(" ")
|
||||||
|
@ -225,11 +237,11 @@ Module Program
|
||||||
For i = 1 To 36 Step 3
|
For i = 1 To 36 Step 3
|
||||||
temp = GetIndex(ringRank0, i)
|
temp = GetIndex(ringRank0, i)
|
||||||
If i <> dropped
|
If i <> dropped
|
||||||
Console.ForegroundColor = colors(ring(1,temp))
|
Console.ForegroundColor = colors(ring(1, temp))
|
||||||
Console.Write("{0,2:G} ", i)
|
Console.Write("{0,2:G} ", i)
|
||||||
Else
|
Else
|
||||||
Console.BackgroundColor = ConsoleColor.White
|
Console.BackgroundColor = ConsoleColor.White
|
||||||
Console.ForegroundColor = colors(ring(1,temp))
|
Console.ForegroundColor = colors(ring(1, temp))
|
||||||
Console.Write("{0,2:G}", i)
|
Console.Write("{0,2:G}", i)
|
||||||
Console.BackgroundColor = ConsoleColor.Green
|
Console.BackgroundColor = ConsoleColor.Green
|
||||||
Console.Write(" ")
|
Console.Write(" ")
|
||||||
|
@ -242,14 +254,15 @@ Module Program
|
||||||
Console.WriteLine(" F12 | S12 | T12 ")
|
Console.WriteLine(" F12 | S12 | T12 ")
|
||||||
Console.ForegroundColor = ConsoleColor.DarkBlue
|
Console.ForegroundColor = ConsoleColor.DarkBlue
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Sub rules()
|
Sub rules()
|
||||||
Console.Clear
|
Console.Clear
|
||||||
Console.ForegroundColor = ConsoleColor.DarkBlue
|
Console.ForegroundColor = ConsoleColor.DarkBlue
|
||||||
Console.WriteLine("Рекомендуемое разрешение консоли: 100x35")
|
Console.WriteLine("Рекомендуемое разрешение консоли: 100x35")
|
||||||
Console.WriteLine("Минимальное разрешение консоли: 100х20")
|
Console.WriteLine("Минимальное разрешение консоли: 100х20")
|
||||||
Console.WriteLine("Правила:")
|
Console.WriteLine("Правила:")
|
||||||
Console.WriteLine("Игра представляет собой Европейскую рулетку. Игрок должен сделать ставку на определённую зону, будь то число, сектор, строка, чётность или цвет. Игрок может делать несколько ставок. Ставки вводятся в предоставленную зону через пробел.")
|
Console.WriteLine(
|
||||||
|
"Игра представляет собой Европейскую рулетку. Игрок должен сделать ставку на определённую зону, будь то число, сектор, строка, чётность или цвет. Игрок может делать несколько ставок. Ставки вводятся в предоставленную зону через пробел.")
|
||||||
Console.WriteLine("<число 0 - 36> - ставка на число (1:36).")
|
Console.WriteLine("<число 0 - 36> - ставка на число (1:36).")
|
||||||
Console.WriteLine("1L/2L/3L - 1/2/3 линия соответственно, снизу вверх (1:3).")
|
Console.WriteLine("1L/2L/3L - 1/2/3 линия соответственно, снизу вверх (1:3).")
|
||||||
Console.WriteLine("F12/S12/T12 - ставка на сектора от 1 по 12/от 13 по 24/от 25 по 36 соответственно (1:3).")
|
Console.WriteLine("F12/S12/T12 - ставка на сектора от 1 по 12/от 13 по 24/от 25 по 36 соответственно (1:3).")
|
||||||
|
@ -257,21 +270,23 @@ Module Program
|
||||||
Console.WriteLine("TO18/FROM18 - ставка на сектор от 1 по 18/от 19 по 36 (1:2).")
|
Console.WriteLine("TO18/FROM18 - ставка на сектор от 1 по 18/от 19 по 36 (1:2).")
|
||||||
Console.WriteLine("EVEN/ODD - чётные/нечётные (1:2).")
|
Console.WriteLine("EVEN/ODD - чётные/нечётные (1:2).")
|
||||||
Console.WriteLine("Игрок изначально получает 5000 фишек.")
|
Console.WriteLine("Игрок изначально получает 5000 фишек.")
|
||||||
Console.WriteLine("После того, как игрок укажет, на что ставит, он указывает количество фишек на каждую ставку через пробел.")
|
Console.WriteLine(
|
||||||
|
"После того, как игрок укажет, на что ставит, он указывает количество фишек на каждую ставку через пробел.")
|
||||||
Console.WriteLine("Например:")
|
Console.WriteLine("Например:")
|
||||||
Console.WriteLine("Делайте ставки >>> 0 16 2L T12 RED ODD")
|
Console.WriteLine("Делайте ставки >>> 0 16 2L T12 RED ODD")
|
||||||
Console.WriteLine("Укажите суммы ставок >>> 100 50 500 500 1000 1000")
|
Console.WriteLine("Укажите суммы ставок >>> 100 50 500 500 1000 1000")
|
||||||
Console.WriteLine("ВНИМАНИЕ! Количество ставок должно совпадать с количеством фишек, которые ставите, в примере 6 = 6.")
|
Console.WriteLine(
|
||||||
|
"ВНИМАНИЕ! Количество ставок должно совпадать с количеством фишек, которые ставите, в примере 6 = 6.")
|
||||||
Console.WriteLine("Или просто нажмите ENTER, чтобы пропустить ставку.")
|
Console.WriteLine("Или просто нажмите ENTER, чтобы пропустить ставку.")
|
||||||
Console.WriteLine("Удачи!")
|
Console.WriteLine("Удачи!")
|
||||||
Console.ReadKey()
|
Console.ReadKey()
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Sub game()
|
Sub game()
|
||||||
Console.WriteLine("Игра началась!")
|
Console.WriteLine("Игра началась!")
|
||||||
Dim fish As Long = 5000
|
Dim fish As Long = 5000
|
||||||
Dim history As New List(Of Integer)
|
Dim history As New List(Of Integer)
|
||||||
|
|
||||||
Do while fish > 0
|
Do while fish > 0
|
||||||
Console.ForegroundColor = ConsoleColor.DarkBlue
|
Console.ForegroundColor = ConsoleColor.DarkBlue
|
||||||
Console.WriteLine("У Вас {0} фишек.", fish)
|
Console.WriteLine("У Вас {0} фишек.", fish)
|
||||||
|
@ -285,11 +300,11 @@ Module Program
|
||||||
Else
|
Else
|
||||||
Console.WriteLine("Неверный ввод, продолжаем игру.")
|
Console.WriteLine("Неверный ввод, продолжаем игру.")
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Dim generated() As String = spinWheel()
|
Dim generated() As String = spinWheel()
|
||||||
Console.Clear
|
Console.Clear
|
||||||
history.Add(generated(0))
|
history.Add(generated(0))
|
||||||
|
|
||||||
Console.WriteLine("Делайте ставки:")
|
Console.WriteLine("Делайте ставки:")
|
||||||
Console.Write(">>> ")
|
Console.Write(">>> ")
|
||||||
Dim stav As New List(Of String)
|
Dim stav As New List(Of String)
|
||||||
|
@ -327,15 +342,19 @@ Module Program
|
||||||
If stav.Contains(generated(i)) Then
|
If stav.Contains(generated(i)) Then
|
||||||
indedx = stav.IndexOf(generated(i))
|
indedx = stav.IndexOf(generated(i))
|
||||||
If IsNumeric(generated(i))
|
If IsNumeric(generated(i))
|
||||||
fish += summ(indedx) * 35
|
fish += summ(indedx)*35
|
||||||
'stav.RemoveAt(indedx)
|
'stav.RemoveAt(indedx)
|
||||||
'summs.RemoveAt(indedx)
|
'summs.RemoveAt(indedx)
|
||||||
Else If generated(i) = "RED" Or generated(i) = "BLACK" Or generated(i) = "ODD" Or generated(i) = "EVEN" Or generated(i) = "FROM18" Or generated(i) = "TO18" Then
|
Else If _
|
||||||
fish += summ(indedx) * 1
|
generated(i) = "RED" Or generated(i) = "BLACK" Or generated(i) = "ODD" Or generated(i) = "EVEN" Or
|
||||||
|
generated(i) = "FROM18" Or generated(i) = "TO18" Then
|
||||||
|
fish += summ(indedx)*1
|
||||||
'stav.RemoveAt(indedx)
|
'stav.RemoveAt(indedx)
|
||||||
'summs.RemoveAt(indedx)
|
'summs.RemoveAt(indedx)
|
||||||
Else If generated(i) = "3L" Or generated(i) = "2L" Or generated(i) = "1L" Or generated(i) = "F12" Or generated(i) = "S12" Or generated(i) = "T12" Then
|
Else If _
|
||||||
fish += summ(indedx) * 2
|
generated(i) = "3L" Or generated(i) = "2L" Or generated(i) = "1L" Or generated(i) = "F12" Or generated(i) = "S12" Or
|
||||||
|
generated(i) = "T12" Then
|
||||||
|
fish += summ(indedx)*2
|
||||||
'stav.RemoveAt(indedx)
|
'stav.RemoveAt(indedx)
|
||||||
'summs.RemoveAt(indedx)
|
'summs.RemoveAt(indedx)
|
||||||
End If
|
End If
|
||||||
|
@ -360,7 +379,7 @@ Module Program
|
||||||
Console.WriteLine("Нажмите любую кнопку, чтобы выйти в меню.")
|
Console.WriteLine("Нажмите любую кнопку, чтобы выйти в меню.")
|
||||||
Console.ReadKey()
|
Console.ReadKey()
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Sub Main()
|
Sub Main()
|
||||||
Console.BackgroundColor = ConsoleColor.Green
|
Console.BackgroundColor = ConsoleColor.Green
|
||||||
Console.ForegroundColor = ConsoleColor.DarkBlue
|
Console.ForegroundColor = ConsoleColor.DarkBlue
|
||||||
|
@ -373,7 +392,8 @@ Module Program
|
||||||
Console.WriteLine("3) Выйти из игры")
|
Console.WriteLine("3) Выйти из игры")
|
||||||
Console.Write(">>> ")
|
Console.Write(">>> ")
|
||||||
Dim input As Char = Console.ReadKey.KeyChar
|
Dim input As Char = Console.ReadKey.KeyChar
|
||||||
Dim n As Integer = If(Int(input.ToString()) = 1 Or Int(input.ToString()) = 2 Or Int(input.ToString()) = 3, Int(input.ToString()), 0)
|
Dim n As Integer =
|
||||||
|
If(Int(input.ToString()) = 1 Or Int(input.ToString()) = 2 Or Int(input.ToString()) = 3, Int(input.ToString()), 0)
|
||||||
Select Case n
|
Select Case n
|
||||||
Case 0
|
Case 0
|
||||||
Console.WriteLine()
|
Console.WriteLine()
|
||||||
|
|
Loading…
Reference in a new issue