begin
var red := [1,3,5,7,9,12,14,16,18,19,21,23,25,27,30,32,34,36];
var balance := 100;
Writeln('Добро пожаловать в рулетку! Баланс: ', balance);
while balance > 0 do
begin
Writeln;
Writeln('Баланс: ', balance);
Write('Ставка: ');
var bet := ReadInteger;
if (bet <= 0) or (bet > balance) then
begin
Writeln('Некорректная ставка');
continue;
end;
Write('На что ставим? (число 0-36 / red / black / even / odd): ');
var choice := LowerCase(ReadString);
var res := Random(37);
var isRed := red.Contains(res);
var color := 'green';
if res <> 0 then
if isRed then color := 'red' else color := 'black';
Writeln('Выпало: ', res, ' (', color, ')');
var win := False;
var num := StrToIntDef(choice, -1);
if (num = res) and (num >= 0) then
begin
balance += bet * 35;
win := True;
end
else if (choice = 'red') and (color = 'red') then
begin
balance += bet;
win := True;
end
else if (choice = 'black') and (color = 'black') then
begin
balance += bet;
win := True;
end
else if (choice = 'even') and (res <> 0) and (res mod 2 = 0) then
begin
balance += bet;
win := True;
end
else if (choice = 'odd') and (res mod 2 = 1) then
begin
balance += bet;
win := True;
end;
if win then
Writeln('Выигрыш!')
else
begin
balance -= bet;
Writeln('Проигрыш');
end;
end;
Writeln('Баланс закончился. Игра окончена.');
end.