Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
bellcode
/
lesson2-1-1_DIY1
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
6bbab646
authored
Mar 19, 2023
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
e22f9abc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
1 deletions
1.py
diy1.py
1.py
0 → 100644
View file @
6bbab646
import
time
as
t
import
random
as
r
class
My
:
def
__init__
(
self
,
name
,
atk
,
hp
):
self
.
name
=
name
self
.
hp
=
hp
self
.
atk
=
atk
self
.
level
=
1
self
.
jy
=
0
def
up
(
self
):
if
self
.
level
<=
3
:
self
.
hp
+=
5
self
.
atk
+=
2
elif
self
.
level
>
3
and
self
.
level
<=
6
:
self
.
hp
+=
8
self
.
atk
+=
4
elif
self
.
level
>
6
and
self
.
level
<=
10
:
self
.
hp
+=
10
self
.
atk
+=
6
elif
self
.
level
>
10
and
self
.
level
<=
15
:
self
.
hp
+=
13
self
.
atk
+=
8
elif
self
.
level
>
15
and
self
.
level
<=
20
:
self
.
hp
+=
15
self
.
atk
+=
10
self
.
level
+=
1
class
Mon
:
def
__init__
(
self
,
hp
,
name
,
atk
,
level
,
jy
,
wp
):
self
.
name
=
name
self
.
hp
=
hp
self
.
akt
=
atk
self
.
level
=
level
self
.
jy
=
jy
self
.
wp
=
wp
wj
=
My
(
"曾小白"
,
2
,
50
)
where
=
[
"迷雾林"
,
"野林"
,
"坠龙谷"
,
"荒地"
,
"村庄"
,
"野林"
,
"野林"
,
"荒地"
,
"村庄"
,
"荒地"
,
"村庄"
,
"迷雾林"
,
"灵池"
,
"灵池"
]
print
(
"-"
*
5
+
"人物初始信息"
+
"-"
*
5
)
print
(
"姓名:"
+
wj
.
name
)
print
(
"气血:"
+
str
(
wj
.
hp
))
print
(
"攻击:"
+
str
(
wj
.
atk
))
print
(
"等级:"
+
str
(
wj
.
level
))
print
(
"经验:"
+
str
(
wj
.
jy
))
print
(
"-"
*
7
+
"开始冒险"
+
"-"
*
7
)
while
wj
.
hp
>
0
:
i
=
r
.
choice
(
where
)
print
(
"你来到了"
+
i
)
diy1.py
View file @
6bbab646
import
random
list
=
[
"石头"
,
"剪刀"
,
"布"
]
computer
=
random
.
choice
(
list
)
print
(
"电脑出的是:"
+
computer
)
wanjia
=
input
(
"请出拳:石头
\
剪刀
\
布"
)
wanjia
=
input
(
"请出拳:石头
\
剪刀
\
布"
)
print
(
"玩家出的是:"
+
wanjia
)
print
(
"玩家出的是:"
+
wanjia
)
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment