Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## uses crt;
- // начало + вариант пользователя
- var (b,r,g,y,m,c) := (' BB',' RR',' GG',' YY',' MM',' CC');
- var user_lst := new List<string>;
- ///
- Println('Введите любые 4 цвета из предложенного списка:');
- Println('C(cyan),B(blue),R(red),M(magenta),G(green),Y(yellow)');
- Println('В игре участвуют только 4 цвета!');
- ///
- var yes_no := ReadString('Можно начинать игру? Напишите (yes/no) y/n: ');
- ///
- if (yes_no = 'y') or (yes_no = 'Y') then
- begin
- for var i := 1 to 4 do
- begin
- Print($'Введите {i}-ый цвет (строчными буквами по названию цвета): ');
- user_lst.Add(ReadString());
- end;
- end
- else
- begin
- Println('Игра окончена!');
- exit
- end;
- // вариант компьютера (не видно пользователю)
- var auto_lst := new List<string>;
- auto_lst.Add(b);
- auto_lst.Add(r);
- auto_lst.Add(g);
- auto_lst.Add(y);
- auto_lst.Add(m);
- auto_lst.Add(c);
- auto_lst := auto_lst.Shuffle;
- auto_lst.RemoveAt(0);auto_lst.RemoveAt(0);
- //////////////////////////////////////////////////////////
- Print('Ваш вариант: '); Println(user_lst);
- if (user_lst[0] = b)
- then
- begin
- TextBackground(crt.LightBlue);
- TextColor(crt.Black);
- Print(' BB');
- end
- else if (user_lst[0] = r)
- then
- begin
- TextBackground(crt.LightRed);
- TextColor(crt.Black);
- Print(' RR');
- end
- else if (user_lst[0] = g)
- then
- begin
- TextBackground(crt.LightGreen);
- TextColor(crt.Black);
- Print(' GG');
- end
- else if (user_lst[0] = y)
- then
- begin
- TextBackground(crt.Yellow);
- TextColor(crt.Black);
- Print(' YY');
- end
- else if (user_lst[0] = m)
- then
- begin
- TextBackground(crt.LightMagenta);
- TextColor(crt.Black);
- Print(' MM');
- end
- else if (user_lst[0] = c)
- then
- begin
- TextBackground(crt.LightCyan);
- TextColor(crt.Black);
- Print(' CC');
- end;
- // индекс 1
- if (user_lst[1] = b)
- then
- begin
- TextBackground(crt.LightBlue);
- TextColor(crt.Black);
- Print(' BB');
- end
- else if (user_lst[1] = r)
- then
- begin
- TextBackground(crt.LightRed);
- TextColor(crt.Black);
- Print(' RR');
- end
- else if (user_lst[1] = g)
- then
- begin
- TextBackground(crt.LightGreen);
- TextColor(crt.Black);
- Print(' GG');
- end
- else if (user_lst[1] = y)
- then
- begin
- TextBackground(crt.Yellow);
- TextColor(crt.Black);
- Print(' YY');
- end
- else if (user_lst[1] = m)
- then
- begin
- TextBackground(crt.LightMagenta);
- TextColor(crt.Black);
- Print(' MM');
- end
- else if (user_lst[1] = c)
- then
- begin
- TextBackground(crt.LightCyan);
- TextColor(crt.Black);
- Print(' CC');
- end;
- // индекс 2
- if (user_lst[2] = b)
- then
- begin
- TextBackground(crt.LightBlue);
- TextColor(crt.Black);
- Print(' BB');
- end
- else if (user_lst[2] = r)
- then
- begin
- TextBackground(crt.LightRed);
- TextColor(crt.Black);
- Print(' RR');
- end
- else if (user_lst[2] = g)
- then
- begin
- TextBackground(crt.LightGreen);
- TextColor(crt.Black);
- Print(' GG');
- end
- else if (user_lst[2] = y)
- then
- begin
- TextBackground(crt.Yellow);
- TextColor(crt.Black);
- Print(' YY');
- end
- else if (user_lst[2] = m)
- then
- begin
- TextBackground(crt.LightMagenta);
- TextColor(crt.Black);
- Print(' MM');
- end
- else if (user_lst[2] = c)
- then
- begin
- TextBackground(crt.LightCyan);
- TextColor(crt.Black);
- Print(' CC');
- end;
- // индекс 3
- if (user_lst[3] = b)
- then
- begin
- TextBackground(crt.LightBlue);
- TextColor(crt.Black);
- Print(' BB');
- end
- else if (user_lst[3] = r)
- then
- begin
- TextBackground(crt.LightRed);
- TextColor(crt.Black);
- Print(' RR');
- end
- else if (user_lst[3] = g)
- then
- begin
- TextBackground(crt.LightGreen);
- TextColor(crt.Black);
- Print(' GG');
- end
- else if (user_lst[3] = y)
- then
- begin
- TextBackground(crt.Yellow);
- TextColor(crt.Black);
- Print(' YY');
- end
- else if (user_lst[3] = m)
- then
- begin
- TextBackground(crt.LightMagenta);
- TextColor(crt.Black);
- Print(' MM');
- end
- else if (user_lst[3] = c)
- then
- begin
- TextBackground(crt.LightCyan);
- TextColor(crt.Black);
- Print(' CC');
- end;
- readln()
- // что-то затык произошёл, программа не идёт дальше...
Advertisement
Add Comment
Please, Sign In to add comment