-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtweets.nls
54 lines (48 loc) · 1.32 KB
/
tweets.nls
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
;; note this package declares the following variables and procedures
;; so you must not use these names unless referring to these.
;;
;; variables:
;; procedures: create-tweet-for-user [who-posted]
;; print-number-of-tweets
;;
breed [tweets tweet]
tweets-own [
belief ;; Belief level associated with the tweet (-1 to 1)
poster ;; The turtle who posted the tweet
retweets ;; Number of retweets this tweet has
time-posted ;; The time the tweet was posted (tick number)
]
to create-tweet-for-user [who-posted]
create-tweets 1 [
set belief [belief] of who-posted
set poster who-posted
set retweets 0
set color white ;; Set the color for visual representation
set size 1
set time-posted ticks
]
end
to retweet-for-user [selected-user curr-tweet]
create-tweets 1 [
set belief [belief] of curr-tweet
set poster selected-user
set retweets 0
set color white ;; Set the color for visual representation
set size 1
set time-posted ticks
]
end
to retweet [by-who]
set retweets retweets + 1
hatch 1 [
set belief [belief] of self
set poster by-who
set retweets 0
set color white ;; Set the color for visual representation
set size 1
set time-posted ticks
]
end
to-report number-of-tweets
report count tweets
end