Commit c474580f authored by Daniel Graungaard's avatar Daniel Graungaard
Browse files

Big rewrite completed

parent 20d4b674
breed[videos video]
videos-own [emotionelt utrolige-evner nuttethed humor energi completed-segments viewers]
patches-own [empati-præference humor-præference utrolige-evner-præference nuttethed-præference]
globals [completed? views]
breed[child-teens child-teen]
breed[young-adults young-adult]
breed[adults adult]
breed[seniors senior]
videos-own [vrede interessant realisme aww latter energi completed-segments viewers]
seniors-own [vrede-præference interessant-præference realisme-præference aww-præference latter-præference]
adults-own [vrede-præference interessant-præference realisme-præference aww-præference latter-præference]
young-adults-own [vrede-præference interessant-præference realisme-præference aww-præference latter-præference]
child-teens-own [vrede-præference interessant-præference realisme-præference aww-præference latter-præference]
globals [completed? views top-right-patches bottom-right-patches top-left-patches bottom-left-patches]
to setup
clear-all
reset-ticks
;table:put segments "TOP RIGHT" (pxcor < 0 and pycor > 0)
set-default-shape child-teens "person-young"
set-default-shape young-adults "person-teen"
set-default-shape adults "person-adult"
set-default-shape seniors "person-old"
set top-left-patches patches with [pxcor < 0 and pycor > 0]
set top-right-patches patches with [pxcor > 0 and pycor > 0]
set bottom-left-patches patches with [pxcor < 0 and pycor < 0]
set bottom-right-patches patches with [pxcor > 0 and pycor < 0]
;"TOP RIGHT" "TOP LEFT" "BOTTOM RIGHT" "BOTTOM LEFT"
;top left - pre-teens
ask patches with [pxcor < 0 and pycor > 0] [
set pcolor rgb 0 0 (random 255)
set utrolige-evner-præference number-from-interval [5 7]
set empati-præference number-from-interval [3 5]
set humor-præference number-from-interval [8 10]
set nuttethed-præference number-from-interval [8 10]
; Defines the population in each segments, the numbers is each population in %
; PLease make sure that each segments sum to 100, otherwise all kinds of badness will occur
populate-media 5 25 40 30 top-left-patches ; Facebook
populate-media 20 40 30 10 top-right-patches ; Instagram
populate-media 40 30 25 5 bottom-left-patches ; Snapchat
populate-media 90 10 0 0 bottom-right-patches ; Tik-tok
ask turtles [
set color grey
]
; top right - ældre
ask patches with [pxcor > 0 and pycor > 0] [
set pcolor rgb (random 255) 255 255
;top left - pre-teens
ask (patch-set top-left-patches top-right-patches bottom-left-patches bottom-right-patches) [
set pcolor white
]
set utrolige-evner-præference number-from-interval [5 7]
set empati-præference number-from-interval [6 8]
set humor-præference number-from-interval [3 5]
set nuttethed-præference number-from-interval [6 8]
ask child-teens [
set vrede-præference number-from-interval [1 5]
set interessant-præference number-from-interval [4 7]
set realisme-præference number-from-interval [2 5]
set aww-præference number-from-interval [6 10]
set latter-præference number-from-interval [7 10]
]
; bottom left - teens
ask patches with [pxcor < 0 and pycor < 0] [
set pcolor rgb 255 (random 255) 255
ask young-adults [
set vrede-præference number-from-interval [4 8]
set interessant-præference number-from-interval [8 10]
set realisme-præference number-from-interval [7 10]
set aww-præference number-from-interval [1 5]
set latter-præference number-from-interval [8 10]
]
set utrolige-evner-præference number-from-interval [7 9]
set empati-præference number-from-interval [5 7]
set humor-præference number-from-interval [8 10]
set nuttethed-præference number-from-interval [4 5]
ask adults [
set vrede-præference number-from-interval [7 9]
set interessant-præference number-from-interval [7 9]
set realisme-præference number-from-interval [4 8]
set aww-præference number-from-interval [5 7]
set latter-præference number-from-interval [3 7]
]
; bottom right - voksne
ask patches with [pxcor > 0 and pycor < 0] [
let value 255
set pcolor rgb 255 255 (random 255)
set utrolige-evner-præference number-from-interval [7 10]
set empati-præference number-from-interval [8 10]
set humor-præference number-from-interval [5 7]
set nuttethed-præference number-from-interval [6 8]
ask seniors [
set vrede-præference number-from-interval [3 7]
set interessant-præference number-from-interval [4 7]
set realisme-præference number-from-interval [4 7]
set aww-præference number-from-interval [3 6]
set latter-præference number-from-interval [1 4]
]
ask patches with [pxcor = 0 or pycor = 0] [
set pcolor grey
]
......@@ -65,10 +92,11 @@ to setup
jump-to start
;husk at den samlede mængde point herunder ikke må overstige 30 point
set utrolige-evner 6
set emotionelt 7
set humor 4
set nuttethed 7
set vrede 2
set interessant 2
set realisme 2
set aww 2
set latter 2
set energi 10 ; Dette er den mængde energi videoen starter med
set completed-segments (list)
......@@ -81,18 +109,64 @@ to setup
end
;Populates the world with agents from each segment, the number represent the proportion of each segment in %
to populate-media [%child-teens %young-adult %adult %senior segment]
let number-of-spots-to-populate count segment ;calculate number of agents to populate
;let number-of-spots-to-populate 100
show number-of-spots-to-populate
let child-teen-total (number-of-spots-to-populate / 100) * %child-teens
let young-adults-total (number-of-spots-to-populate / 100) * %young-adult
let adults-total (number-of-spots-to-populate / 100) * %adult
let seniors-total (number-of-spots-to-populate / 100) * %senior
create-child-teens child-teen-total [
find-empty-spot segment
]
create-young-adults young-adults-total [
find-empty-spot segment
]
create-adults adults-total [
find-empty-spot segment
]
create-seniors seniors-total [
find-empty-spot segment
]
end
to find-empty-spot [segment]
move-to one-of segment
while [any? other turtles-here][move-to one-of segment]
end
to-report half-of-worlds-height
report random world-height / 2
report world-height / 2
end
to-report half-of-worlds-width
report random world-width / 2
report world-width / 2
end
to-report half-of-worlds-height-rounded
report floor (world-height / 2)
end
to-report half-of-worlds-width-rounded
report floor (world-width / 2)
end
to-report number-from-interval [interval]
let delta last interval - first interval + 1
......@@ -109,30 +183,49 @@ to go
set energi (energi - 1)
; This is the core of the subject matter. The algorithm below !SHOULD! be finalized with teachers!
let deltas (list (utrolige-evner-præference - utrolige-evner) (empati-præference - emotionelt) (nuttethed-præference - nuttethed) (humor-præference - humor))
let average sum deltas / length deltas
;set vrede-præference number-from-interval [1 5]
;set interessant-præference number-from-interval [4 7]
;set realisme-præference number-from-interval [2 5]
;set aww-præference number-from-interval [6 10]
;set latter-præference number-from-interval [7 10]
let viewer one-of other turtles-here
(ifelse abs average <= 1 [
set energi (energi + 2)
] abs average <= 2 [
set energi (energi + 1.5)
] abs average <= 3 [
set energi (energi + 1)
])
if viewer != nobody [ ; solves problem where video gets to close to the edges, would probably be better to change the behavior so it never steps out of bounds
if energi >= 1000 [
move-to-next-segment
]
let vrede-præference-her [vrede-præference] of viewer
let interessant-præference-her [interessant-præference] of viewer
let realisme-præference-her [realisme-præference] of viewer
let aww-præference-her [aww-præference] of viewer
let latter-præference-her [latter-præference] of viewer
if(not member? patch-here viewers)
[
set views views + 1
set viewers lput patch-here viewers
]
let deltas (list (latter-præference-her - latter) (aww-præference-her - aww) (realisme-præference-her - realisme) (interessant-præference-her - interessant) (vrede-præference-her - vrede))
;let deltas (list (utrolige-evner-præference - utrolige-evner) (empati-præference - emotionelt) (nuttethed-præference - nuttethed) (humor-præference - humor))
let average sum deltas / length deltas
(ifelse abs average <= 1 [
set energi (energi + 2)
] abs average <= 2 [
set energi (energi + 1.5)
] abs average <= 3 [
set energi (energi + 1)
])
set label round energi
if energi >= 1000 [
move-to-next-segment
]
if(not member? patch-here viewers)
[
set views views + 1
set viewers lput patch-here viewers
]
set label round energi
]
]
tick
......@@ -189,13 +282,13 @@ end
to jump-to [segment]
(ifelse segment = "TOP LEFT" [
setxy (-1 - random half-of-worlds-width) (random half-of-worlds-height + 1)
setxy (-1 - random half-of-worlds-width-rounded) (random half-of-worlds-height-rounded + 1) ;TODO Here is a random out of bounds exception (the video can go -1 beyound the world)
] segment = "TOP RIGHT" [
setxy (random half-of-worlds-width + 1) (random half-of-worlds-height + 1)
setxy (random half-of-worlds-width-rounded + 1) (random half-of-worlds-height-rounded + 1)
] segment = "BOTTOM LEFT" [
setxy (-1 - random half-of-worlds-width) (-1 - random half-of-worlds-height)
setxy (-1 - random half-of-worlds-width-rounded) (-1 - random half-of-worlds-height-rounded)
] segment = "BOTTOM RIGHT" [
setxy (random half-of-worlds-width + 1) (-1 - random half-of-worlds-height)
setxy (random half-of-worlds-width-rounded + 1) (-1 - random half-of-worlds-height-rounded)
])
end
......@@ -213,16 +306,15 @@ to-report find-current-segment
report nobody
])
end
@#$#@#$#@
GRAPHICS-WINDOW
402
108
1368
1075
388
33
965
611
-1
-1
9.49
13.9
1
10
1
......@@ -232,10 +324,10 @@ GRAPHICS-WINDOW
0
0
1
-50
50
-50
50
-20
20
-20
20
0
0
1
......@@ -267,7 +359,7 @@ CHOOSER
start
start
"TOP RIGHT" "TOP LEFT" "BOTTOM RIGHT" "BOTTOM LEFT"
0
1
BUTTON
117
......@@ -315,41 +407,41 @@ views
11
TEXTBOX
414
116
564
152
Pre-teens
403
43
553
79
Facebook
30
9.9
0.0
1
TEXTBOX
418
1026
568
1062
Teens
397
567
547
603
Snapchat
30
0.0
1
TEXTBOX
1275
115
1425
151
Ældre
808
37
958
73
Instagram
30
0.0
1
TEXTBOX
1248
1028
1398
1064
Voksne
837
567
987
603
Tik-Tok
30
0.0
1
......@@ -360,7 +452,7 @@ MONITOR
296
368
Video energi
[energi] of videos with [who = 0]
[energi] of one-of videos
17
1
11
......@@ -582,6 +674,88 @@ Rectangle -7500403 true true 127 79 172 94
Polygon -7500403 true true 195 90 240 150 225 180 165 105
Polygon -7500403 true true 105 90 60 150 75 180 135 105
person-adult
false
0
Rectangle -1 true false 120 90 180 180
Polygon -13345367 true false 135 90 150 105 135 180 150 195 165 180 150 105 165 90
Polygon -7500403 true true 120 90 105 90 60 195 90 210 116 154 120 195 90 285 105 300 135 300 150 225 165 300 195 300 210 285 180 195 183 153 210 210 240 195 195 90 180 90 150 165
Circle -7500403 true true 110 5 80
Rectangle -7500403 true true 127 76 172 91
Line -16777216 false 172 90 161 94
Line -16777216 false 128 90 139 94
Polygon -13345367 true false 195 225 195 300 270 270 270 195
Rectangle -13791810 true false 180 225 195 300
Polygon -14835848 true false 180 226 195 226 270 196 255 196
Polygon -13345367 true false 209 202 209 216 244 202 243 188
Line -16777216 false 180 90 150 165
Line -16777216 false 120 90 150 165
person-child
false
0
Circle -7500403 true true 65 5 80
Polygon -7500403 true true 60 90 75 195 45 285 60 300 90 300 105 225 120 300 150 300 165 285 135 195 150 90
Rectangle -7500403 true true 82 79 127 94
Polygon -7500403 true true 150 90 195 150 180 180 120 105
Polygon -7500403 true true 60 90 15 150 30 180 90 105
Circle -7500403 true true 214 138 44
Rectangle -7500403 true true 223 177 249 192
Polygon -7500403 true true 226 151
Polygon -7500403 true true 229 187 263 187 277 225 270 240 254 205 251 246 263 287 248 302 239 255 222 296 208 285 224 252 208 210 170 165 193 158 214 195 226 188 228 186 228 189
person-old
false
0
Circle -7500403 true true 110 5 80
Polygon -7500403 true true 105 90 120 195 90 285 105 300 135 300 150 225 165 300 195 300 210 285 180 195 195 90
Rectangle -7500403 true true 127 79 172 94
Polygon -7500403 true true 105 90 60 150 75 180 135 105
Rectangle -6459832 true false 228 153 236 296
Polygon -7500403 true true 195 90 240 150 225 180 165 105
person-teen
false
0
Polygon -13791810 true false 135 90 150 105 135 165 150 180 165 165 150 105 165 90
Polygon -7500403 true true 195 90 240 195 210 210 165 105
Circle -7500403 true true 110 5 80
Rectangle -7500403 true true 127 79 172 94
Polygon -7500403 true true 105 90 120 195 90 285 105 300 135 300 150 225 165 300 195 300 210 285 180 195 195 90
Polygon -1 true false 100 210 130 225 145 165 85 135 63 189
Polygon -13791810 true false 90 210 120 225 135 165 67 130 53 189
Polygon -1 true false 120 224 131 225 124 210
Line -16777216 false 139 168 126 225
Line -16777216 false 140 167 76 136
Polygon -7500403 true true 105 90 60 195 90 210 135 105
person-ultraadult
false
0
Circle -7500403 true true 110 5 80
Polygon -7500403 true true 106 90 121 195 91 285 106 300 136 300 151 225 166 300 196 300 211 285 181 195 196 90
Rectangle -7500403 true true 127 79 172 94
Polygon -7500403 true true 195 90 240 150 225 180 165 105
Polygon -7500403 true true 105 90 60 150 75 180 135 105
Polygon -11221820 true false 135 90 165 90 157 115 144 115 135 92 135 90
Polygon -11221820 true false 145 117 155 117 160 181 150 202 139 180 144 118 145 118 144 118
Polygon -6459832 true false 146 66 137 72 119 72 113 68 112 63 114 55 119 55 125 56 121 63 120 67 126 67 134 64 136 61 158 61 166 66 174 69 182 68 182 64 178 60 173 58 170 58 174 54 184 54 186 62 186 69 181 75 174 75 166 73 159 71 155 72 146 67
Circle -1 true false 122 32 16
Circle -1 true false 162 32 16
Polygon -13840069 true false 126 3 98 45 206 45 185 0 124 3
person-young
false
0
Circle -7500403 true true 113 8 80
Polygon -7500403 true true 105 90 120 195 90 285 105 300 135 300 150 225 165 300 195 300 210 285 180 195 195 90
Rectangle -7500403 true true 127 79 172 94
Polygon -7500403 true true 196 92 241 152 226 182 166 107
Polygon -7500403 true true 105 90 60 150 75 180 135 105
Polygon -7500403 true true 105 30
Polygon -13345367 true false 106 44 195 44 194 37 189 25 183 15 173 5 165 2 155 2 142 1 133 2 126 9 117 18 113 25 108 34 105 44 109 35 107 45 106 42 106 45
Polygon -2674135 true false 109 44 129 60 151 74 177 78 210 77 227 71 221 58 212 54 195 44 193 42 111 43 109 44 109 48 112 47
plant
false
0
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment