Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PyUNO
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jakob Kirsch
PyUNO
Commits
60398df7
Commit
60398df7
authored
5 years ago
by
Jakob Kirsch
Browse files
Options
Downloads
Patches
Plain Diff
auto generated by makefile
parent
d10cd65f
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
uno.py
+8
-5
8 additions, 5 deletions
uno.py
with
8 additions
and
5 deletions
uno.py
+
8
−
5
View file @
60398df7
...
@@ -27,14 +27,13 @@ def print_stack():
...
@@ -27,14 +27,13 @@ def print_stack():
print_card
(
STACK
[::
-
1
][
0
])
print_card
(
STACK
[::
-
1
][
0
])
def
compare_cards
(
card1
,
card2
):
def
compare_cards
(
card1
,
card2
):
global
OVERFLOW
,
WANTED_COLOR
global
OVERFLOW
,
WANTED_COLOR
if
card2
[
0
]
==
"
C
"
:
if
card2
[
0
]
in
[
"
C
"
,
"
+4
"
]
:
c
=
input
(
"
Color:
"
)
c
=
input
(
"
Color:
"
)
while
not
c
in
COLORS
:
while
not
c
in
COLORS
:
c
=
input
(
"
Color:
"
)
c
=
input
(
"
Color:
"
)
WANTED_COLOR
=
c
WANTED_COLOR
=
c
card2
[
1
]
=
c
card2
[
1
]
=
c
return
True
elif
WANTED_COLOR
!=
"
NEUTRAL
"
:
if
WANTED_COLOR
!=
"
NEUTRAL
"
:
ret
=
card2
[
1
]
==
WANTED_COLOR
ret
=
card2
[
1
]
==
WANTED_COLOR
if
ret
:
if
ret
:
WANTED_COLOR
=
"
NEUTRAL
"
WANTED_COLOR
=
"
NEUTRAL
"
...
@@ -45,6 +44,10 @@ def compare_cards(card1, card2):
...
@@ -45,6 +44,10 @@ def compare_cards(card1, card2):
if
ret
:
if
ret
:
if
card2
[
0
]
==
"
+2
"
:
if
card2
[
0
]
==
"
+2
"
:
OVERFLOW
+=
2
OVERFLOW
+=
2
ret
=
True
elif
card2
[
0
]
==
"
+4
"
:
OVERFLOW
+=
4
ret
=
True
return
ret
return
ret
if
not
DEBUG
:
if
not
DEBUG
:
atexit
.
register
(
clear
)
atexit
.
register
(
clear
)
...
@@ -57,7 +60,7 @@ for color in COLORS:
...
@@ -57,7 +60,7 @@ for color in COLORS:
for
n
in
range
(
0
,
2
):
for
n
in
range
(
0
,
2
):
CARDS
.
append
((
"
+2
"
,
color
))
CARDS
.
append
((
"
+2
"
,
color
))
CARDS
.
append
([
"
C
"
,
"
NEUTRAL
"
])
CARDS
.
append
([
"
C
"
,
"
NEUTRAL
"
])
CARDS
.
append
([
"
+4
"
,
"
NEUTRAL
"
])
#players
#players
p
=
input
(
"
Player:
"
)
p
=
input
(
"
Player:
"
)
while
p
!=
""
:
while
p
!=
""
:
...
@@ -96,7 +99,7 @@ while len(PLAYERS) > 1:
...
@@ -96,7 +99,7 @@ while len(PLAYERS) > 1:
if
not
compare_cards
(
STACK
[::
-
1
][
0
],
PCARDS
[
player
][
card
-
1
]):
if
not
compare_cards
(
STACK
[::
-
1
][
0
],
PCARDS
[
player
][
card
-
1
]):
card
=
-
1
card
=
-
1
card
-=
1
#python starts at 0
card
-=
1
#python starts at 0
if
PCARDS
[
player
][
card
][
0
]
!=
"
+2
"
and
OVERFLOW
>
0
:
if
PCARDS
[
player
][
card
][
0
]
in
[
"
+2
"
,
"
+4
"
]
and
OVERFLOW
>
0
:
print
(
"
\033
[1;30;40m
"
+
player
+
"
muss
"
+
str
(
OVERFLOW
)
+
"
Karten ziehen!
"
)
print
(
"
\033
[1;30;40m
"
+
player
+
"
muss
"
+
str
(
OVERFLOW
)
+
"
Karten ziehen!
"
)
for
n
in
range
(
0
,
OVERFLOW
):
for
n
in
range
(
0
,
OVERFLOW
):
PCARDS
[
player
].
append
(
CARDS
.
pop
())
PCARDS
[
player
].
append
(
CARDS
.
pop
())
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment