Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ##
- // начало + вариант пользователя
- var (b,r,g,y,m,c) := ('b','r','g','y','m','c');
- var (cnt_plus, cnt_0) := (0, 0);
- //
- var user_lst := new List<string>;
- ///
- Println('Всего цветов 6. Введите любые 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') then Println('Ура, начинаем!')
- 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(auto_lst);
- //
- Print('Введите 1-ый цвет (строчными буквами по названию цвета): ');user_lst.Add(ReadString());
- Print('Введите 2-ой цвет (строчными буквами по названию цвета): ');user_lst.Add(ReadString());
- Print('Введите 3-ий цвет (строчными буквами по названию цвета): ');user_lst.Add(ReadString());
- Print('Введите 4-ый цвет (строчными буквами по названию цвета): ');user_lst.Add(ReadString());
- Print('Ваш вариант:'); Print(user_lst);
- //
- // цвет c
- // +
- if (user_lst[0] = c) and (auto_lst[0] = c) then cnt_plus += 1
- else if (user_lst[1] = c) and (auto_lst[1] = c) then cnt_plus += 1
- else if (user_lst[2] = c) and (auto_lst[2] = c) then cnt_plus += 1
- else if (user_lst[3] = c) and (auto_lst[3] = c) then cnt_plus += 1
- // 0
- else if (user_lst[0] = c) and (auto_lst[1] = c) then cnt_0 += 1
- else if (user_lst[0] = c) and (auto_lst[2] = c) then cnt_0 += 1
- else if (user_lst[0] = c) and (auto_lst[3] = c) then cnt_0 += 1
- else if (user_lst[1] = c) and (auto_lst[0] = c) then cnt_0 += 1
- else if (user_lst[1] = c) and (auto_lst[2] = c) then cnt_0 += 1
- else if (user_lst[1] = c) and (auto_lst[3] = c) then cnt_0 += 1
- else if (user_lst[2] = c) and (auto_lst[0] = c) then cnt_0 += 1
- else if (user_lst[2] = c) and (auto_lst[1] = c) then cnt_0 += 1
- else if (user_lst[2] = c) and (auto_lst[3] = c) then cnt_0 += 1
- else if (user_lst[3] = c) and (auto_lst[0] = c) then cnt_0 += 1
- else if (user_lst[3] = c) and (auto_lst[1] = c) then cnt_0 += 1
- else if (user_lst[3] = c) and (auto_lst[2] = c) then cnt_0 += 1;
- // цвет b
- // +
- if (user_lst[0] = b) and (auto_lst[0] = b) then cnt_plus += 1
- else if (user_lst[1] = b) and (auto_lst[1] = b) then cnt_plus += 1
- else if (user_lst[2] = b) and (auto_lst[2] = b) then cnt_plus += 1
- else if (user_lst[3] = b) and (auto_lst[3] = b) then cnt_plus += 1
- // 0
- else if (user_lst[0] = b) and (auto_lst[1] = b) then cnt_0 += 1
- else if (user_lst[0] = b) and (auto_lst[2] = b) then cnt_0 += 1
- else if (user_lst[0] = b) and (auto_lst[3] = b) then cnt_0 += 1
- else if (user_lst[1] = b) and (auto_lst[0] = b) then cnt_0 += 1
- else if (user_lst[1] = b) and (auto_lst[2] = b) then cnt_0 += 1
- else if (user_lst[1] = b) and (auto_lst[3] = b) then cnt_0 += 1
- else if (user_lst[2] = b) and (auto_lst[0] = b) then cnt_0 += 1
- else if (user_lst[2] = b) and (auto_lst[1] = b) then cnt_0 += 1
- else if (user_lst[2] = b) and (auto_lst[3] = b) then cnt_0 += 1
- else if (user_lst[3] = b) and (auto_lst[0] = b) then cnt_0 += 1
- else if (user_lst[3] = b) and (auto_lst[1] = b) then cnt_0 += 1
- else if (user_lst[3] = b) and (auto_lst[2] = b) then cnt_0 += 1;
- //
- // цвет r
- // +
- if (user_lst[0] = r) and (auto_lst[0] = r) then cnt_plus += 1
- else if (user_lst[1] = r) and (auto_lst[1] = r) then cnt_plus += 1
- else if (user_lst[2] = r) and (auto_lst[2] = r) then cnt_plus += 1
- else if (user_lst[3] = r) and (auto_lst[3] = r) then cnt_plus += 1
- // 0
- else if (user_lst[0] = r) and (auto_lst[1] = r) then cnt_0 += 1
- else if (user_lst[0] = r) and (auto_lst[2] = r) then cnt_0 += 1
- else if (user_lst[0] = r) and (auto_lst[3] = r) then cnt_0 += 1
- else if (user_lst[1] = r) and (auto_lst[0] = r) then cnt_0 += 1
- else if (user_lst[1] = r) and (auto_lst[2] = r) then cnt_0 += 1
- else if (user_lst[1] = r) and (auto_lst[3] = r) then cnt_0 += 1
- else if (user_lst[2] = r) and (auto_lst[0] = r) then cnt_0 += 1
- else if (user_lst[2] = r) and (auto_lst[1] = r) then cnt_0 += 1
- else if (user_lst[2] = r) and (auto_lst[3] = r) then cnt_0 += 1
- else if (user_lst[3] = r) and (auto_lst[0] = r) then cnt_0 += 1
- else if (user_lst[3] = r) and (auto_lst[1] = r) then cnt_0 += 1
- else if (user_lst[3] = r) and (auto_lst[2] = r) then cnt_0 += 1;
- //
- // цвет g
- // +
- if (user_lst[0] = g) and (auto_lst[0] = g) then cnt_plus += 1
- else if (user_lst[1] = g) and (auto_lst[1] = g) then cnt_plus += 1
- else if (user_lst[2] = g) and (auto_lst[2] = g) then cnt_plus += 1
- else if (user_lst[3] = g) and (auto_lst[3] = g) then cnt_plus += 1
- // 0
- else if (user_lst[0] = g) and (auto_lst[1] = g) then cnt_0 += 1
- else if (user_lst[0] = g) and (auto_lst[2] = g) then cnt_0 += 1
- else if (user_lst[0] = g) and (auto_lst[3] = g) then cnt_0 += 1
- else if (user_lst[1] = g) and (auto_lst[0] = g) then cnt_0 += 1
- else if (user_lst[1] = g) and (auto_lst[2] = g) then cnt_0 += 1
- else if (user_lst[1] = g) and (auto_lst[3] = g) then cnt_0 += 1
- else if (user_lst[2] = g) and (auto_lst[0] = g) then cnt_0 += 1
- else if (user_lst[2] = g) and (auto_lst[1] = g) then cnt_0 += 1
- else if (user_lst[2] = g) and (auto_lst[3] = g) then cnt_0 += 1
- else if (user_lst[3] = g) and (auto_lst[0] = g) then cnt_0 += 1
- else if (user_lst[3] = g) and (auto_lst[1] = g) then cnt_0 += 1
- else if (user_lst[3] = g) and (auto_lst[2] = g) then cnt_0 += 1;
- //
- // цвет y
- // +
- if (user_lst[0] = y) and (auto_lst[0] = y) then cnt_plus += 1
- else if (user_lst[1] = y) and (auto_lst[1] = y) then cnt_plus += 1
- else if (user_lst[2] = y) and (auto_lst[2] = y) then cnt_plus += 1
- else if (user_lst[3] = y) and (auto_lst[3] = y) then cnt_plus += 1
- // 0
- else if (user_lst[0] = y) and (auto_lst[1] = y) then cnt_0 += 1
- else if (user_lst[0] = y) and (auto_lst[2] = y) then cnt_0 += 1
- else if (user_lst[0] = y) and (auto_lst[3] = y) then cnt_0 += 1
- else if (user_lst[1] = y) and (auto_lst[0] = y) then cnt_0 += 1
- else if (user_lst[1] = y) and (auto_lst[2] = y) then cnt_0 += 1
- else if (user_lst[1] = y) and (auto_lst[3] = y) then cnt_0 += 1
- else if (user_lst[2] = y) and (auto_lst[0] = y) then cnt_0 += 1
- else if (user_lst[2] = y) and (auto_lst[1] = y) then cnt_0 += 1
- else if (user_lst[2] = y) and (auto_lst[3] = y) then cnt_0 += 1
- else if (user_lst[3] = y) and (auto_lst[0] = y) then cnt_0 += 1
- else if (user_lst[3] = y) and (auto_lst[1] = y) then cnt_0 += 1
- else if (user_lst[3] = y) and (auto_lst[2] = y) then cnt_0 += 1;
- //
- // цвет m
- // +
- if (user_lst[0] = m) and (auto_lst[0] = m) then cnt_plus += 1
- else if (user_lst[1] = m) and (auto_lst[1] = m) then cnt_plus += 1
- else if (user_lst[2] = m) and (auto_lst[2] = m) then cnt_plus += 1
- else if (user_lst[3] = m) and (auto_lst[3] = m) then cnt_plus += 1
- // 0
- else if (user_lst[0] = m) and (auto_lst[1] = m) then cnt_0 += 1
- else if (user_lst[0] = m) and (auto_lst[2] = m) then cnt_0 += 1
- else if (user_lst[0] = m) and (auto_lst[3] = m) then cnt_0 += 1
- else if (user_lst[1] = m) and (auto_lst[0] = m) then cnt_0 += 1
- else if (user_lst[1] = m) and (auto_lst[2] = m) then cnt_0 += 1
- else if (user_lst[1] = m) and (auto_lst[3] = m) then cnt_0 += 1
- else if (user_lst[2] = m) and (auto_lst[0] = m) then cnt_0 += 1
- else if (user_lst[2] = m) and (auto_lst[1] = m) then cnt_0 += 1
- else if (user_lst[2] = m) and (auto_lst[3] = m) then cnt_0 += 1
- else if (user_lst[3] = m) and (auto_lst[0] = m) then cnt_0 += 1
- else if (user_lst[3] = m) and (auto_lst[1] = m) then cnt_0 += 1
- else if (user_lst[3] = m) and (auto_lst[2] = m) then cnt_0 += 1;
- //
- if cnt_plus = 1 then Print('+')
- else if cnt_plus = 2 then Print('+ +')
- else if cnt_plus = 3 then Print('+ + +')
- else if cnt_plus = 1 then Print('+ + + +');
- if cnt_0 = 1 then Print('0')
- else if cnt_0 = 2 then Print('0 0')
- else if cnt_0 = 3 then Print('0 0 0')
- else if cnt_0 = 4 then Print('0 0 0 0')
Advertisement
Add Comment
Please, Sign In to add comment