Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
desKoala
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
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
Nik | Klampfradler
desKoala
Commits
9449f62a
Commit
9449f62a
authored
11 years ago
by
Tim Huppertz
Committed by
Nik | Klampfradler
11 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Added behaviour changes.
parent
5cef5bc4
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
contents/code/main.py
+32
-3
32 additions, 3 deletions
contents/code/main.py
with
32 additions
and
3 deletions
contents/code/main.py
+
32
−
3
View file @
9449f62a
...
...
@@ -27,6 +27,7 @@ from datetime import datetime
from
PyQt4
import
uic
from
ConfigParser
import
ConfigParser
from
koalaConfig
import
KoalaConfig
from
random
import
randint
import
os
import
dbus
...
...
@@ -47,6 +48,7 @@ class Koala():
self
.
name
=
"
Tim
"
self
.
animal
=
"
koala
"
self
.
timeout
=
60000
self
.
sickness
=
0
self
.
load
()
...
...
@@ -54,9 +56,10 @@ class Koala():
if
datetime
.
now
()
>
datetime
.
strptime
(
datetime
.
now
().
strftime
(
"
%d.%m.%Y
"
)
+
"
"
+
self
.
brushtime
,
"
%d.%m.%Y %H:%M
"
)
and
self
.
brushed
<
datetime
.
strptime
(
datetime
.
now
().
strftime
(
"
%d.%m.%Y
"
)
+
"
"
+
self
.
brushtime
,
"
%d.%m.%Y %H:%M
"
):
return
"
dirty-teeth
"
if
self
.
hunger
<
0
:
return
"
fat
"
elif
self
.
hunger
>=
10
:
if
self
.
sickness
>=
20
:
return
"
sick
"
if
self
.
hunger
>=
10
:
return
"
hungry
"
if
self
.
dirtiness
>=
10
:
...
...
@@ -94,6 +97,29 @@ class Koala():
if
self
.
exhaustion
<
30
:
self
.
exhaustion
+=
0.5
if
self
.
get_mood
()
==
"
dirty-teeth
"
:
self
.
happiness
-=
1
self
.
sickness
+=
0.5
if
self
.
get_mood
()
==
"
hungry
"
:
self
.
happiness
-=
1
if
self
.
get_mood
()
==
"
fat
"
:
self
.
happiness
-=
1
self
.
loneliness
+=
2
self
.
sickness
+=
0.5
if
self
.
get_mood
()
==
"
dirty
"
:
self
.
sickness
+=
0.5
if
self
.
get_mood
()
==
"
sick
"
:
self
.
loneliness
+=
2
self
.
happiness
-=
2
self
.
dirtiness
+=
2
if
randint
(
0
,
100
)
%
4
==
0
:
self
.
sickness
+=
1
self
.
save
()
def
save
(
self
):
...
...
@@ -170,6 +196,7 @@ class Koala():
self
.
happiness
+=
5
self
.
hunger
-=
1
self
.
loneliness
-=
5
self
.
sickness
-=
5
def
bonbon
(
self
):
self
.
weight
+=
2
...
...
@@ -180,6 +207,7 @@ class Koala():
def
hug
(
self
):
self
.
happiness
+=
2
self
.
loneliness
-=
2
self
.
sickness
-=
0.5
def
walk
(
self
):
self
.
happiness
+=
5
...
...
@@ -190,6 +218,7 @@ class Koala():
def
sleep
(
self
):
self
.
exhaustion
-=
20
self
.
dirtiness
+=
1
self
.
sickness
-=
0.5
class
Deskoala
(
plasmascript
.
Applet
):
def
__init__
(
self
,
parent
,
args
=
None
):
...
...
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