Changing colorz

This commit is contained in:
Ivan Bushchik 2021-05-02 13:18:48 +03:00
commit 7e54e61c42
2 changed files with 16 additions and 8 deletions

View file

@ -7,3 +7,7 @@
#### Лицензия: GNU GPLv3 #### Лицензия: GNU GPLv3
Игра представляет собой Европейскую рулетку в консоли. Игра представляет собой Европейскую рулетку в консоли.
Протестировано на macOS-arm (через Rosetta 2), macOS-x64, linux-x64, linux-arm
Исполняемые файлы подготовлены для macOS-x64, linux-x64, linux-arm, win-x64

View file

@ -23,13 +23,14 @@ Module Program
End Function End Function
Sub displayHistory(history() As Integer) Sub displayHistory(history() As Integer)
Console.ForegroundColor = ConsoleColor.DarkBlue
Console.Write("История выпадений (последние 10): ") Console.Write("История выпадений (последние 10): ")
Dim start As Integer = If(Ubound(history) > 9, Ubound(history) - 10, 0) Dim start As Integer = If(Ubound(history) > 9, Ubound(history) - 10, 0)
For i = start 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.Black 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()
@ -55,6 +56,7 @@ Module Program
End Sub End Sub
Sub intro() Sub intro()
Console.ForegroundColor = ConsoleColor.DarkBlue
Console.SetCursorPosition(Console.WindowWidth \ 2 - Len(intr(0))\2,Console.WindowHeight()\2 - UBound(intr) + 3) Console.SetCursorPosition(Console.WindowWidth \ 2 - Len(intr(0))\2,Console.WindowHeight()\2 - UBound(intr) + 3)
For i = 0 To UBound(intr) For i = 0 To UBound(intr)
Console.WriteLine(intr(i)) Console.WriteLine(intr(i))
@ -195,7 +197,7 @@ Module Program
Console.Write(" ") Console.Write(" ")
End If End If
Next Next
Console.ForegroundColor = ConsoleColor.Black Console.ForegroundColor = ConsoleColor.DarkBlue
Console.Write(" 3L") Console.Write(" 3L")
Console.WriteLine() Console.WriteLine()
For i = 2 To 36 Step 3 For i = 2 To 36 Step 3
@ -211,7 +213,7 @@ Module Program
Console.Write(" ") Console.Write(" ")
End If End If
Next Next
Console.ForegroundColor = ConsoleColor.Black Console.ForegroundColor = ConsoleColor.DarkBlue
Console.Write(" 2L") Console.Write(" 2L")
Console.WriteLine() Console.WriteLine()
For i = 1 To 36 Step 3 For i = 1 To 36 Step 3
@ -227,15 +229,16 @@ Module Program
Console.Write(" ") Console.Write(" ")
End If End If
Next Next
Console.ForegroundColor = ConsoleColor.Black Console.ForegroundColor = ConsoleColor.DarkBlue
Console.Write(" 1L") Console.Write(" 1L")
Console.WriteLine() Console.WriteLine()
Console.WriteLine(" F12 | S12 | T12 ") Console.WriteLine(" F12 | S12 | T12 ")
Console.ForegroundColor = ConsoleColor.Black Console.ForegroundColor = ConsoleColor.DarkBlue
End Sub End Sub
Sub rules() Sub rules()
Console.Clear Console.Clear
Console.ForegroundColor = ConsoleColor.DarkBlue
Console.WriteLine("Рекомендуемое разрешение консоли: 100x35") Console.WriteLine("Рекомендуемое разрешение консоли: 100x35")
Console.WriteLine("Минимальное разрешение консоли: 100х20") Console.WriteLine("Минимальное разрешение консоли: 100х20")
Console.WriteLine("Правила:") Console.WriteLine("Правила:")
@ -264,7 +267,7 @@ Module Program
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.Black Console.ForegroundColor = ConsoleColor.DarkBlue
Console.WriteLine() Console.WriteLine()
Console.WriteLine("У Вас {0} фишек.", fish) Console.WriteLine("У Вас {0} фишек.", fish)
Console.WriteLine("Продолжить игру? (Y/n)") Console.WriteLine("Продолжить игру? (Y/n)")
@ -309,6 +312,7 @@ Module Program
Console.WriteLine("Крутим колесо...") Console.WriteLine("Крутим колесо...")
sleep(2) sleep(2)
display(Int(generated(0))) display(Int(generated(0)))
Console.ForegroundColor = ConsoleColor.DarkBlue
Dim indedx As Integer Dim indedx As Integer
For i = 0 To UBound(generated) For i = 0 To UBound(generated)
If stav.Contains(generated(i)) Then If stav.Contains(generated(i)) Then
@ -338,7 +342,7 @@ Module Program
Next Next
Console.WriteLine() Console.WriteLine()
displayHistory(history.ToArray()) displayHistory(history.ToArray())
Console.ForegroundColor = ConsoleColor.Black Console.ForegroundColor = ConsoleColor.DarkBlue
Loop Loop
End Sub End Sub
@ -347,7 +351,7 @@ Module Program
Console.BackgroundColor = ConsoleColor.Green Console.BackgroundColor = ConsoleColor.Green
Randomize() Randomize()
Console.Clear() Console.Clear()
Console.ForegroundColor = ConsoleColor.Black Console.ForegroundColor = ConsoleColor.DarkBlue
intro() intro()
'Console.SetWindowSize(108,100) 'Console.SetWindowSize(108,100)
Console.WriteLine("Игра Рулетка") Console.WriteLine("Игра Рулетка")