mirror of
https://github.com/ivabus/roulette
synced 2025-06-08 00:00:29 +03:00
Clearing code
This commit is contained in:
parent
9cd2aac5c4
commit
f86b9d41c4
1 changed files with 378 additions and 383 deletions
|
@ -1,387 +1,382 @@
|
||||||
Imports System
|
Imports System
|
||||||
|
|
||||||
Module Program
|
Module Program
|
||||||
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 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},
|
||||||
{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}}
|
{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 colors() As ConsoleColor = {ConsoleColor.White, ConsoleColor.Red, ConsoleColor.Black}
|
Dim colors() As ConsoleColor = {ConsoleColor.White, ConsoleColor.Red, ConsoleColor.Black}
|
||||||
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}
|
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}
|
||||||
Dim intr() As String = {
|
Dim intr() 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
|
||||||
End Function
|
Return -1
|
||||||
|
End Function
|
||||||
|
|
||||||
Sub displayHistory(history() As Integer)
|
Sub displayHistory(history() As Integer)
|
||||||
Console.ForegroundColor = ConsoleColor.DarkBlue
|
Console.ForegroundColor = ConsoleColor.DarkBlue
|
||||||
Console.Write("История выпадений (последние 10): ")
|
Console.Write("История выпадений (последние 15): ")
|
||||||
Dim start As Integer = If(Ubound(history) > 9, Ubound(history) - 10, 0)
|
For i = If(Ubound(history) > 14, Ubound(history) - 15, 0) To UBound(history)
|
||||||
For i = start 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)(ByVal arr As T(), ByVal 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
|
||||||
|
Dim outArr(arrLen - 1) As T
|
||||||
|
Array.Copy(arr, 0, outArr, 0, index)
|
||||||
|
Array.Copy(arr, index + 1, outArr, index, uBound - index)
|
||||||
|
Return outArr
|
||||||
|
End Function
|
||||||
|
|
||||||
If index < lBound OrElse index > uBound Then
|
Sub sleep(d As Single)
|
||||||
Throw New ArgumentOutOfRangeException( _
|
Dim t As Single = Timer
|
||||||
String.Format("Index must be from {0} to {1}.", lBound, uBound))
|
Do while Timer - t < d
|
||||||
Else
|
Loop
|
||||||
Dim outArr(arrLen - 1) As T
|
End Sub
|
||||||
Array.Copy(arr, 0, outArr, 0, index)
|
|
||||||
Array.Copy(arr, index + 1, outArr, index, uBound - index)
|
|
||||||
Return outArr
|
|
||||||
End If
|
|
||||||
End Function
|
|
||||||
|
|
||||||
Sub sleep(d As Single)
|
Sub intro()
|
||||||
Dim t As Single = Timer
|
Console.ForegroundColor = ConsoleColor.DarkBlue
|
||||||
Do while Timer - t < d
|
Console.SetCursorPosition(Console.WindowWidth \ 2 - Len(intr(0))\2,Console.WindowHeight()\2 - UBound(intr) + 3)
|
||||||
Loop
|
For i = 0 To UBound(intr)
|
||||||
End Sub
|
Console.WriteLine(intr(i))
|
||||||
|
Console.SetCursorPosition(Console.WindowWidth \ 2 - Len(intr(0))\2, Console.GetCursorPosition().Item2)
|
||||||
|
sleep(0.04444)
|
||||||
|
Next
|
||||||
|
'sleep(5)
|
||||||
|
Console.SetCursorPosition(0,0)
|
||||||
|
For i = 0 To (Console.WindowHeight()\2 - UBound(intr) + 2) \ 2
|
||||||
|
Console.WriteLine(StrDup(Console.WindowWidth-1, "#"))
|
||||||
|
sleep(0.04444)
|
||||||
|
Next
|
||||||
|
For i = 0 To Console.WindowHeight - (Console.WindowHeight()\2 - UBound(intr) + 2) - 3
|
||||||
|
Console.Write(StrDup((Console.WindowWidth \ 2 - Len(intr(0)) \ 2) \ 2, "#"))
|
||||||
|
Console.SetCursorPosition(Console.WindowWidth - (Console.WindowWidth \ 2 - Len(intr(0)) \ 2) \ 2, (Console.GetCursorPosition().Item2))
|
||||||
|
Console.WriteLine(StrDup((Console.WindowWidth \ 2 - Len(intr(0)) \ 2) \ 2 - 1, "#"))
|
||||||
|
sleep(0.04444)
|
||||||
|
Next
|
||||||
|
For i = 0 To (Console.WindowHeight()\2 - UBound(intr) + 2) \ 2
|
||||||
|
Console.WriteLine(StrDup(Console.WindowWidth-1, "#"))
|
||||||
|
sleep(0.04444)
|
||||||
|
Next
|
||||||
|
Dim entr As String = " Нажмите любую кнопку, чтобы начать игру! "
|
||||||
|
Console.SetCursorPosition((Console.WindowWidth \ 2) - Len(entr) \ 2,Console.WindowHeight - (Console.WindowHeight()\2 - UBound(intr) + 2) \ 4 - 1)
|
||||||
|
Console.Write(StrDup(Len(entr) + 2, " "))
|
||||||
|
|
||||||
Sub intro()
|
Console.SetCursorPosition((Console.WindowWidth \ 2) - Len(entr) \ 2,Console.WindowHeight - (Console.WindowHeight()\2 - UBound(intr) + 2) \ 4)
|
||||||
Console.ForegroundColor = ConsoleColor.DarkBlue
|
Console.Write(entr & " ")
|
||||||
Console.SetCursorPosition(Console.WindowWidth \ 2 - Len(intr(0))\2,Console.WindowHeight()\2 - UBound(intr) + 3)
|
|
||||||
For i = 0 To UBound(intr)
|
|
||||||
Console.WriteLine(intr(i))
|
|
||||||
Console.SetCursorPosition(Console.WindowWidth \ 2 - Len(intr(0))\2, Console.GetCursorPosition().Item2)
|
|
||||||
sleep(0.0888)
|
|
||||||
Next
|
|
||||||
'sleep(5)
|
|
||||||
Console.SetCursorPosition(0,0)
|
|
||||||
For i = 0 To (Console.WindowHeight()\2 - UBound(intr) + 2) \ 2
|
|
||||||
Console.WriteLine(StrDup(Console.WindowWidth-1, "#"))
|
|
||||||
sleep(0.0888)
|
|
||||||
Next
|
|
||||||
For i = 0 To Console.WindowHeight - (Console.WindowHeight()\2 - UBound(intr) + 2) - 3
|
|
||||||
Console.Write(StrDup((Console.WindowWidth \ 2 - Len(intr(0)) \ 2) \ 2, "#"))
|
|
||||||
Console.SetCursorPosition(Console.WindowWidth - (Console.WindowWidth \ 2 - Len(intr(0)) \ 2) \ 2, (Console.GetCursorPosition().Item2))
|
|
||||||
Console.WriteLine(StrDup((Console.WindowWidth \ 2 - Len(intr(0)) \ 2) \ 2 - 1, "#"))
|
|
||||||
sleep(0.0888)
|
|
||||||
Next
|
|
||||||
For i = 0 To (Console.WindowHeight()\2 - UBound(intr) + 2) \ 2
|
|
||||||
Console.WriteLine(StrDup(Console.WindowWidth-1, "#"))
|
|
||||||
sleep(0.0888)
|
|
||||||
Next
|
|
||||||
Dim entr As String = " Нажмите любую кнопку, чтобы начать игру! "
|
|
||||||
Console.SetCursorPosition((Console.WindowWidth \ 2) - Len(entr) \ 2,Console.WindowHeight - (Console.WindowHeight()\2 - UBound(intr) + 2) \ 4 - 1)
|
|
||||||
Console.Write(StrDup(Len(entr) + 2, " "))
|
|
||||||
|
|
||||||
Console.SetCursorPosition((Console.WindowWidth \ 2) - Len(entr) \ 2,Console.WindowHeight - (Console.WindowHeight()\2 - UBound(intr) + 2) \ 4)
|
Console.SetCursorPosition((Console.WindowWidth \ 2) - Len(entr) \ 2,Console.WindowHeight - (Console.WindowHeight()\2 - UBound(intr) + 2) \ 4 + 1)
|
||||||
Console.Write(entr & " ")
|
Console.Write(StrDup(Len(entr) + 2, " "))
|
||||||
|
|
||||||
Console.SetCursorPosition((Console.WindowWidth \ 2) - Len(entr) \ 2,Console.WindowHeight - (Console.WindowHeight()\2 - UBound(intr) + 2) \ 4 + 1)
|
Console.ReadKey
|
||||||
Console.Write(StrDup(Len(entr) + 2, " "))
|
Console.Clear
|
||||||
|
End Sub
|
||||||
|
|
||||||
Console.ReadKey
|
Function spinWheel() As String()
|
||||||
Console.Clear
|
Dim rnd As New Random
|
||||||
End Sub
|
Dim probability(36) As Double
|
||||||
|
Dim whatDropped As New List(Of String)
|
||||||
|
|
||||||
Function spinWheel() As String()
|
For k = 0 To rnd.Next(1,5)
|
||||||
Dim rnd As New Random
|
For i = 0 To rnd.Next(1,rnd.Next(5,100))
|
||||||
Dim probability(36) As Double
|
rnd.NextDouble()
|
||||||
Dim whatDropped As New List(Of String)
|
Randomize
|
||||||
|
Next
|
||||||
|
Next
|
||||||
|
|
||||||
For k = 0 To rnd.Next(1,5)
|
Dim max As Double = 0
|
||||||
For i = 0 To rnd.Next(1,rnd.Next(5,100))
|
Dim dropped As Integer
|
||||||
rnd.NextDouble()
|
|
||||||
Next
|
|
||||||
Next
|
|
||||||
|
|
||||||
Dim max As Double = 0
|
For i = 0 To 36
|
||||||
Dim dropped As Integer
|
probability(i) = rnd.NextDouble()
|
||||||
|
if probability(i) > max then
|
||||||
|
max = probability(i)
|
||||||
|
dropped = i
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
|
||||||
For i = 0 To 36
|
whatDropped.Add(ring(0,dropped).ToString())
|
||||||
probability(i) = rnd.NextDouble()
|
|
||||||
if probability(i) > max then
|
|
||||||
max = probability(i)
|
|
||||||
dropped = i
|
|
||||||
End If
|
|
||||||
Next
|
|
||||||
|
|
||||||
whatDropped.Add(ring(0,dropped).ToString())
|
If ring(0, dropped) mod 2 = 0 And dropped > 0
|
||||||
|
whatDropped.Add("EVEN")
|
||||||
|
Else
|
||||||
|
whatDropped.Add("ODD")
|
||||||
|
End If
|
||||||
|
|
||||||
If ring(0, dropped) mod 2 = 0 And dropped > 0
|
If ring(0, dropped) mod 3 = 0 And dropped > 0
|
||||||
whatDropped.Add("EVEN")
|
whatDropped.Add("3L")
|
||||||
Else
|
Else If ring(0, dropped) mod 3 = 1
|
||||||
whatDropped.Add("ODD")
|
whatDropped.Add("2L")
|
||||||
End If
|
Else
|
||||||
|
whatDropped.Add("1L")
|
||||||
|
End If
|
||||||
|
|
||||||
If ring(0, dropped) mod 3 = 0 And dropped > 0
|
If ring(1,dropped) = 1
|
||||||
whatDropped.Add("3L")
|
whatDropped.Add("RED")
|
||||||
Else If ring(0, dropped) mod 3 = 1
|
Else If ring(1,dropped) = 2
|
||||||
whatDropped.Add("2L")
|
whatDropped.Add("BLACK")
|
||||||
Else
|
End If
|
||||||
whatDropped.Add("1L")
|
|
||||||
End If
|
|
||||||
|
|
||||||
If ring(1,dropped) = 1
|
If ring(0, dropped) > 0 And ring(0, dropped) <= 12
|
||||||
whatDropped.Add("RED")
|
whatDropped.Add("F12")
|
||||||
Else If ring(1,dropped) = 2
|
Else If ring(0, dropped) > 12 And ring(0, dropped) <= 24
|
||||||
whatDropped.Add("BLACK")
|
whatDropped.Add("S12")
|
||||||
End If
|
Else If ring(0, dropped) > 24
|
||||||
|
whatDropped.Add("T12")
|
||||||
|
End If
|
||||||
|
|
||||||
If ring(0, dropped) > 0 And ring(0, dropped) <= 12
|
If ring(0,dropped) > 0 And ring(0,dropped) < 19
|
||||||
whatDropped.Add("F12")
|
whatDropped.Add("TO18")
|
||||||
Else If ring(0, dropped) > 12 And ring(0, dropped) <= 24
|
ElseIf ring(0,dropped) > 18
|
||||||
whatDropped.Add("S12")
|
whatDropped.Add("FROM18")
|
||||||
Else If ring(0, dropped) > 24
|
End If
|
||||||
whatDropped.Add("T12")
|
|
||||||
End If
|
|
||||||
|
|
||||||
If ring(0,dropped) > 0 And ring(0,dropped) < 19
|
Return whatDropped.ToArray()
|
||||||
whatDropped.Add("TO18")
|
End Function
|
||||||
ElseIf ring(0,dropped) > 18
|
|
||||||
whatDropped.Add("FROM18")
|
|
||||||
End If
|
|
||||||
|
|
||||||
Return whatDropped.ToArray()
|
Sub display(dropped As Integer)
|
||||||
End Function
|
Console.BackgroundColor = ConsoleColor.Green
|
||||||
|
Console.Clear()
|
||||||
|
If ring(0,0) <> dropped
|
||||||
|
Console.BackgroundColor = ConsoleColor.Black
|
||||||
|
Console.ForegroundColor = colors(ring(1,0))
|
||||||
|
Console.Write(ring(0,0) & " ")
|
||||||
|
Console.BackgroundColor = ConsoleColor.Green
|
||||||
|
Else
|
||||||
|
Console.BackgroundColor = ConsoleColor.White
|
||||||
|
Console.ForegroundColor = ConsoleColor.Black
|
||||||
|
Console.Write(ring(0, 0))
|
||||||
|
Console.BackgroundColor = ConsoleColor.Green
|
||||||
|
Console.Write(" ")
|
||||||
|
End If
|
||||||
|
For i = 1 To 36
|
||||||
|
If ring(0,i) <> dropped
|
||||||
|
Console.ForegroundColor = colors(ring(1,i))
|
||||||
|
Console.Write(ring(0,i) & " ")
|
||||||
|
Else
|
||||||
|
Console.BackgroundColor = ConsoleColor.White
|
||||||
|
Console.ForegroundColor = colors(ring(1,i))
|
||||||
|
Console.Write(ring(0, i))
|
||||||
|
Console.BackgroundColor = ConsoleColor.Green
|
||||||
|
Console.Write(" ")
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
Dim temp As Integer
|
||||||
|
Console.WriteLine()
|
||||||
|
Console.WriteLine()
|
||||||
|
For i = 3 To 36 Step 3
|
||||||
|
temp = GetIndex(ringRank0, i)
|
||||||
|
If i <> dropped
|
||||||
|
Console.ForegroundColor = colors(ring(1,temp))
|
||||||
|
Console.Write("{0,2:G} ", i)
|
||||||
|
Else
|
||||||
|
Console.BackgroundColor = ConsoleColor.White
|
||||||
|
Console.ForegroundColor = colors(ring(1,temp))
|
||||||
|
Console.Write("{0,2:G}", i)
|
||||||
|
Console.BackgroundColor = ConsoleColor.Green
|
||||||
|
Console.Write(" ")
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
Console.ForegroundColor = ConsoleColor.DarkBlue
|
||||||
|
Console.Write(" 3L")
|
||||||
|
Console.WriteLine()
|
||||||
|
For i = 2 To 36 Step 3
|
||||||
|
temp = GetIndex(ringRank0, i)
|
||||||
|
If i <> dropped
|
||||||
|
Console.ForegroundColor = colors(ring(1,temp))
|
||||||
|
Console.Write("{0,2:G} ", i)
|
||||||
|
Else
|
||||||
|
Console.BackgroundColor = ConsoleColor.White
|
||||||
|
Console.ForegroundColor = colors(ring(1,temp))
|
||||||
|
Console.Write("{0,2:G}", i)
|
||||||
|
Console.BackgroundColor = ConsoleColor.Green
|
||||||
|
Console.Write(" ")
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
Console.ForegroundColor = ConsoleColor.DarkBlue
|
||||||
|
Console.Write(" 2L")
|
||||||
|
Console.WriteLine()
|
||||||
|
For i = 1 To 36 Step 3
|
||||||
|
temp = GetIndex(ringRank0, i)
|
||||||
|
If i <> dropped
|
||||||
|
Console.ForegroundColor = colors(ring(1,temp))
|
||||||
|
Console.Write("{0,2:G} ", i)
|
||||||
|
Else
|
||||||
|
Console.BackgroundColor = ConsoleColor.White
|
||||||
|
Console.ForegroundColor = colors(ring(1,temp))
|
||||||
|
Console.Write("{0,2:G}", i)
|
||||||
|
Console.BackgroundColor = ConsoleColor.Green
|
||||||
|
Console.Write(" ")
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
Console.ForegroundColor = ConsoleColor.DarkBlue
|
||||||
|
Console.Write(" 1L")
|
||||||
|
Console.WriteLine()
|
||||||
|
Console.WriteLine(" F12 | S12 | T12 ")
|
||||||
|
Console.ForegroundColor = ConsoleColor.DarkBlue
|
||||||
|
End Sub
|
||||||
|
|
||||||
Sub display(dropped As Integer)
|
Sub rules()
|
||||||
Console.BackgroundColor = ConsoleColor.Green
|
Console.Clear
|
||||||
Console.Clear()
|
Console.ForegroundColor = ConsoleColor.DarkBlue
|
||||||
If ring(0,0) <> dropped
|
Console.WriteLine("Рекомендуемое разрешение консоли: 100x35")
|
||||||
Console.BackgroundColor = ConsoleColor.Black
|
Console.WriteLine("Минимальное разрешение консоли: 100х20")
|
||||||
Console.ForegroundColor = colors(ring(1,0))
|
Console.WriteLine("Правила:")
|
||||||
Console.Write(ring(0,0) & " ")
|
Console.WriteLine("Игра представляет собой Европейскую рулетку. Игрок должен сделать ставку на определённую зону, будь то число, сектор, строка, чётность или цвет. Игрок может делать несколько ставок. Ставки вводятся в предоставленную зону через пробел.")
|
||||||
Console.BackgroundColor = ConsoleColor.Green
|
Console.WriteLine("<число 0 - 36> - ставка на число (1:36).")
|
||||||
Else
|
Console.WriteLine("1L/2L/3L - 1/2/3 линия соответственно, снизу вверх (1:3).")
|
||||||
Console.BackgroundColor = ConsoleColor.White
|
Console.WriteLine("F12/S12/T12 - ставка на сектора от 1 по 12/от 13 по 24/от 25 по 36 соответственно (1:3).")
|
||||||
Console.ForegroundColor = ConsoleColor.Black
|
Console.WriteLine("RED/BLACK - ставка на цвет (1:2).")
|
||||||
Console.Write(ring(0, 0))
|
Console.WriteLine("TO18/FROM18 - ставка на сектор от 1 по 18/от 19 по 36 (1:2).")
|
||||||
Console.BackgroundColor = ConsoleColor.Green
|
Console.WriteLine("EVEN/ODD - чётные/нечётные (1:2).")
|
||||||
Console.Write(" ")
|
Console.WriteLine("Игрок изначально получает 5000 фишек.")
|
||||||
End If
|
Console.WriteLine("После того, как игрок укажет, на что ставит, он указывает количество фишек на каждую ставку через пробел.")
|
||||||
For i = 1 To 36
|
Console.WriteLine("Например:")
|
||||||
If ring(0,i) <> dropped
|
Console.WriteLine("На что ставите: 0 16 2L T12 RED ODD")
|
||||||
Console.ForegroundColor = colors(ring(1,i))
|
Console.WriteLine("Сколько ставите: 100 50 500 500 1000 1000")
|
||||||
Console.Write(ring(0,i) & " ")
|
Console.WriteLine("ВНИМАНИЕ! Количество ставок должно совпадать с количеством фишек, которые ставите, в примере 6 = 6.")
|
||||||
Else
|
Console.WriteLine("Или просто нажмите ENTER, чтобы пропустить ставку.")
|
||||||
Console.BackgroundColor = ConsoleColor.White
|
Console.WriteLine("Удачи!")
|
||||||
Console.ForegroundColor = colors(ring(1,i))
|
Console.ReadKey()
|
||||||
Console.Write(ring(0, i))
|
End Sub
|
||||||
Console.BackgroundColor = ConsoleColor.Green
|
|
||||||
Console.Write(" ")
|
|
||||||
End If
|
|
||||||
Next
|
|
||||||
Dim temp As Integer
|
|
||||||
Console.WriteLine()
|
|
||||||
Console.WriteLine()
|
|
||||||
For i = 3 To 36 Step 3
|
|
||||||
temp = GetIndex(ringRank0, i)
|
|
||||||
If i <> dropped
|
|
||||||
Console.ForegroundColor = colors(ring(1,temp))
|
|
||||||
Console.Write("{0,2:G} ", i)
|
|
||||||
Else
|
|
||||||
Console.BackgroundColor = ConsoleColor.White
|
|
||||||
Console.ForegroundColor = colors(ring(1,temp))
|
|
||||||
Console.Write("{0,2:G}", i)
|
|
||||||
Console.BackgroundColor = ConsoleColor.Green
|
|
||||||
Console.Write(" ")
|
|
||||||
End If
|
|
||||||
Next
|
|
||||||
Console.ForegroundColor = ConsoleColor.DarkBlue
|
|
||||||
Console.Write(" 3L")
|
|
||||||
Console.WriteLine()
|
|
||||||
For i = 2 To 36 Step 3
|
|
||||||
temp = GetIndex(ringRank0, i)
|
|
||||||
If i <> dropped
|
|
||||||
Console.ForegroundColor = colors(ring(1,temp))
|
|
||||||
Console.Write("{0,2:G} ", i)
|
|
||||||
Else
|
|
||||||
Console.BackgroundColor = ConsoleColor.White
|
|
||||||
Console.ForegroundColor = colors(ring(1,temp))
|
|
||||||
Console.Write("{0,2:G}", i)
|
|
||||||
Console.BackgroundColor = ConsoleColor.Green
|
|
||||||
Console.Write(" ")
|
|
||||||
End If
|
|
||||||
Next
|
|
||||||
Console.ForegroundColor = ConsoleColor.DarkBlue
|
|
||||||
Console.Write(" 2L")
|
|
||||||
Console.WriteLine()
|
|
||||||
For i = 1 To 36 Step 3
|
|
||||||
temp = GetIndex(ringRank0, i)
|
|
||||||
If i <> dropped
|
|
||||||
Console.ForegroundColor = colors(ring(1,temp))
|
|
||||||
Console.Write("{0,2:G} ", i)
|
|
||||||
Else
|
|
||||||
Console.BackgroundColor = ConsoleColor.White
|
|
||||||
Console.ForegroundColor = colors(ring(1,temp))
|
|
||||||
Console.Write("{0,2:G}", i)
|
|
||||||
Console.BackgroundColor = ConsoleColor.Green
|
|
||||||
Console.Write(" ")
|
|
||||||
End If
|
|
||||||
Next
|
|
||||||
Console.ForegroundColor = ConsoleColor.DarkBlue
|
|
||||||
Console.Write(" 1L")
|
|
||||||
Console.WriteLine()
|
|
||||||
Console.WriteLine(" F12 | S12 | T12 ")
|
|
||||||
Console.ForegroundColor = ConsoleColor.DarkBlue
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
Sub rules()
|
Sub game()
|
||||||
Console.Clear
|
Console.WriteLine("Игра началась!")
|
||||||
Console.ForegroundColor = ConsoleColor.DarkBlue
|
Dim fish As Long = 5000
|
||||||
Console.WriteLine("Рекомендуемое разрешение консоли: 100x35")
|
Dim isGaming As Boolean = True
|
||||||
Console.WriteLine("Минимальное разрешение консоли: 100х20")
|
Dim history As New List(Of Integer)
|
||||||
Console.WriteLine("Правила:")
|
|
||||||
Console.WriteLine("Игра представляет собой Европейскую рулетку. Игрок должен сделать ставку на определённую зону, будь то число, сектор, строка, чётность или цвет. Игрок может делать несколько ставок. Ставки вводятся в предоставленную зону через пробел.")
|
|
||||||
Console.WriteLine("<число 0 - 36> - ставка на число (1:36).")
|
|
||||||
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("RED/BLACK - ставка на цвет (1:2).")
|
|
||||||
Console.WriteLine("TO18/FROM18 - ставка на сектор от 1 по 18/от 19 по 36 (1:2).")
|
|
||||||
Console.WriteLine("EVEN/ODD - чётные/нечётные (1:2).")
|
|
||||||
Console.WriteLine("Игрок изначально получает 5000 фишек.")
|
|
||||||
Console.WriteLine("После того, как игрок укажет, на что ставит, он указывает количество фишек на каждую ставку через пробел.")
|
|
||||||
Console.WriteLine("Например:")
|
|
||||||
Console.WriteLine("На что ставите: 0 16 2L T12 RED ODD")
|
|
||||||
Console.WriteLine("Сколько ставите: 100 50 500 500 1000 1000")
|
|
||||||
Console.WriteLine("ВНИМАНИЕ! Количество ставок должно совпадать с количеством фишек, которые ставите, в примере 6 = 6.")
|
|
||||||
Console.WriteLine("Или просто нажмите ENTER, чтобы пропустить ставку.")
|
|
||||||
Console.WriteLine("Удачи!")
|
|
||||||
Console.ReadKey()
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
Sub game()
|
Do while fish > 0
|
||||||
Console.WriteLine("Игра началась!")
|
Console.ForegroundColor = ConsoleColor.DarkBlue
|
||||||
Dim fish As Long = 5000
|
Console.WriteLine("У Вас {0} фишек.", fish)
|
||||||
Dim isGaming As Boolean = True
|
Console.Write("Продолжить игру? (Y/n) >>> ")
|
||||||
Dim history As New List(Of Integer)
|
Dim temp As String = Console.ReadLine()
|
||||||
|
If temp = "n" or temp = "N" Then
|
||||||
|
Exit Sub
|
||||||
|
Else IF temp = "" or temp = "y" or temp = "Y"
|
||||||
|
isGaming = True
|
||||||
|
Else
|
||||||
|
Console.WriteLine("Неверный ввод, продолжаем игру.")
|
||||||
|
End If
|
||||||
|
|
||||||
Do while fish > 0
|
Dim generated() As String = spinWheel()
|
||||||
Console.ForegroundColor = ConsoleColor.DarkBlue
|
Console.Clear
|
||||||
Console.WriteLine("У Вас {0} фишек.", fish)
|
history.Add(generated(0))
|
||||||
Console.Write("Продолжить игру? (Y/n) >>> ")
|
Console.Write("Делайте ставки ")
|
||||||
Dim temp As String = Console.ReadLine()
|
Dim stav As New List(Of String)
|
||||||
If temp = "n" or temp = "N" Then
|
Console.Write(">>> ")
|
||||||
Exit Sub
|
stav = Console.ReadLine().Split.ToList()
|
||||||
Else IF temp = "" or temp = "y" or temp = "Y"
|
Console.Write("Укажите суммы ставок ")
|
||||||
isGaming = True
|
Dim summ() As String
|
||||||
Else
|
Console.Write(">>> ")
|
||||||
Console.WriteLine("Неверный ввод, продолжаем игру.")
|
summ = Console.ReadLine().Split
|
||||||
End If
|
For i = 0 To UBound(summ)
|
||||||
|
If not IsNumeric(summ(i)) Then
|
||||||
|
Console.WriteLine("Ставки не корректны. Пропуск.")
|
||||||
|
Continue Do
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
Dim summs As New List(Of Integer)
|
||||||
|
For i = 0 To UBound(summ)
|
||||||
|
summs.add(Int(summ(i)))
|
||||||
|
Next
|
||||||
|
If stav.Count <> summs.Count Or summs.ToArray.Sum() > fish Then
|
||||||
|
Console.WriteLine("Ставки не корректны. Пропуск.")
|
||||||
|
Continue Do
|
||||||
|
End If
|
||||||
|
For i = 0 To summs.Count - 1
|
||||||
|
If summs(i) < 0 Then
|
||||||
|
Console.WriteLine("Ставки не корректны. Пропуск.")
|
||||||
|
Continue Do
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
Console.WriteLine("Крутим колесо...")
|
||||||
|
sleep(1)
|
||||||
|
display(Int(generated(0)))
|
||||||
|
Console.ForegroundColor = ConsoleColor.DarkBlue
|
||||||
|
Dim indedx As Integer
|
||||||
|
For i = 0 To UBound(generated)
|
||||||
|
If stav.Contains(generated(i)) Then
|
||||||
|
indedx = stav.IndexOf(generated(i))
|
||||||
|
If IsNumeric(generated(i))
|
||||||
|
fish += summ(indedx) * 35
|
||||||
|
stav.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
|
||||||
|
fish += summ(indedx) * 1
|
||||||
|
stav.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
|
||||||
|
fish += summ(indedx) * 2
|
||||||
|
stav.RemoveAt(indedx)
|
||||||
|
summs.RemoveAt(indedx)
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
For i = 0 To summs.Count - 1
|
||||||
|
fish -= summs(i)
|
||||||
|
Next
|
||||||
|
Console.WriteLine()
|
||||||
|
Console.WriteLine("Выпало: ")
|
||||||
|
For i = 0 To UBound(generated)
|
||||||
|
Console.Write(generated(i) & " ")
|
||||||
|
Next
|
||||||
|
Console.WriteLine()
|
||||||
|
displayHistory(history.ToArray())
|
||||||
|
Console.ForegroundColor = ConsoleColor.DarkBlue
|
||||||
|
Console.WriteLine()
|
||||||
|
Loop
|
||||||
|
Console.WriteLine("У Вас кончились фишки, игра закончена.")
|
||||||
|
Console.WriteLine("Нажмите любую кнопку, чтобы перезапустить игру.")
|
||||||
|
Console.ReadKey()
|
||||||
|
End Sub
|
||||||
|
|
||||||
Dim generated() As String = spinWheel()
|
Sub Main()
|
||||||
Console.Clear
|
Console.BackgroundColor = ConsoleColor.Green
|
||||||
history.Add(generated(0))
|
Randomize()
|
||||||
Console.Write("Делайте ставки ")
|
Console.Clear()
|
||||||
Dim stav As New List(Of String)
|
Console.ForegroundColor = ConsoleColor.DarkBlue
|
||||||
Console.Write(">>> ")
|
intro()
|
||||||
stav = Console.ReadLine().Split.ToList()
|
'Console.SetWindowSize(108,100)
|
||||||
Console.Write("Укажите суммы ставок ")
|
Console.WriteLine("Игра Рулетка")
|
||||||
Dim summ() As String
|
Console.WriteLine("1) Начать игру")
|
||||||
Console.Write(">>> ")
|
Console.WriteLine("2) Ознакомиться с правилами")
|
||||||
summ = Console.ReadLine().Split
|
Console.WriteLine("3) Выйти из игры")
|
||||||
For i = 0 To UBound(summ)
|
Console.Write(">>> ")
|
||||||
If not IsNumeric(summ(i)) Then
|
Dim input As Char = Console.ReadKey.KeyChar
|
||||||
Console.WriteLine("Ставки не корректны. Пропуск.")
|
Dim n As Integer = If(Int(input.ToString()) = 1 Or Int(input.ToString()) = 2 Or Int(input.ToString()) = 3, Int(input.ToString()), 0)
|
||||||
Continue Do
|
Dim history As New List(Of Integer)
|
||||||
End If
|
Dim historyC As New List(Of Integer)
|
||||||
Next
|
Select Case n
|
||||||
Dim summs As New List(Of Integer)
|
Case 0
|
||||||
For i = 0 To UBound(summ)
|
Console.WriteLine()
|
||||||
summs.add(Int(summ(i)))
|
Console.WriteLine("Неправильный ввод!")
|
||||||
Next
|
sleep(5)
|
||||||
If stav.Count <> summs.Count Or summs.ToArray.Sum() > fish Then
|
Main
|
||||||
Console.WriteLine("Ставки не корректны. Пропуск.")
|
Case 1
|
||||||
Continue Do
|
Console.Clear
|
||||||
End If
|
game()
|
||||||
For i = 0 To summs.Count - 1
|
Main()
|
||||||
If summs(i) < 0 Then
|
Case 2
|
||||||
Console.WriteLine("Ставки не корректны. Пропуск.")
|
Console.Clear
|
||||||
Continue Do
|
rules()
|
||||||
End If
|
Main()
|
||||||
Next
|
Case 3
|
||||||
Console.WriteLine("Крутим колесо...")
|
Exit Sub
|
||||||
sleep(2)
|
End Select
|
||||||
display(Int(generated(0)))
|
End Sub
|
||||||
Console.ForegroundColor = ConsoleColor.DarkBlue
|
|
||||||
Dim indedx As Integer
|
|
||||||
For i = 0 To UBound(generated)
|
|
||||||
If stav.Contains(generated(i)) Then
|
|
||||||
indedx = stav.IndexOf(generated(i))
|
|
||||||
If IsNumeric(generated(i))
|
|
||||||
fish += summ(indedx) * 35
|
|
||||||
stav.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
|
|
||||||
fish += summ(indedx) * 1
|
|
||||||
stav.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
|
|
||||||
fish += summ(indedx) * 2
|
|
||||||
stav.RemoveAt(indedx)
|
|
||||||
summs.RemoveAt(indedx)
|
|
||||||
End If
|
|
||||||
End If
|
|
||||||
Next
|
|
||||||
For i = 0 To summs.Count - 1
|
|
||||||
fish -= summs(i)
|
|
||||||
Next
|
|
||||||
Console.WriteLine()
|
|
||||||
Console.WriteLine("Выпало: ")
|
|
||||||
For i = 0 To UBound(generated)
|
|
||||||
Console.Write(generated(i) & " ")
|
|
||||||
Next
|
|
||||||
Console.WriteLine()
|
|
||||||
displayHistory(history.ToArray())
|
|
||||||
Console.ForegroundColor = ConsoleColor.DarkBlue
|
|
||||||
Console.WriteLine()
|
|
||||||
Loop
|
|
||||||
Console.WriteLine("У Вас кончились фишки, игра закончена.")
|
|
||||||
Console.WriteLine("Нажмите любую кнопку, чтобы перезапустить игру.")
|
|
||||||
Console.ReadKey()
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
Sub Main()
|
|
||||||
Console.BackgroundColor = ConsoleColor.Green
|
|
||||||
Randomize()
|
|
||||||
Console.Clear()
|
|
||||||
Console.ForegroundColor = ConsoleColor.DarkBlue
|
|
||||||
intro()
|
|
||||||
'Console.SetWindowSize(108,100)
|
|
||||||
Console.WriteLine("Игра Рулетка")
|
|
||||||
Console.WriteLine("1) Начать игру")
|
|
||||||
Console.WriteLine("2) Ознакомиться с правилами")
|
|
||||||
Console.WriteLine("3) Выйти из игры")
|
|
||||||
Console.Write(">>> ")
|
|
||||||
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 history As New List(Of Integer)
|
|
||||||
Dim historyC As New List(Of Integer)
|
|
||||||
Select Case n
|
|
||||||
Case 0
|
|
||||||
Console.WriteLine()
|
|
||||||
Console.WriteLine("Неправильный ввод!")
|
|
||||||
sleep(5)
|
|
||||||
Main
|
|
||||||
Case 1
|
|
||||||
Console.Clear
|
|
||||||
game()
|
|
||||||
Main()
|
|
||||||
Case 2
|
|
||||||
Console.Clear
|
|
||||||
rules()
|
|
||||||
Main()
|
|
||||||
Case 3
|
|
||||||
Exit Sub
|
|
||||||
End Select
|
|
||||||
End Sub
|
|
||||||
End Module
|
End Module
|
||||||
|
|
Loading…
Reference in a new issue