Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Persefone.jl
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Package registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Persefone
Persefone.jl
Commits
29b34c93
Commit
29b34c93
authored
11 months ago
by
xo30xoqa
Browse files
Options
Downloads
Patches
Plain Diff
Fixed the Wyvern test species
parent
61cf5aa6
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/nature/species/wolpertinger.jl
+1
-1
1 addition, 1 deletion
src/nature/species/wolpertinger.jl
src/nature/species/wyvern.jl
+28
-19
28 additions, 19 deletions
src/nature/species/wyvern.jl
src/parameters.toml
+1
-1
1 addition, 1 deletion
src/parameters.toml
with
30 additions
and
21 deletions
src/nature/species/wolpertinger.jl
+
1
−
1
View file @
29b34c93
...
@@ -35,7 +35,7 @@ and occasionally reproduce by spontaneous parthenogenesis...
...
@@ -35,7 +35,7 @@ and occasionally reproduce by spontaneous parthenogenesis...
end
end
"""
"""
Wolpertingers are
ephemer
al creatures that require no special initialisation.
Wolpertingers are
mythic
al creatures that require no special initialisation.
"""
"""
@create
Wolpertinger
begin
@create
Wolpertinger
begin
@debug
"
$
(animalid(self)) created."
@debug
"
$
(animalid(self)) created."
...
...
This diff is collapsed.
Click to expand it.
src/nature/species/wyvern.jl
+
28
−
19
View file @
29b34c93
...
@@ -10,71 +10,80 @@ Beware the wyvern! This evolutionary cousin of the dragon may only have two
...
@@ -10,71 +10,80 @@ Beware the wyvern! This evolutionary cousin of the dragon may only have two
legs, but that doesn't make it any less dangerous...
legs, but that doesn't make it any less dangerous...
"""
"""
@species
Wyvern
begin
@species
Wyvern
begin
popsize
=
10
fecundity
=
0.02
fecundity
=
0.02
maxage
=
365
maxage
=
365
speed
=
20
speed
=
20
vision
=
50
vision
=
50
aggression
=
0.2
aggression
=
0.2
huntsuccess
=
0.8
huntsuccess
=
0.8
end
@initialise
(
winter
,
"""
habitat
=
@habitat
(
@landcover
()
in
(
grass
,
soil
,
agriculture
,
builtup
)),
Wyverns are mythical creatures that require no special initialisation.
popsize
=
popsize
)
"""
@create
Wyvern
begin
@debug
"
$
(animalid(self)) created."
end
end
"""
"""
Wyverns are ferocious hunters, scouring the landscape for their favourite
Wyverns are ferocious hunters, scouring the landscape for their favourite
prey: wolpertingers...
prey: wolpertingers...
"""
"""
@phase
Wyvern
.
summer
begin
@phase
Wyvern
summer
begin
for
a
in
@neighbours
(
self
.
speed
)
for
a
in
@neighbours
(
self
.
speed
,
false
)
# check if a wolpertinger is in pouncing distance
# check if a wolpertinger is in pouncing distance
if
typeof
(
a
)
==
Wolpertinger
if
typeof
(
a
)
==
Wolpertinger
move
_agent!
(
self
,
a
.
pos
,
model
)
@
move
(
a
.
pos
)
if
@rand
()
<
self
.
huntsuccess
if
@rand
()
<
self
.
huntsuccess
@debug
"
$
(animalid(self)) killed
$
(animalid(a))."
@debug
"
$
(animalid(self)) killed
$
(animalid(a))."
kill
!
(
a
,
model
)
@
kill
other
(
a
,
1.0
,
"predation"
)
@goto
reproduce
@goto
reproduce
else
@debug
"
$
(animalid(self)) failed to kill
$
(animalid(a))."
end
end
elseif
typeof
(
a
)
==
Wyvern
&&
@rand
()
<
self
.
aggression
elseif
typeof
(
a
)
==
Wyvern
&&
@rand
()
<
self
.
aggression
# wyverns also fight against each other if they get too close
# wyverns also fight against each other if they get too close
move
_agent!
(
self
,
a
.
pos
,
model
)
@
move
(
a
.
pos
)
outcome
=
@rand
()
outcome
=
@rand
()
if
outcome
<
0.4
if
outcome
<
0.4
@debug
"
$
(animalid(self)) killed
$
(animalid(a)) in a fight."
@debug
"
$
(animalid(self)) killed
$
(animalid(a)) in a fight."
kill
_agent!
(
a
,
model
)
@
kill
other
(
a
,
1.0
,
"fighting"
)
elseif
outcome
<
0.8
elseif
outcome
<
0.8
@kill
1.0
"wounds sustained in a fight"
@kill
(
1.0
,
"wounds sustained in a fight"
)
end
end
@goto
reproduce
@goto
reproduce
end
end
end
end
# check if a wolpertinger is in seeing distance, or walk in a random direction
# check if a wolpertinger is in seeing distance, or walk in a random direction
direction
=
Tuple
(
@rand
([
-
1
,
1
],
2
)
)
direction
=
@randomdirection
(
self
.
speed
)
for
a
in
@neighbours
(
self
.
vision
)
for
a
in
@neighbours
(
self
.
vision
)
if
typeof
(
a
)
==
Wolpertinger
if
typeof
(
a
)
==
Wolpertinger
direction
=
get_
direction
(
self
.
pos
,
a
.
pos
,
model
)
direction
=
@
direction
to
(
a
)
break
break
end
end
end
for
i
in
1
:
self
.
speed
walk!
(
animal
,
direction
,
model
;
ifempty
=
false
)
end
end
@walk
(
direction
,
self
.
speed
)
# reproduce every once in a blue moon
# reproduce every once in a blue moon
@label
reproduce
@label
reproduce
(
@rand
()
<
self
.
fecundity
)
&&
@reproduce
(
-
1
)
(
@rand
()
<
self
.
fecundity
)
&&
@reproduce
()
# hibernate from November to March
# hibernate from November to March
month
(
model
.
date
)
>=
11
&&
(
@setphase
(
winter
))
month
(
model
.
date
)
>=
11
&&
(
@setphase
(
winter
))
(
self
.
age
==
maxage
)
&&
@kill
(
1.0
,
"old age"
)
(
self
.
age
==
self
.
maxage
)
&&
@kill
(
1.0
,
"old age"
)
end
end
"""
"""
Fortunately, wyverns hibernate in winter.
Fortunately, wyverns hibernate in winter.
"""
"""
@phase
Wyvern
.
winter
begin
@phase
Wyvern
winter
begin
# hibernate from November to March
# hibernate from November to March
if
month
(
model
.
date
)
>=
3
if
month
(
model
.
date
)
>=
3
@setphase
(
summer
)
@setphase
(
summer
)
end
end
end
end
@populate
Wyvern
begin
asexual
=
true
popsize
=
20
phase
=
winter
habitat
=
@habitat
(
@landcover
()
in
(
grass
,
soil
,
agriculture
,
builtup
))
end
This diff is collapsed.
Click to expand it.
src/parameters.toml
+
1
−
1
View file @
29b34c93
...
@@ -30,7 +30,7 @@ weatherfile = "data/regions/jena-small/weather.csv" # location of the weather da
...
@@ -30,7 +30,7 @@ weatherfile = "data/regions/jena-small/weather.csv" # location of the weather da
farmmodel
=
"FieldManager"
# which version of the farm model to use (not yet implemented)
farmmodel
=
"FieldManager"
# which version of the farm model to use (not yet implemented)
[nature]
[nature]
targetspecies
=
[
"Wolpertinger"
]
#
, "Wyvern"]#["Skylark"] # list of target species to simulate
targetspecies
=
[
"Wolpertinger"
,
"Wyvern"
]
#["Skylark"] # list of target species to simulate
popoutfreq
=
"daily"
# output frequency population-level data, daily/monthly/yearly/end/never
popoutfreq
=
"daily"
# output frequency population-level data, daily/monthly/yearly/end/never
indoutfreq
=
"end"
# output frequency individual-level data, daily/monthly/yearly/end/never
indoutfreq
=
"end"
# output frequency individual-level data, daily/monthly/yearly/end/never
insectmodel
=
[
"season"
,
"habitat"
,
"pesticides"
,
"weather"
]
# factors affecting insect growth
insectmodel
=
[
"season"
,
"habitat"
,
"pesticides"
,
"weather"
]
# factors affecting insect growth
...
...
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