2022-02-10 12:43:57 +03:00
Imports System . Text
Module Program
2022-01-06 14:43:36 +03:00
'https://github.com/ivabus/roulette
'https://ivabus.github.io/roulette
2021-10-26 18:24:37 +03:00
Dim ReadOnly _
2021-10-26 20:27:30 +03:00
Ring ( , ) As Integer =
2021-10-26 18:24:37 +03:00
{ { 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 } }
2022-01-06 14:43:36 +03:00
'Второе измерение массива Ring необходимо для распределения цвета с помощью массива Colors по номерам 0 - белый, 1 - красный, 2 - чёрный
2021-10-26 18:24:37 +03:00
2021-10-26 20:27:30 +03:00
Dim ReadOnly Colors ( ) As ConsoleColor = { ConsoleColor . White , ConsoleColor . Red , ConsoleColor . Black }
2021-10-26 18:24:37 +03:00
Dim ReadOnly _
2022-01-06 14:43:36 +03:00
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 }
2021-05-03 21:10:55 +03:00
'ringRank0 нужен, чтобы было удобно подавать массив в поиск индекса
2022-01-12 19:16:18 +03:00
2022-02-10 12:44:20 +03:00
Private Const ReleaseTag As String = " 2.1.4 "
2022-01-13 18:02:25 +03:00
2022-02-10 12:43:57 +03:00
Dim _lang As Integer = - 1 ' 0 - русский language, 1 - english язык
2022-01-13 18:02:25 +03:00
Dim ReadOnly strings ( , ) = { { " История выпадений (последние 15): " , " Нажмите любую кнопку, чтобы начать игру! " ,
" Выберите сложность: " , " 1) Лёгкая - 500 фишек в начале " , " 2) Нормальная - 100 фишек в начале " ,
" 3) Сложная - 10 фишек в начале " , " 4) Невозможная - 2 фишки в начале " ,
" Выбор некорректен! " , " Игра началась! " , " Делайте ставки: " , " Укажите суммы ставок: " , " Ставки не корректны. Пропуск. " ,
2022-01-13 18:48:08 +03:00
" Крутим колесо... " , " Выпало: " , " У В а с {0} фишек." , " Продолжить игру? (Y/n) >>> " , " Неверный ввод, продолжаем игру. " ,
2022-01-13 18:02:25 +03:00
" У В а с закончились фишки, игра окончена." , " Нажмите любую клавишу, чтобы выйти в меню. " ,
" Рулетка / roulette " , " Автор: Иван Бущик <ivan@bushchik.ru> " , " Лицензия: MIT " , " Сайт: ivabus.dev/roulette " ,
" Репозиторий: github.com/ivabus/roulette " , " Версия: " , " Введите количество чисел для генерирования >>> " ,
2022-01-13 18:39:32 +03:00
" Погрешность генератора случайных чисел: " , " Игра Рулетка " , " 1) Начать игру " ,
2022-01-13 18:02:25 +03:00
" 2) Ознакомиться с правилами " , " 3) О игре " , " Дополнительно: " , " 4) Проверка генератора случайных чисел " ,
" 0) Выйти из игры " , " Ошибка! " } ,
2022-01-13 18:39:32 +03:00
{ " Drop history (last 15): " , " Press any button to start " , " Choose difficulty: " , " 1) Easy - 500 chips on the start " ,
" 2) Normal - 100 chips on the start " , " 3) Hard - 10 chips on the start " ,
" 4) Impossible - 2 chips on the start " , " Incorrect choise! " , " Game started " ,
" Place your bets: " , " Specify the bid amounts: " , " The bids are incorrect. Skipping. " ,
" Spinning wheel... " , " Dropped: " , " You have {0} chips. " , " Continue? (Y/n) >>> " ,
" Incorrect input, we continue the game. " , " You have run out of chips, the game is over. " ,
" Press any key to exit the menu. " , " Roulette " , " Author: Ivan Bushchik <ivan@bushchik.ru> " ,
" License: MIT " , " Website: ivabus.dev/roulette " , " Repository: github.com/ivabus/roulette " ,
" Version: " , " Enter the number of numbers to generate >>> " ,
" Error of the random number generator: " , " Roulette game " , " 1) Begin game " ,
" 2) Check the rules " , " 3) About game " , " Additional: " , " 4) Checking the random number generator " , " 0) Exit " , " Error! " } }
2021-10-26 20:27:30 +03:00
Dim ReadOnly Logo ( ) As String = { _
2021-10-26 18:24:37 +03:00
" #### ### # # # ##### ##### ##### ##### " ,
" # # # # # # # # # # # " ,
" # # # # # # # # # # # " ,
" # # # # # # # # # # # " ,
" #### # # # # # #### # # #### " ,
" ## # # # # # # # # # " ,
" # # # # # # # # # # # " ,
" # # # # # # # # # # # " ,
" # # ### ### ##### ##### # # ##### " }
2021-05-04 08:39:19 +03:00
Function GetIndex ( mass ( ) As Integer , obj As Integer ) As Integer 'Функция получает индекс объекта в массиве
2021-05-03 19:49:27 +03:00
For i = 0 To UBound ( mass )
If mass ( i ) = obj Then Return i
Next
2021-10-26 18:24:37 +03:00
Return - 1
2021-05-03 19:49:27 +03:00
End Function
2021-10-26 18:24:37 +03:00
2022-01-06 14:43:36 +03:00
Sub DisplayHistory ( history ( ) As Integer ) 'Эта функция не реализована в Game(), потому что это захламляло бы код
2021-05-03 19:49:27 +03:00
Console . ForegroundColor = ConsoleColor . DarkBlue
2022-02-10 12:43:57 +03:00
Console . Write ( strings ( _lang , 0 ) )
2021-10-26 18:24:37 +03:00
For i = If ( Ubound ( history ) > 14 , Ubound ( history ) - 14 , 0 ) To UBound ( history )
2021-10-26 20:27:30 +03:00
Console . ForegroundColor = Colors ( Ring ( 1 , getindex ( RingRank0 , history ( i ) ) ) )
2021-05-03 19:49:27 +03:00
Console . Write ( history ( i ) & " " )
Next
Console . ForegroundColor = ConsoleColor . DarkBlue
End Sub
2022-01-12 19:16:18 +03:00
2022-01-06 14:43:36 +03:00
Sub Sleep ( d As Single ) 'Название говорит о предназначении функции
2021-05-03 19:49:27 +03:00
Dim t As Single = Timer
Do while Timer - t < d
Loop
End Sub
2021-10-26 18:24:37 +03:00
2021-10-26 20:27:30 +03:00
Sub Intro ( )
2021-05-03 19:49:27 +03:00
Console . ForegroundColor = ConsoleColor . DarkBlue
2021-10-26 20:27:30 +03:00
Console . SetCursorPosition ( Console . WindowWidth \ 2 - Len ( Logo ( 0 ) ) \ 2 , Console . WindowHeight ( ) \ 2 - UBound ( Logo ) + 3 )
For i = 0 To UBound ( Logo )
Console . WriteLine ( Logo ( i ) )
Console . SetCursorPosition ( Console . WindowWidth \ 2 - Len ( Logo ( 0 ) ) \ 2 , Console . GetCursorPosition ( ) . Item2 )
Sleep ( 0 . 04444 )
2021-05-03 19:49:27 +03:00
Next
'sleep(5)
2021-10-26 18:24:37 +03:00
Console . SetCursorPosition ( 0 , 0 )
2021-10-26 20:27:30 +03:00
For i = 0 To ( Console . WindowHeight ( ) \ 2 - UBound ( Logo ) + 2 ) \ 2
2021-10-26 18:24:37 +03:00
Console . WriteLine ( StrDup ( Console . WindowWidth - 1 , " # " ) )
2021-10-26 20:27:30 +03:00
Sleep ( 0 . 04444 )
2021-05-03 19:49:27 +03:00
Next
2021-10-26 20:27:30 +03:00
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 . SetCursorPosition ( Console . WindowWidth - ( Console . WindowWidth \ 2 - Len ( Logo ( 0 ) ) \ 2 ) \ 2 ,
2021-10-26 18:24:37 +03:00
( Console . GetCursorPosition ( ) . Item2 ) )
2021-10-26 20:27:30 +03:00
Console . WriteLine ( StrDup ( ( Console . WindowWidth \ 2 - Len ( Logo ( 0 ) ) \ 2 ) \ 2 - 1 , " # " ) )
Sleep ( 0 . 04444 )
2021-05-03 19:49:27 +03:00
Next
2021-10-26 20:27:30 +03:00
For i = 0 To ( Console . WindowHeight ( ) \ 2 - UBound ( Logo ) + 2 ) \ 2 - 1
2021-10-26 18:24:37 +03:00
Console . WriteLine ( StrDup ( Console . WindowWidth - 1 , " # " ) )
2021-10-26 20:27:30 +03:00
Sleep ( 0 . 04444 )
2021-05-03 19:49:27 +03:00
Next
2022-02-10 12:43:57 +03:00
Dim entr = strings ( _lang , 1 )
2021-10-26 18:24:37 +03:00
Console . SetCursorPosition ( ( Console . WindowWidth \ 2 ) - Len ( entr ) \ 2 ,
2021-10-26 20:27:30 +03:00
Console . WindowHeight - ( Console . WindowHeight ( ) \ 2 - UBound ( Logo ) + 2 ) \ 4 - 3 )
2021-05-03 19:49:27 +03:00
Console . Write ( StrDup ( Len ( entr ) + 2 , " " ) )
2021-10-26 18:24:37 +03:00
Console . SetCursorPosition ( ( Console . WindowWidth \ 2 ) - Len ( entr ) \ 2 ,
2021-10-26 20:27:30 +03:00
Console . WindowHeight - ( Console . WindowHeight ( ) \ 2 - UBound ( Logo ) + 2 ) \ 4 - 2 )
2021-05-03 19:49:27 +03:00
Console . Write ( entr & " " )
2021-10-26 18:24:37 +03:00
Console . SetCursorPosition ( ( Console . WindowWidth \ 2 ) - Len ( entr ) \ 2 ,
2021-10-26 20:27:30 +03:00
Console . WindowHeight - ( Console . WindowHeight ( ) \ 2 - UBound ( Logo ) + 2 ) \ 4 - 1 )
2021-05-03 19:49:27 +03:00
Console . Write ( StrDup ( Len ( entr ) + 2 , " " ) )
2021-10-26 18:24:37 +03:00
Console . SetCursorPosition ( 0 , 0 )
2021-05-03 19:49:27 +03:00
Console . ReadKey
Console . Clear
End Sub
2021-10-26 18:24:37 +03:00
2021-10-26 20:27:30 +03:00
Function SpinWheel ( ) As String ( )
2021-05-03 19:49:27 +03:00
Dim rnd As New Random
Dim probability ( 36 ) As Double
Dim whatDropped As New List ( Of String )
2021-10-26 18:24:37 +03:00
For k = 0 To rnd . Next ( 1 , 5 )
For i = 0 To rnd . Next ( 1 , rnd . Next ( 5 , 100 ) )
2021-05-03 19:49:27 +03:00
rnd . NextDouble ( )
Randomize
Next
Next
2021-10-26 18:24:37 +03:00
2021-05-03 19:49:27 +03:00
Dim max As Double = 0
Dim dropped As Integer
2021-10-26 18:24:37 +03:00
2021-05-03 19:49:27 +03:00
For i = 0 To 36
probability ( i ) = rnd . NextDouble ( )
if probability ( i ) > max then
max = probability ( i )
dropped = i
End If
Next
2021-10-26 18:24:37 +03:00
2021-10-26 20:27:30 +03:00
whatDropped . Add ( Ring ( 0 , dropped ) . ToString ( ) )
2021-10-26 18:24:37 +03:00
2021-05-05 12:59:50 +03:00
If dropped = 0 Then return whatDropped . ToArray ( )
2022-02-10 12:43:57 +03:00
If Ring ( 0 , dropped ) mod 2 = 0
2021-05-03 19:49:27 +03:00
whatDropped . Add ( " EVEN " )
Else
whatDropped . Add ( " ODD " )
End If
2021-10-26 18:24:37 +03:00
2022-02-10 12:43:57 +03:00
If Ring ( 0 , dropped ) mod 3 = 0
2021-05-03 19:49:27 +03:00
whatDropped . Add ( " 3L " )
2021-10-26 20:27:30 +03:00
Else If Ring ( 0 , dropped ) mod 3 = 1
2021-05-03 19:49:27 +03:00
whatDropped . Add ( " 2L " )
Else
whatDropped . Add ( " 1L " )
End If
2021-10-26 18:24:37 +03:00
2021-10-26 20:27:30 +03:00
If Ring ( 1 , dropped ) = 1
2021-05-03 19:49:27 +03:00
whatDropped . Add ( " RED " )
2021-10-26 20:27:30 +03:00
Else If Ring ( 1 , dropped ) = 2
2021-05-03 19:49:27 +03:00
whatDropped . Add ( " BLACK " )
End If
2021-10-26 18:24:37 +03:00
2021-10-26 20:27:30 +03:00
If Ring ( 0 , dropped ) > 0 And Ring ( 0 , dropped ) <= 12
2021-05-03 19:49:27 +03:00
whatDropped . Add ( " F12 " )
2021-10-26 20:27:30 +03:00
Else If Ring ( 0 , dropped ) > 12 And Ring ( 0 , dropped ) <= 24
2021-05-03 19:49:27 +03:00
whatDropped . Add ( " S12 " )
2021-10-26 20:27:30 +03:00
Else If Ring ( 0 , dropped ) > 24
2021-05-03 19:49:27 +03:00
whatDropped . Add ( " T12 " )
End If
2021-10-26 18:24:37 +03:00
2021-10-26 20:27:30 +03:00
If Ring ( 0 , dropped ) > 0 And Ring ( 0 , dropped ) < 19
2021-05-03 19:49:27 +03:00
whatDropped . Add ( " TO18 " )
2021-10-26 20:27:30 +03:00
ElseIf Ring ( 0 , dropped ) > 18
2021-05-03 19:49:27 +03:00
whatDropped . Add ( " FROM18 " )
End If
2021-10-26 18:24:37 +03:00
2021-05-03 19:49:27 +03:00
Return whatDropped . ToArray ( )
End Function
2021-10-26 18:24:37 +03:00
2021-10-26 20:27:30 +03:00
Sub Display ( dropped As Integer )
2021-05-03 19:49:27 +03:00
Console . BackgroundColor = ConsoleColor . Green
Console . Clear ( )
2021-05-04 08:42:16 +03:00
2021-10-26 20:27:30 +03:00
If Ring ( 0 , 0 ) <> dropped
2021-05-03 19:49:27 +03:00
Console . BackgroundColor = ConsoleColor . Black
2021-10-26 20:27:30 +03:00
Console . ForegroundColor = Colors ( Ring ( 1 , 0 ) )
Console . Write ( Ring ( 0 , 0 ) & " " )
2021-05-03 19:49:27 +03:00
Console . BackgroundColor = ConsoleColor . Green
Else
Console . BackgroundColor = ConsoleColor . White
Console . ForegroundColor = ConsoleColor . Black
2021-10-26 20:27:30 +03:00
Console . Write ( Ring ( 0 , 0 ) )
2021-05-03 19:49:27 +03:00
Console . BackgroundColor = ConsoleColor . Green
Console . Write ( " " )
End If
2021-05-04 08:42:16 +03:00
2021-05-03 19:49:27 +03:00
For i = 1 To 36
2021-10-26 20:27:30 +03:00
If Ring ( 0 , i ) <> dropped
Console . ForegroundColor = Colors ( Ring ( 1 , i ) )
Console . Write ( Ring ( 0 , i ) & " " )
2021-05-03 19:49:27 +03:00
Else
Console . BackgroundColor = ConsoleColor . White
2021-10-26 20:27:30 +03:00
Console . ForegroundColor = Colors ( Ring ( 1 , i ) )
Console . Write ( Ring ( 0 , i ) )
2021-05-03 19:49:27 +03:00
Console . BackgroundColor = ConsoleColor . Green
Console . Write ( " " )
End If
Next
2021-05-04 08:42:16 +03:00
2021-05-03 19:49:27 +03:00
Dim temp As Integer
Console . WriteLine ( )
Console . WriteLine ( )
2021-05-04 08:42:16 +03:00
2021-05-03 19:49:27 +03:00
For i = 3 To 36 Step 3
2021-10-26 20:27:30 +03:00
temp = GetIndex ( RingRank0 , i )
2021-05-03 19:49:27 +03:00
If i <> dropped
2021-10-26 20:27:30 +03:00
Console . ForegroundColor = Colors ( Ring ( 1 , temp ) )
2021-05-03 19:49:27 +03:00
Console . Write ( " {0,2:G} " , i )
Else
Console . BackgroundColor = ConsoleColor . White
2021-10-26 20:27:30 +03:00
Console . ForegroundColor = Colors ( Ring ( 1 , temp ) )
2021-05-03 19:49:27 +03:00
Console . Write ( " {0,2:G} " , i )
Console . BackgroundColor = ConsoleColor . Green
Console . Write ( " " )
End If
Next
2021-05-04 08:42:16 +03:00
2021-05-03 19:49:27 +03:00
Console . ForegroundColor = ConsoleColor . DarkBlue
Console . Write ( " 3L " )
Console . WriteLine ( )
2021-05-04 08:42:16 +03:00
2021-05-03 19:49:27 +03:00
For i = 2 To 36 Step 3
2021-10-26 20:27:30 +03:00
temp = GetIndex ( RingRank0 , i )
2021-05-03 19:49:27 +03:00
If i <> dropped
2021-10-26 20:27:30 +03:00
Console . ForegroundColor = Colors ( Ring ( 1 , temp ) )
2021-05-03 19:49:27 +03:00
Console . Write ( " {0,2:G} " , i )
Else
Console . BackgroundColor = ConsoleColor . White
2021-10-26 20:27:30 +03:00
Console . ForegroundColor = Colors ( Ring ( 1 , temp ) )
2021-05-03 19:49:27 +03:00
Console . Write ( " {0,2:G} " , i )
Console . BackgroundColor = ConsoleColor . Green
Console . Write ( " " )
End If
Next
2021-05-04 08:42:16 +03:00
2021-05-03 19:49:27 +03:00
Console . ForegroundColor = ConsoleColor . DarkBlue
Console . Write ( " 2L " )
Console . WriteLine ( )
2021-05-04 08:42:16 +03:00
2021-05-03 19:49:27 +03:00
For i = 1 To 36 Step 3
2021-10-26 20:27:30 +03:00
temp = GetIndex ( RingRank0 , i )
2021-05-03 19:49:27 +03:00
If i <> dropped
2021-10-26 20:27:30 +03:00
Console . ForegroundColor = Colors ( Ring ( 1 , temp ) )
2021-05-03 19:49:27 +03:00
Console . Write ( " {0,2:G} " , i )
Else
Console . BackgroundColor = ConsoleColor . White
2021-10-26 20:27:30 +03:00
Console . ForegroundColor = Colors ( Ring ( 1 , temp ) )
2021-05-03 19:49:27 +03:00
Console . Write ( " {0,2:G} " , i )
Console . BackgroundColor = ConsoleColor . Green
Console . Write ( " " )
End If
Next
2022-02-09 20:57:58 +03:00
2021-05-03 19:49:27 +03:00
Console . ForegroundColor = ConsoleColor . DarkBlue
Console . Write ( " 1L " )
Console . WriteLine ( )
Console . WriteLine ( " F12 | S12 | T12 " )
Console . ForegroundColor = ConsoleColor . DarkBlue
End Sub
2021-10-26 20:27:30 +03:00
Sub Rules ( )
2022-02-10 12:43:57 +03:00
If _lang = 0 Then
Console . Clear
Console . ForegroundColor = ConsoleColor . DarkBlue
Console . WriteLine ( " Рекомендуемое разрешение консоли: 100x35 " )
Console . WriteLine ( " Минимальное разрешение консоли: 100х 20 " )
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 ( " Игрок изначально получает 500, 100, 10, 2 фишки. " )
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 ( )
Else
2022-02-09 20:57:58 +03:00
Console . Clear
Console . ForegroundColor = ConsoleColor . DarkBlue
Console . WriteLine ( " Recommended console resolution: 100x35 " )
Console . WriteLine ( " Minimum console resolution: 100x20 " )
Console . WriteLine ( " Rules: " )
Console . WriteLine (
" The game is a European roulette. The player must place a bet on a certain zone, whether it is a number, dozen, column, parity or color. A player can place several bets. Bids are entered into the provided zone separated by a space. " )
Console . WriteLine ( " <number 0 - 36> - bet on the number (1:36). " )
Console . WriteLine ( " 1L/2L/3L - 1/2/3 line, respectively, from bottom to top (1:3). " )
Console . WriteLine ( " F12/S12/T12 - bet on sectors from 1 to 12/from 13 to 24/from 25 to 36 respectively (1:3). " )
Console . WriteLine ( " RED/BLACK - bet on color (1:2). " )
Console . WriteLine ( " TO18/FROM18 - bet on the dozen from 1 to 18/from 19 to 36 (1:2). " )
Console . WriteLine ( " EVEN/ODD - even/odd (1:2). " )
Console . WriteLine ( " The player initially receives 500,100,10 or 2 chips. " )
Console . WriteLine (
" After the player indicates what he is betting on, he indicates the number of chips for each bet separated by a space. " )
Console . WriteLine ( " For example: " )
Console . WriteLine ( " Place bets >>> 0 16 2L T12 RED ODD " )
Console . WriteLine ( " Specify the bid amounts >>> 100 50 500 500 1000 1000 " )
Console . WriteLine (
" ATTENTION! The number of bets must match the number of chips you bet, in the example 6 = 6. " )
Console . WriteLine ( " Or just press ENTER to skip the bet. " )
Console . WriteLine ( " Good luck! " )
Console . ReadKey ( )
End If
2021-05-03 19:49:27 +03:00
End Sub
2021-10-26 20:27:30 +03:00
Sub Game ( )
2022-02-10 12:43:57 +03:00
Console . WriteLine ( strings ( _lang , 2 ) )
Console . WriteLine ( strings ( _lang , 3 ) )
Console . WriteLine ( strings ( _lang , 4 ) )
Console . WriteLine ( strings ( _lang , 5 ) )
Console . WriteLine ( strings ( _lang , 6 ) )
2022-01-12 19:16:18 +03:00
Console . Write ( " >>> " )
Dim choose As Integer = Console . ReadLine ( )
Dim fish As Long
Select Case choose
Case 1
fish = 500
Case 2
fish = 100
Case 3
fish = 10
Case 4
fish = 2
Case Else
2022-02-10 12:43:57 +03:00
Console . WriteLine ( strings ( _lang , 7 ) )
2022-01-12 19:16:18 +03:00
End Select
2022-02-10 12:43:57 +03:00
Console . WriteLine ( strings ( _lang , 8 ) )
2021-05-03 19:49:27 +03:00
Dim history As New List ( Of Integer )
2022-02-10 12:43:57 +03:00
Console . Clear ( )
2021-05-03 19:49:27 +03:00
Do while fish > 0
Console . ForegroundColor = ConsoleColor . DarkBlue
2021-10-26 20:27:30 +03:00
Dim generated ( ) As String = SpinWheel ( )
2021-05-03 19:49:27 +03:00
history . Add ( generated ( 0 ) )
2021-10-26 18:24:37 +03:00
2022-02-10 12:43:57 +03:00
Console . WriteLine ( strings ( _lang , 9 ) )
2021-10-07 10:53:46 +03:00
Console . Write ( " >>> " )
2021-10-26 20:27:30 +03:00
Dim stav
2021-05-07 14:03:24 +03:00
stav = UCase ( Console . ReadLine ( ) ) . Split . ToList ( )
2022-02-10 12:43:57 +03:00
Console . WriteLine ( strings ( _lang , 10 ) )
2021-10-07 10:53:46 +03:00
Console . Write ( " >>> " )
2021-05-03 19:49:27 +03:00
Dim summ ( ) As String
summ = Console . ReadLine ( ) . Split
For i = 0 To UBound ( summ )
If not IsNumeric ( summ ( i ) ) Then
2022-02-10 12:43:57 +03:00
Console . WriteLine ( strings ( _lang , 11 ) )
2021-05-03 19:49:27 +03:00
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
2022-02-10 12:43:57 +03:00
Console . WriteLine ( strings ( _lang , 11 ) )
2021-05-03 19:49:27 +03:00
Continue Do
End If
For i = 0 To summs . Count - 1
If summs ( i ) < 0 Then
2022-02-10 12:43:57 +03:00
Console . WriteLine ( strings ( _lang , 11 ) )
2021-05-03 19:49:27 +03:00
Continue Do
End If
Next
2022-02-10 12:43:57 +03:00
Console . WriteLine ( strings ( _lang , 12 ) )
2022-01-13 18:02:25 +03:00
Sleep ( 0 . 5 )
2022-02-10 12:43:57 +03:00
Console . Clear ( )
2021-10-26 20:27:30 +03:00
Display ( Int ( generated ( 0 ) ) )
2021-05-03 19:49:27 +03:00
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 ) )
2021-10-26 18:24:37 +03:00
fish += summ ( indedx ) * 35
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
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
2021-05-03 19:49:27 +03:00
End If
2021-10-07 10:50:46 +03:00
stav . RemoveAt ( indedx )
summs . RemoveAt ( indedx )
2021-05-03 19:49:27 +03:00
End If
Next
For i = 0 To summs . Count - 1
fish -= summs ( i )
Next
Console . WriteLine ( )
2022-02-10 12:43:57 +03:00
Console . Write ( strings ( _lang , 13 ) )
2021-05-03 19:49:27 +03:00
For i = 0 To UBound ( generated )
Console . Write ( generated ( i ) & " " )
Next
Console . WriteLine ( )
2021-10-26 20:27:30 +03:00
DisplayHistory ( history . ToArray ( ) )
2021-05-03 19:49:27 +03:00
Console . ForegroundColor = ConsoleColor . DarkBlue
Console . WriteLine ( )
2022-02-10 12:43:57 +03:00
Console . WriteLine ( strings ( _lang , 14 ) , fish )
Console . Write ( strings ( _lang , 15 ) )
2022-01-12 19:16:18 +03:00
Dim temp As String = Console . ReadLine ( )
If temp = " n " or temp = " N " Then
Exit Sub
Else IF temp = " " or temp = " y " or temp = " Y "
Console . Write ( " " )
Else
2022-02-10 12:43:57 +03:00
Console . WriteLine ( strings ( _lang , 16 ) )
2022-01-12 19:16:18 +03:00
End If
2021-05-03 19:49:27 +03:00
Loop
2022-02-10 12:43:57 +03:00
Console . WriteLine ( strings ( _lang , 17 ) )
Console . WriteLine ( strings ( _lang , 18 ) )
2021-05-03 19:49:27 +03:00
Console . ReadKey ( )
End Sub
2021-10-28 12:19:42 +03:00
Sub About ( )
Console . Clear ( )
2022-02-10 12:43:57 +03:00
Console . WriteLine ( strings ( _lang , 19 ) )
Console . WriteLine ( strings ( _lang , 20 ) )
Console . WriteLine ( strings ( _lang , 21 ) )
Console . WriteLine ( strings ( _lang , 22 ) )
Console . WriteLine ( strings ( _lang , 23 ) )
Console . WriteLine ( strings ( _lang , 24 ) + ReleaseTag )
Console . WriteLine ( strings ( _lang , 18 ) )
2021-10-28 12:19:42 +03:00
Console . ReadKey ( )
End Sub
2021-10-26 18:24:37 +03:00
2021-11-20 21:22:20 +03:00
Sub TestGenerator ( )
Randomize ( )
2022-01-13 18:02:25 +03:00
Dim count As Long
2021-11-20 21:22:20 +03:00
Dim rnd As New Random
2022-02-10 12:43:57 +03:00
Console . Write ( strings ( _lang , 25 ) )
2021-11-20 21:22:20 +03:00
Count = Console . ReadLine ( )
2022-01-12 19:16:18 +03:00
Dim mass ( count ) As Double
2021-11-20 21:22:20 +03:00
For i = 0 to Ubound ( mass )
2022-01-12 19:16:18 +03:00
mass ( i ) = rnd . NextDouble ( )
2021-11-20 21:22:20 +03:00
Next
2022-01-12 19:16:18 +03:00
Dim pogr As Double = 0
Dim sr As Double = mass . Sum ( ) / Count
pogr = Math . abs ( ( sr - 0 . 5 ) / 0 . 5 ) * 100
2022-02-10 12:43:57 +03:00
Console . WriteLine ( strings ( _lang , 26 ) + pogr . ToString ( " 0.##### " ) + " % " )
2022-01-17 10:20:03 +03:00
Console . ReadKey ( )
2021-11-20 21:22:20 +03:00
End Sub
2022-01-17 10:20:03 +03:00
Sub Menu ( )
2022-01-12 19:16:18 +03:00
Console . Clear ( )
2022-02-10 12:43:57 +03:00
Console . WriteLine ( strings ( _lang , 27 ) )
Console . WriteLine ( strings ( _lang , 28 ) )
Console . WriteLine ( strings ( _lang , 29 ) )
Console . WriteLine ( strings ( _lang , 30 ) )
Console . WriteLine ( strings ( _lang , 31 ) )
Console . WriteLine ( strings ( _lang , 32 ) )
Console . WriteLine ( strings ( _lang , 33 ) )
2022-01-12 19:16:18 +03:00
Console . Write ( " >>> " )
Dim input As Integer = Console . ReadLine
Select Case input
Case 0
Exit Sub
Case 1
2022-01-17 10:20:03 +03:00
Console . Clear ( )
Game ( )
Menu ( )
2022-01-12 19:16:18 +03:00
Case 2
Rules ( )
2022-01-17 10:20:03 +03:00
Menu ( )
2022-01-12 19:16:18 +03:00
Case 3
About ( )
2022-01-17 10:20:03 +03:00
Menu ( )
2022-01-12 19:16:18 +03:00
Case 4
TestGenerator ( )
2022-01-17 10:20:03 +03:00
Menu ( )
2022-01-12 19:16:18 +03:00
Case Else
Exit Sub
End Select
2022-01-17 10:20:03 +03:00
End Sub
Sub Main ( )
Try
2022-02-10 12:43:57 +03:00
If OperatingSystem . IsWindows ( ) Then
Console . SetWindowSize ( 100 , 40 )
Console . OutputEncoding = New UTF8Encoding ( )
End If
2022-01-17 10:20:03 +03:00
Console . BackgroundColor = ConsoleColor . Green
Console . ForegroundColor = ConsoleColor . DarkBlue
Randomize ( )
Console . Clear ( )
2022-02-10 12:43:57 +03:00
If _lang = - 1 Then
2022-01-17 10:20:03 +03:00
Console . WriteLine ( " Choose language / Выберете язык: " )
Console . WriteLine ( " 1) Russian / Русский " )
Console . WriteLine ( " 2) English / Английский " )
Console . Write ( " >>> " )
2022-02-10 12:43:57 +03:00
_lang = Console . ReadLine ( ) - 1
if _lang < 0 or _lang > 1 Then
2022-01-17 10:20:03 +03:00
Console . WriteLine ( " Incorrect choose " )
Exit Sub
End If
Console . Clear ( )
End If
Intro ( )
Menu ( )
2022-01-12 19:16:18 +03:00
Catch
2022-02-10 12:43:57 +03:00
Console . WriteLine ( strings ( _lang , 34 ) )
2022-01-12 19:16:18 +03:00
Exit Sub
End Try
2021-05-03 19:49:27 +03:00
End Sub
2022-02-09 17:37:14 +03:00
End Module