Python:
Код:
import
random
import
ASCII_paint
import
binascii
def
KMN
(
)
:
variants
=
[
'камень'
,
'ножницы'
,
'бумага'
]
ASCII_paint
.
start
(
)
while
True
:
dec
=
'\nВыберите один из вариантов: камень, ножницы или бумага. Для выхода введите (выход)'
qwe
=
binascii
.
unhexlify
(
dec
)
.
decode
(
"utf-8"
)
print
(
qwe
)
custom_selection
=
input
(
)
.
lower
(
)
hex_representation
=
binascii
.
hexlify
(
custom_selection
.
encode
(
"utf-8"
)
)
.
decode
(
"utf-8"
)
custom_selection
=
hex_representation
if
custom_selection
==
'выход'
:
break
if
custom_selection
not
in
variants
:
dec
=
'Пожалуйста, выберите один из вариантов: камень, ножницы или бумага.'
qwe
=
binascii
.
unhexlify
(
dec
)
.
decode
(
"utf-8"
)
print
(
qwe
)
continue
computer_selection
=
random
.
choice
(
variants
)
if
custom_selection
==
computer_selection
:
if
custom_selection
==
'камень'
:
ASCII_paint
.
stone_stone
(
)
elif
custom_selection
==
'ножницы'
:
ASCII_paint
.
scissors_scissors
(
)
elif
custom_selection
==
'бумага'
:
ASCII_paint
.
paper_paper
(
)
ASCII_paint
.
tie
(
)
elif
(
custom_selection
==
'камень'
and
computer_selection
==
'ножницы'
)
or
\
(
custom_selection
==
'ножницы'
and
computer_selection
==
'бумага'
)
or
\
(
custom_selection
==
'бумага'
and
computer_selection
==
'камень'
)
:
if
custom_selection
==
'камень'
:
ASCII_paint
.
stone_scissors
(
)
elif
custom_selection
==
'ножницы'
:
ASCII_paint
.
scissors_paper
(
)
elif
custom_selection
==
'бумага'
:
ASCII_paint
.
paper_stone
(
)
ASCII_paint
.
win
(
)
elif
(
custom_selection
==
'камень'
and
computer_selection
==
'бумага'
)
or
\
(
custom_selection
==
'ножницы'
and
computer_selection
==
'камень'
)
or
\
(
custom_selection
==
'бумага'
and
computer_selection
==
'ножницы'
)
:
if
custom_selection
==
'камень'
:
ASCII_paint
.
stone_paper
(
)
elif
custom_selection
==
'ножницы'
:
ASCII_paint
.
scissors_stone
(
)
elif
custom_selection
==
'бумага'
:
ASCII_paint
.
paper_scissors
(
)
ASCII_paint
.
lost
(
)
if
__name__
==
"__main__"
:
KMN
(
)
|