Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
MCTIG
Viralitet
Commits
119c5aff
Commit
119c5aff
authored
Dec 06, 2019
by
Daniel Graungaard
Browse files
COmpleted jump logic
parent
c056295d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Viralitet.nlogo
View file @
119c5aff
extensions [table]
breed[videos video]
videos-own [emotionelt utrolige-evner nuttethed humor energi completed-segments]
patches-own [empati-præference humor-præference utrolige-evner-præference nuttethed-præference]
globals [completed?]
to setup
clear-all
reset-ticks
let segments table:make
;table:put segments "TOP RIGHT" (pxcor < 0 and pycor > 0)
;"TOP RIGHT" "TOP LEFT" "BOTTOM RIGHT" "BOTTOM LEFT"
...
...
@@ -64,15 +62,7 @@ to setup
create-videos 1 [
(ifelse start = "TOP LEFT" [
setxy (-1 - random half-of-worlds-width) (random half-of-worlds-height + 1)
] start = "TOP RIGHT" [
setxy (random half-of-worlds-width + 1) (random half-of-worlds-height + 1)
] start = "BOTTOM LEFT" [
setxy (-1 - random half-of-worlds-width) (-1 - random half-of-worlds-height)
] start = "BOTTOM RIGHT" [
setxy (random half-of-worlds-width + 1) (-1 - random half-of-worlds-height)
])
jump-to start
;husk at den samlede mængde point herunder ikke må overstige 30 point
set utrolige-evner 10
...
...
@@ -86,6 +76,8 @@ to setup
set label-color green
set size 2
set completed? false
]
end
...
...
@@ -110,6 +102,7 @@ end
to go
if any? videos with [energi < 0 ] [user-message "Din video er løbet tør for energi. Øv" stop]
if completed? [user-message "Din video har været i alle fire segmenter" stop]
ask videos [
move
...
...
@@ -132,6 +125,7 @@ to go
]
set label round energi
]
tick
end
...
...
@@ -165,33 +159,33 @@ to move-to-next-segment ; turtle method
ifelse length completed-segments = 4
[completed]
[find-missing-segment-and-jump]
end
to find-missing-segment-and-jump
set energi 15 ; her sættes enerngi efter spredning til et nyt segment
set label energi
foreach all-segments [segment ->
if not member? segment completed-segments [jump-to segment stop]
]
end
to-report list-compare
end
to completed
s
how "COMPLETED"
s
et completed? true
end
to jump-to [segment]
show segment
(ifelse segment = "TOP LEFT" [
setxy (-1 - random half-of-worlds-width) (random half-of-worlds-height + 1)
] segment = "TOP RIGHT" [
setxy (random half-of-worlds-width + 1) (random half-of-worlds-height + 1)
] segment = "BOTTOM LEFT" [
setxy (-1 - random half-of-worlds-width) (-1 - random half-of-worlds-height)
] segment = "BOTTOM RIGHT" [
setxy (random half-of-worlds-width + 1) (-1 - random half-of-worlds-height)
])
end
...
...
@@ -265,7 +259,7 @@ CHOOSER
start
start
"TOP RIGHT" "TOP LEFT" "BOTTOM RIGHT" "BOTTOM LEFT"
0
3
BUTTON
117
...
...
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