Polling Advanced
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
WHAT IS IT?
This model can be used to poll data from a set of students using HubNet Clients. The teacher can input questions to ask and then the students can input their numerical choice (from 0 to 50) in response to the question. The collective data can then be plotted.
HOW TO USE IT
The simplest way to use this tool is to hit the GO button (to allow students to place their votes) and use the NEW QUESTION button repeatedly to input questions. With the default settings, students will respond at their own pace, and their responses will be histogrammed in the plot. The teacher can use the <<< and >>> buttons to move among the questions and see the students' responses.
However, this activity has many features that can be useful in preparing for discussion, inciting discussion, and later analyzing discussions.
Preparation: The teacher can load this model before class and prepare questions for loading in class. By scrolling the window to the right-most screen, the teacher can use the Preparation features. The teacher can create questions that use the HubNet Client (New Poller Question). After entering a set of questions and editing them as necessary (using the Edit Question button) the teacher can save those questions in a web-ready HTML file (using the PREPARATIONS FINISHED button). Then, in class, the teacher can load the questions using the LOAD QUESTIONS button to load the questions either from the local harddrive.
If the teacher makes a mistake while typing a question, he can correct it using the EDIT QUESTION button. He can insert a question before the current one, re-type the current question, or delete a question. (These can all be done in class, on the fly, as well)
Inciting Discussion: In the default settings, students can move through questions at their own pace, they can change their answers as often as they want, and the class results are histogrammed on the teacher's computer in real time. What if the teacher wants students to make their decisions without seeing what their classmates have chosen? The teacher can turn off SHOW-DATA?. The teacher can show the average response to several questions side-by-side by changing PLOT-MODE to "Average." If the teacher wants to call everyone's attention to a particular question, he can turn on LOCK-STEP?. If the teacher wants students to place a vote and stick to it, he can turn off ALLOW-CHANGE?.
The ability for students to give anonymous responses can help fuel discussions. Teachers should feel free to allow students to log in with fake names, or turn off SEE-NAMES? When students see that others share their opinions, they tend to be more willing to discuss the reasoning behind their views, and avoid the classic problems of "I don't want to seem stupid" or "I don't want to seem smart."
In addition to the plot, turtle positions can be used to present information about students' responses. By setting the TURTLE-DISPLAY chooser to "Sit" or "Wander", the teacher can have the turtles sort left and right according to if they've voted or not. "Line Up" causes the turtles to duplicate a histogram of their choices. "Word Sort" will cause the turtles to sort left / right and up /down according to the presence of a string in their responses (so, for example, all of the students who included the word "gravity" would move to the top half of the view, and all the students who included the word "air resistance" would move to the right, if the teacher chose those words for the sorting).
While students are voting, the teacher can have the model automatically save their data, allowing for later analysis or use in discussion. When the teacher turns on AUTO-SAVE?, prompts help him pick the directory and file name for the saved data.
Analyzing Discussion: After a discussion has occurred, the teacher can load the class data from different times in the discussion and view the responses. The teacher can also export the data in a format that can be conveniently opened in any spreadsheet. Just LOAD "world data" to revisit the students' responses in the tool, and use "save RESPONSES to SPREADSHEET" to save interesting data to a spreadsheet readable format. Widgets:
Screen 1 (left) SETUP - clears everything including logged in clients. This should only be pressed when starting out with a new group of users since all data and questions are lost. Presents the load questions menu LOAD QUESTIONS - presents a menu of options for loading questions GO - processes data from the clients. THIS MUST BE ON to receive responses or use the interface. ADD QUESTION - adds a new HubNet Client question SAVE - presents a menu of options for saving questions and student responses
Number - shows the current question number (starts at 0) Current Question - shows the current question being voted on by the clients <<< - changes the current question to the previous question
- changes the current question to the next question. allow-change? - controls whether clients are able to change their choices after they've chosen. Can be changed at any time. lock-step? - controls whether clients are forced to view only the question the teacher is currently viewing. Can be changed at any time.
show-data? - controls whether the data collected are shown in the plot window. Can be changed at any time plot-mode - controls whether a histogram of current responses is shown, or a plot showing the average to several questions
see-names? - controls whether the turtle shows the corresponding user ID. Can be changed at any time turtle-display - controls how the turtles position themselves. With "sit" and "wander," turtles who have voted move to the right half of the screen. With "line up," the turtles line up according to the number value of their responses (and turtles who haven't voted or who have a string response move to the far left). With "word sort," turtles are sorted up / down and right / left according to the presence of a substring in their string response (turtles who've not voted or who have a numerical response gather in the middle) Who Is It? - shows the user id of the turtle under the mouse Sort-Up - shows the word used to sort turtles up / down ^ CHANGE ^ - changes the sort-up value Sort-Right - shows the word used to sort turtles right / left ^ CHANGE ^ - changes the sort-right value
Screen 2 (middle) auto-save? - determines whether autosave is on or off auto-save-every - determines how often the model autosaves, based on the number of votes cast between saves auto-save directory - the directory in which autosave files are written auto-save base name - the base name for autosave files. The time is added to this name.
Save ALL - save all of the current information - questions, student responses, interface settings. This is the format used by auto-save Load ALL - load an ALL file Save RESPONSES as SPREADSHEEET - saves student questions and responses in a spreadsheet compatible format Save INDIVIDUAL responses - creates a web page for each student with the questions and that individual's responses
Screen 3 (right) SETUP - clears everything including logged in clients. This should only be pressed when starting out with a new group of users since all data and questions are lost. Presents the load questions menu Number - shows the current question number (starts at 0) Current Question - shows the current question Type - shows the type of the current questions (Poller, Web Text, Likert, or Web Number) <<< - changes the current question to the previous question
- changes the current question to the next question. Edit Question - calls a menu of options for editing the current question. REPLACE replaces the current question, DELETE deletes it, and INSERT inserts a new question Clear Questions - clears all of the questions New Poller Question - adds a new HubNet Client question
EXTENDING THE MODEL
There are many more ways the turtles could be used to convey information. Change the model so they set their shape according to type of response they have to the current question. Or have the turtles adjust their size according to how many responses they have. There could also be a turtle-display mode where they sit according to their responses to two questions.
HOW TO CITE
If you mention this model in a publication, we ask that you include these citations for the model itself and for the NetLogo software:
- Wilensky, U. and Stroup, W. (2002). NetLogo HubNet Polling Advanced model. http://ccl.northwestern.edu/netlogo/models/HubNetPollingAdvanced. Center for Connected Learning and Computer-Based Modeling, Northwestern Institute on Complex Systems, Northwestern University, Evanston, IL.
- Wilensky, U. (1999). NetLogo. http://ccl.northwestern.edu/netlogo/. Center for Connected Learning and Computer-Based Modeling, Northwestern Institute on Complex Systems, Northwestern University, Evanston, IL.
COPYRIGHT AND LICENSE
Copyright 2002 Uri Wilensky and Walter Stroup.
This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
Commercial licenses are also available. To inquire about commercial licenses, please contact Uri Wilensky at uri@northwestern.edu.
This activity and associated models and materials were created as part of the projects: PARTICIPATORY SIMULATIONS: NETWORK-BASED DESIGN FOR SYSTEMS LEARNING IN CLASSROOMS and/or INTEGRATED SIMULATION AND MODELING ENVIRONMENT. The project gratefully acknowledges the support of the National Science Foundation (REPP & ROLE programs) -- grant numbers REC #9814682 and REC-0126227.
Comments and Questions
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;; ;;;;;; The hard coded sample questions are the first section of code ;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Variable and Breed declarations ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; globals [ current-question ;; index of the current question in the question list question-list ;; list of all the questions. Each question is itself a list. steps-locked? ;; are the clients locked to the host's question? voted?-color ;; color of turtles which have voted not-voted?-color ;; color of turtles which haven't voted activity ;; how many votes have been cast since last autosave? auto-saving? ;; autosave poll data? auto-save-file ;; base file name for the autosave files auto-save-directory ;; directory for autosave files auto-saving-web? auto-save-web ;; full directory information for auto-saving polls as HTML web-response-file web-responding? web-response-data web-response-how-many? web-processing? web-questions names-showing? ;; are client names being shown in the view? graphics-display ;; what mode is the graphics display in? plot-showing? ;; are the votes being shown in the plot? plot-dirty? ;; does the plot need a redraw? plot-first ;; first item included in the special mode data plot plot-last ;; last item included in the special mode data plot plot-mode-is? ;; what plot mode is the model in? sort-up ;; used to sort turtles up / down according to if the word is in their string response sort-right ;; used to sort turtles right / left according to if the word is in their string response save-state-var save-state-value tmp1 tmp2 tmp3 tmp4 ] breed [ poll-clients poll-client ] breed [ non-clients non-client ] turtles-own [ user-id ;; unique id, input by the client when they log in, to identify each student turtle slider-value ;; the value of the client's choice slider my-choices ;; list of my choices for each question my-current-question ;; which question is the student currently on? ] ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;; ;;;;;; Sample Questions Section ;;;;;; at the beginning to make them easy to find and edit ;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; to load-sample-questions set question-list [ ["Sample Question 1" "Poller"] ["Sample Question 2" "Web Text"] ["Sample Question 3" "Likert" 5] ["Sample Question 4" "Web Number"] ] set current-question 0 ask turtles [clear-my-data set-my-current-question 0] end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; Setup Functions ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Startup ONLY runs when the model is first loaded. It initializes the ;; model's network capabilities and clears everything. to startup setup end ;; give the user some information about what the setup button does so they can ;; know whether they want to proceed before actually doing the setup ;; If you are tired of this prompt, change the code in the SETUP button from ;; setup-prompt to setup. to setup-prompt if user-yes-or-no? (word "The SETUP button should only be used when starting " "over with a new group and new questions (such as a" "different course) since ALL data is lost.\n" "Are you sure you want to SETUP?") [ setup ] end ;; Initializes the display and variables. ;; Also loads the data lists, if so desired. ;; Only called by SETUP-PROMPT, which is called by the setup button, and STARTUP. to setup hubnet-reset ca clear-output setup-vars load-questions-prompt ; load-sample-questions ;this is here to make life easier on Walter end to walkthrough startup-walkthrough setup-vars-walkthrough end to startup-walkthrough if user-yes-or-no? "Would you like to load questions?" [load-questions-prompt] ifelse user-yes-or-no? "Would you like to AUTOSAVE world data?" [auto-save-prompt] [set auto-save? false] end to setup-vars-walkthrough ifelse user-yes-or-no? "Allow students to change their responses?" [ set allow-change? true] [ set allow-change? false] ifelse user-yes-or-no? "Plot student responses?" [ set show-data? true set plot-showing? show-data?] [ set show-data? false set plot-showing? show-data?] ifelse user-yes-or-no? "Allow students to see questions at their own pace?" [ set lock-step? false set steps-locked? false] [ set lock-step? true set steps-locked? true] ifelse user-yes-or-no? "See student names?" [ set see-names? true] [ set see-names? false] end ;; initialize global variables to setup-vars set not-voted?-color green - 2 set voted?-color red + 2 set plot-showing? show-data? set plot-dirty? true set steps-locked? lock-step? set activity 0 set auto-saving? false set auto-save-file "" set auto-save-directory "" set auto-saving-web? false set auto-save-web "" set names-showing? see-names? set graphics-display Turtle-display set plot-mode "Histogram" set plot-mode-is? plot-mode set sort-up "" set sort-right "" set web-response-file "" set web-responding? false clear-all-data-and-questions end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Clearing Data ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; give the user some information about what the clear clients button does so they can ;; know whether they want to proceed before actually doing the setup ;; If you are tired of this prompt, change the code in the CLEAR CLIENTS button from ;; clear-clients-prompt to clear-clients. to clear-clients-prompt if user-yes-or-no? (word "The CLEAR CLIENTS button should only be used when starting " "over with a new group (such as a new set of students) since " "all STUDENT data is lost, but questions are saved.\n" "Are you sure you want to CLEAR CLIENTS?") [ clear-clients ] end ;; Clears the plots, clears the command center, and kills all turtles and patches. ;; Clients are dead in the water - they must exit and relogin. to clear-clients clear-plot cp ct clear-output end ;; give the user some information about what the clear questions button does so they can ;; know whether they want to proceed before actually doing the clear questions ;; If you are tired of this prompt, change the code in the CLEAR QUESTIONS button from ;; clear-all-data-and-questions-prompt to clear-all-data-and-questions-clients. to clear-all-data-and-questions-prompt if user-yes-or-no? (word "The CLEAR QUESTIONS button should only be used when starting " "over with the same students but new questions since " "all question and poll data is lost, but clients are saved.\n" "Are you sure you want to CLEAR QUESTIONS?") [ clear-all-data-and-questions ] end to clear-all-data-and-questions clear-plot hubnet-broadcast "Question" "" hubnet-broadcast "Question Two" "" hubnet-broadcast "Question Three" "" hubnet-broadcast "Question Number" "" hubnet-broadcast "Current Choice" "" hubnet-broadcast "Typed-Response" "Click on the CHANGE button\n(in the top right corner of this widget)\nto type a response." set activity 0 set current-question 0 set question-list [] set sort-up "" set sort-right "" ask turtles [ clear-my-data ] end to clear-my-data ;; turtle procedure set color not-voted?-color set my-choices [] repeat length question-list [ set my-choices lput false my-choices ] ifelse length question-list = 0 [ set my-current-question -1] [ set my-current-question 0] end ;; give the user some information about what the clear current data button does so they can ;; know whether they want to proceed before actually doing the clear current data ;; If you are tired of this prompt, change the code in the CLEAR CURRENT DATA button from ;; clear-current-data-prompt to clear-current-data. to clear-current-data-prompt if user-yes-or-no? (word "The CLEAR CURRENT DATA button should only be used when clearing " "the responses to the question that the TEACHER is currently viewing. " "Student responses to this question will be lost, but the question" "itself and student logins are unchanged.\n" "Are you sure you want to CLEAR CURRENT DATA?") [ clear-current-data ] end to clear-current-data clear-plot ask turtles [ set my-choices replace-item current-question my-choices false if my-current-question = -1 [set-my-current-question 0] ] set-current-question current-question end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; Runtime Procedures ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; to go lock-step-listener see-names-listener see-typed-listener ;; Anything from the clients? if length question-list > 0 [listen-clients] plot-mode-listener every 0.5 [ ;; The turtles do whatever MOVEMENTS they're gonna do. turtle-movement-listener show-data-listener ] auto-save-listener if auto-saving? or auto-saving-web? [ if activity >= auto-save-every [ auto-save ] ] display end to lock-step-listener ;;check to see if lock-step? status has changed. If it has changed to TRUE, then adjust clients. if lock-step? = true and steps-locked? = false [ set steps-locked? true ask turtles [ set-my-current-question current-question ] ] if lock-step? = false and steps-locked? = true [ set steps-locked? false ] end to see-names-listener ifelse see-names? [ if not names-showing? [ ask turtles [ set label word user-id " "] set names-showing? see-names? ] ] [ if names-showing? [ ask turtles [ set label ""] set names-showing? see-names? ] ] end to see-typed-listener let show-teacher "" if mouse-down? [ wait .35 ;this wait is necessary to keep the popup from interrupting the mouse-down? reporter, ;which would prevent it from resetting to false if any? turtles-on patch mouse-xcor mouse-ycor [ ask one-of turtles-on patch mouse-xcor mouse-ycor [ set show-teacher item current-question my-choices ] user-message show-teacher ] wait .25 ] end to plot-mode-listener if plot-mode-is? != plot-mode [ if plot-mode = "Average" [ plot-average-prompt ] set plot-mode-is? plot-mode set plot-dirty? true ] end to show-data-listener ;; Check to see if the poll data is to be displayed. ifelse show-data? [ if not plot-showing? [ set plot-showing? true set plot-dirty? true ] if plot-dirty? [ set plot-dirty? false do-plot ] ] [ if plot-showing? [ set plot-showing? false clear-plot ] ] end to turtle-movement-listener if not (graphics-display = Turtle-display) [ set graphics-display Turtle-display if graphics-display = "Word-Sort" [ if sort-up = "" [set sort-up user-input "Sort up / down word -"] if sort-right = "" [set sort-right user-input "Sort right / left word -"] ] ] if graphics-display = "Sit" [ ask turtles [sit] ] if graphics-display = "Wander" [ ask turtles [wander] ] if graphics-display = "Line-Up" [ ask turtles [line-up] ] if graphics-display = "Word-Sort" [ ask turtles [word-sort] ] end to auto-save-listener if auto-save? and not auto-saving? [ set auto-saving? auto-save? auto-save-prompt ] if auto-saving? and not auto-save? [ ifelse user-yes-or-no? "Do you really want to turn off auto-save world data?" [ set auto-saving? false] [ set auto-save? true ] ] end to save-button-prompt let option user-one-of (word "save QUESTIONS\n" "save all responses to a WEB page\n" "save INDividual responses to separate web pages\n" "save ALL data to a file\n" "auto-save NOW\n" "CANCEL" ) ["QUESTIONS" "ALL" "NOW" "CANCEL"] if option = "QUESTIONS" [save-questions-prompt] if option = "ALL" [save-world-prompt] if option = "NOW" [auto-save-now] end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;; ;;;;;; Turtle Movement procedures ;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; to sit ifelse color = voted?-color [ while [count turtles-here > 1 or xcor <= 0] [ setxy random-xcor random-ycor ] ] [ while [count turtles-here > 1 or xcor >= 0] [ setxy random-float min-pxcor random-ycor ] ] end to wander ;; turtle procedure rt 90 * random-float 4 ifelse color = voted?-color [ if xcor <= 0 [ set heading 90 ] ] [ if xcor >= 0 [ set heading 270] ] if patch-ahead 1 != nobody and not any? turtles-on patch-ahead 1 [ fd 1 ] end to line-up set heading 0 ifelse is-number? item current-question my-choices [ ifelse min [item current-question my-choices] of turtles < 0 or max [item current-question my-choices] of turtles > 10 [ set xcor ((1 + item current-question my-choices - min [item current-question my-choices] of turtles) * world-width / (1 + max [item current-question my-choices] of turtles - min [item current-question my-choices] of turtles) + min-pxcor)] [ set xcor ((1 + item current-question my-choices) * world-width / 12 + min-pxcor)] ] [ set xcor -1 * max-pxcor ] if count turtles-here > 1 [ jump random-float 4 ] if ((count turtles-at 0 -1 = 0) and (ycor > -1 * max-pycor)) [back 1] end to word-sort ifelse not is-string? item current-question my-choices [ while [(count turtles-here > 1) or not (abs xcor <= 3 and abs ycor <= 3) ] [setxy random-float 7 - 3 random-float 7 - 3] ] [ if not (sort-up = "") [ ifelse member? sort-up (item current-question my-choices) [ while [(count turtles-here > 1) or (ycor <= 0) or (abs xcor <= 3 and ycor >= 0)] [ set ycor (random-float max-pycor) + 1 set xcor xcor - 1 + random-float 3 ] ] [ while [(count turtles-here > 1) or (ycor >= 0) or (abs xcor <= 3 and ycor <= 0)] [ set ycor (random-float max-pycor) + min-pycor - 1 set xcor xcor - 1 + random-float 3 ] ] ] if not (sort-right = "") [ ifelse member? sort-right item current-question my-choices [ while [(count turtles-here > 1) or (xcor <= 0) or (xcor >= 0 and abs ycor <= 3)] [ set xcor (random-float max-pxcor) + 1 set ycor ycor - 1 + random-float 3 ] ] [ while [(count turtles-here > 1) or (xcor >= 0) or (xcor <= 0 and abs ycor <= 3)] [ set xcor (random-float max-pxcor) + min-pxcor - 1 set ycor ycor - 1 + random-float 3 ] ] ] ] end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;; ;;;;;; Client Message Processing Procedures ;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; to listen-clients while [hubnet-message-waiting?] [ hubnet-fetch-message ifelse hubnet-enter-message? [ execute-create ] [ ifelse hubnet-exit-message? [ ask turtles with [user-id = hubnet-message-source] [ die ] set plot-dirty? true ] [ ;; If the client hits the Choose button, then run this code. if hubnet-message-tag = "Choose" [ execute-choose ] ;; Whenever the client adjusts the slider Choice, run this code. if hubnet-message-tag = "Choice" [ change-choice ] if hubnet-message-tag = "Typed-Response" [ execute-type ] ;; If the clients can view questions as they like, then run this code. if steps-locked? = false [ ;; When the client hits the PREV button if hubnet-message-tag = "<;; When the client hits the NEXT button if hubnet-message-tag = "NEXT>>" [ execute-next ] ] ] ] ] end to execute-create create-poll-clients 1 [ let pos one-of patches with [not any? turtles-here] ifelse pos != nobody [ move-to pos ] [ user-message "Too many students. Make a bigger view." ] set user-id hubnet-message-source if names-showing? [ set label word user-id " "] set slider-value 25 clear-my-data if any? non-clients with [user-id = hubnet-message-source] [ set my-choices [my-choices] of one-of non-clients with [user-id = hubnet-message-source]] ask non-clients with [user-id = hubnet-message-source] [die] if steps-locked? = true [ set my-current-question current-question] set-my-current-question my-current-question ] end to execute-choose ask poll-clients with [user-id = hubnet-message-source] [ if (allow-change? or color = not-voted?-color) [ if my-current-question = current-question [set color voted?-color] set my-choices replace-item my-current-question my-choices slider-value hubnet-send hubnet-message-source "Current Choice" slider-value set activity activity + 1 ] ] if plot-showing? [ set plot-dirty? true ] end to execute-type ask poll-clients with [user-id = hubnet-message-source] [ if (allow-change? or color = not-voted?-color) [ if my-current-question = current-question [set color voted?-color] set my-choices replace-item my-current-question my-choices safer-read-from-string hubnet-message set activity activity + 1 ] ] if plot-showing? [ set plot-dirty? true ] end ;; Everytime you change the slider "Choice" ;; it changes the value of slider-value for the associated turtle. to change-choice ask poll-clients with [user-id = hubnet-message-source] [ set slider-value hubnet-message ] end to execute-prev ask poll-clients with [user-id = hubnet-message-source] [ if my-current-question > 0 [ set-my-current-question my-current-question - 1] ] end to execute-next ask poll-clients with [user-id = hubnet-message-source] [ if my-current-question + 1 < length question-list [ set-my-current-question my-current-question + 1] ] end to update-my-choice-list while [length my-choices < length question-list] ;;be sure that my-choices has enough spots [ set my-choices lput false my-choices ] end to set-my-current-question [n] if n >= 0 and n < length question-list ;;check to be sure that the question number is valid [ update-my-choice-list set my-current-question n ;;if it is, adjust the number the turtle has if breed = poll-clients [ hubnet-send user-id "Question Number" my-current-question send-question (item 0 item my-current-question question-list) ifelse (item my-current-question my-choices) = false ;;display the current choice on the client [ hubnet-send user-id "Current Choice" "" hubnet-send user-id "Typed-Response" "Click on the CHANGE button\n(in the top right corner of this widget)\nto type a response." ] [ if is-number? item my-current-question my-choices [ hubnet-send user-id "Current Choice" (item my-current-question my-choices) hubnet-send user-id "Typed-Response" "Click on the CHANGE button\n(in the top right corner of this widget)\nto type a response." ] if is-string? item my-current-question my-choices [ hubnet-send user-id "Current Choice" "" hubnet-send user-id "Typed-Response" (item my-current-question my-choices) ] ] ] ] end to send-question [question] ifelse length question <= 80 [ hubnet-send user-id "Question" question hubnet-send user-id "Question Two" "" hubnet-send user-id "Question Three" "" ] [ ifelse length question > 80 and length question <= 160 [ hubnet-send user-id "Question" substring question 0 80 hubnet-send user-id "Question Two" substring question 80 (length question) hubnet-send user-id "Question Three" "" ] [ hubnet-send user-id "Question" substring question 0 80 hubnet-send user-id "Question Two" substring question 80 160 hubnet-send user-id "Question Three" substring question 160 (length question) ] ] end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;; ;;;;;; Host Questions ;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; to-report build-question [what-type?] ifelse what-type? = "Likert" [ report (sentence (user-input "Input new question?") (list "Likert" read-from-string user-input "How many items?"))] [ report sentence user-input "Input new question?" what-type? ] end to add-question [what-type?] ;; If the question list is empty as indicated with "", then set to empty list. ;; Add the typed question to question-list ;; Set the host viewed question to be the one just entered. Is this necessary? set question-list lput (build-question what-type?) question-list set-current-question (length question-list - 1) clear-current-data end to set-current-question [n] if n >= 0 and n < length question-list [ set current-question n ask turtles [ ;; If all the clients are supposed to be on the same question, ;; then they switch to the host's question. ;; If not, they only check to be sure that ifelse steps-locked? = true [ set-my-current-question current-question] [ update-my-choice-list ] ifelse (item current-question my-choices) = false [ set color not-voted?-color ] [ set color voted?-color ] ] if plot-showing? [ set plot-dirty? true ] ] end to prev-question if current-question > 0 [ set-current-question current-question - 1] end to next-question if current-question + 1 < length question-list [ set-current-question current-question + 1] end to edit-question let option user-one-of (word "REPLACE - replace this question with a new one. This will clear the poll results for the question\n" "INSERT - insert a new question and move the current question one position later in the list\n" "DELETE - delete this question and it's poll results\n") ["REPLACE" "INSERT" "DELETE" "CANCEL"] if option = "REPLACE" [replace-question] if option = "INSERT" [insert-question] if option = "DELETE" [delete-question] end to-report choose-type let option user-one-of (word "What type of question?\n" "POLLER \n" "web TEXT \n" "LIKERT scale \n" "web NUMBER \n") ["POLLER" "TEXT" "LIKERT" "NUMBER"] if option = "POLLER" [report "Poller"] if option = "TEXT" [report "Web Text"] if option = "LIKERT" [report "Likert"] if option = "NUMBER" [report "Web Number"] end to replace-question set question-list replace-item current-question question-list build-question choose-type clear-current-data ask turtles [set-my-current-question my-current-question] end to insert-question set question-list (sentence (lput (build-question choose-type) (items 0 current-question question-list)) (items current-question length question-list question-list)) ask turtles [ set my-choices sentence (sentence items 0 current-question my-choices false) items current-question length my-choices my-choices if my-current-question >= current-question and steps-locked? = false [set my-current-question my-current-question + 1] ] clear-current-data ask turtles [set-my-current-question my-current-question] end to delete-question set question-list sentence (items 0 current-question question-list) (items (current-question + 1) (length question-list) question-list) ask turtles [ set my-choices sentence (items 0 current-question my-choices) (items (current-question + 1) (length my-choices) my-choices) ] if current-question = length question-list [set current-question (length question-list - 1)] ask turtles [ if my-current-question > current-question [set my-current-question (my-current-question - 1)]] set-current-question current-question ask turtles [set-my-current-question my-current-question] if length question-list = 0 [ clear-all-data-and-questions] end ;; reports items x through y - 1 of the list somelist ;; if x and y are the same, it reports an empty list to-report items [x y somelist] let n 0 let buildlist [] repeat (y - x) [ set buildlist lput (item (x + n) somelist) buildlist set n n + 1 ] report buildlist end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; Plotting Procedures ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; to do-plot if plot-mode-is? = "Histogram" [do-one-item-histogram] if plot-mode-is? = "Average" [do-multi-item-average] end to do-one-item-histogram clear-plot if length filter [is-number? ?] [item current-question my-choices] of turtles > 0 [ if max [item current-question my-choices] of turtles > 10 [ set-plot-x-range plot-x-min (ceiling max [item current-question my-choices] of turtles + 1) ] if min [item current-question my-choices] of turtles < 0 [ set-plot-x-range (floor min [item current-question my-choices] of turtles) plot-x-max] let current-data map [item current-question [my-choices] of ? ] sort turtles if not empty? remove false current-data [ set-current-plot-pen "data" histogram current-data ;; set-current-plot-pen "mean" ;; plot-vline mean current-data ;; set-current-plot-pen "median" ;; plot-vline median current-data ;; set-current-plot-pen "mode" ;; plot-modes current-data ] ] end to plot-vline [value] plotxy value 0 plotxy value plot-y-max end to plot-modes [lst] set lst remove false lst let values remove-duplicates lst ifelse length values = length lst [ histogram lst ] ;; no duplicates so all items are modes [ let counts [] let i 0 repeat length values [ set counts lput ((length lst) - (length remove (item i values) lst)) counts set i i + 1 ] let n max counts ;; how many votes for the most frequent choice(s)? while [member? n counts] [ set values (replace-item (position n counts) values false) set counts (replace-item (position n counts) counts 0) ] set values remove false values set i 0 repeat length values [ set lst (remove (item i values) lst) set i i + 1 ] histogram lst ] end to plot-average-prompt let startitem read-from-string user-input "First Question Number?" let enditem read-from-string user-input "Last Question Number?" if startitem >= 0 and enditem >= startitem and enditem < length question-list [ set plot-first startitem set plot-last enditem set show-data? true ] if startitem > enditem or enditem >= length question-list [ set plot-mode plot-mode-is?] end to do-multi-item-average clear-plot set-plot-x-range (plot-first) (plot-last + 1) set-plot-y-range 0 10 let index plot-first while [index <= plot-last] [ if count turtles with [is-number? item index my-choices] > 0 [ plotxy index ((sum [item index my-choices] of turtles with [is-number? item index my-choices]) / (count turtles with [is-number? item index my-choices]))] set index index + 1 ] end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;; ;;;;;; Saving Questions ;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Saving questions ;ALWAYS makes a web page. Poller data is hidden in comments at the bottom. to save-questions-prompt user-message "Select the directory and filename for your questions. You should add an extension - either .htm or .html\nIf you don't add an extension, NetLogo will automatically add .html" let option user-new-file ifelse is-string? option [ if not (substring option (length option - 5) (length option) = ".html") [ if not (substring option (length option - 4) (length option) = ".htm") [ set option word option ".html" ] ] save-questions-page option ] [ user-message "Save has been cancelled." ] end to save-questions-page [web-page] if file-exists? web-page [ file-delete web-page ] file-open web-page file-print "" file-print "" file-print (word " Poller Questions " (substring remove ":" date-and-time 0 6) " ") file-print "" file-print "" file-print "" file-print " " file-print "" file-print "" file-print "" file-close end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;; ;;;;;; Loading Questions ;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; to load-questions-prompt let chosen user-one-of (word "Load questions from a local FILE\n" "Load questions from a WEB page\n" "Load the BUILT-IN questions\n" "Load NO questions") ["FILE" "BUILT-IN" "NO"] if chosen = "FILE" [ user-message "Select the saved questions file." let load-file user-file ifelse is-string? load-file [ load-local load-file ] [ set chosen "NO" ] ] if chosen = "BUILT-IN" [ load-sample-questions ] if chosen = "NO" [ ;do nothing, just end ] end ;load the data file locally, and extract the question information from it to load-local [from-where?] ifelse file-exists? from-where? [ file-open from-where? let z-data "" output-show word "load-local ---- " z-data while [not file-at-end?] [ set z-data word z-data file-read-characters 100 output-show word "load-local ---- " z-data ] file-close clear-all-data-and-questions output-show read-setup z-data set web-questions which-questions-are-web? question-list set-current-question 0 ask turtles [ clear-my-data set-my-current-question 0 ] ] [ user-message "NetLogo can't load a non-existent file. Load canceled." ] end ;to-report is-url? [str] ; ifelse ("" = __check-syntax ("show read-url \"" + str + "\"")) ; [ report true ] ; [ report false ] ;end ;does all of the setting of variables and stuff. ;ALSO, reports true is successful, false if not to-report read-setup [some-data] let z-start position "" some-data ifelse is-number? z-end [ let z-data substring some-data z-start z-end clear-all-data-and-questions set question-list read-from-string z-data set-current-question 0 ask turtles [ clear-my-data set-my-current-question 0 ] set question-list read-from-string z-data report true ] [ report false ] ] [ report false ] end to-report web-data-where [response-file] if substring response-file (length response-file - 5) (length response-file) = ".html" [ report word substring response-file 0 (length response-file - 5) ".fs"] if substring response-file (length response-file - 4) (length response-file) = ".htm" [ report word substring response-file 0 (length response-file - 4) ".fs"] report response-file end to-report which-questions-are-web? [z-list] let a-list [] let index 0 repeat length z-list [ if not (item 1 item index z-list = "Poller") [ set a-list lput index a-list ] set index index + 1 ] report a-list end to-report safer-read-from-string [str] ifelse ("" = __check-syntax (word "output-show read-from-string \"\" + " str)) [ report (read-from-string str) ] [ report str ] end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;; ;;;;;; Save World (to capture EVERYTHING that is going on) ;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; to save-world-prompt user-message "Select the directory and filename for your saved world. The extension .csv will be automatically added." let save-file word user-new-file ".csv" ifelse is-string? save-file [ export-world save-file ] [ user-message "Save has been cancelled." ] end to load-world-prompt if user-yes-or-no? (word "LOAD WORLD will clear all current data and remove all students.\n\n" "Do you want to continue?") [ user-message "Select the saved world file." let load-file user-file ifelse is-string? load-file [ import-world load-file ] [ user-message "Load world has been cancelled." ] ] end to auto-save-prompt if ((auto-save-directory = "") or (not is-string? auto-save-directory)) [ auto-save-directory-change ] if is-string? auto-save-directory [ if ((auto-save-file = "") or (not is-string? auto-save-file)) [ auto-save-file-change ] ifelse ((auto-save-file = "") or (not is-string? auto-save-file)) [ user-message "Auto-save setup has been cancelled. Use the AUTO-SAVE? switch to turn on the autosave feature." set auto-save? false ] [ set auto-saving? true ] ] end to auto-save-directory-change let option false user-message "Select a directory for the auto-save files. " set option user-directory ifelse is-string? option [ set auto-save-directory option] [ user-message "World auto save directory has been left UNCHANGED"] end to auto-save-file-change let option false user-message "Choose a new base file name for the auto-save files. " set option user-input "Base filename" ifelse is-string? option [ set auto-save-file option] [ user-message "World auto save base filename has been left UNCHANGED"] end to auto-save if auto-saving? [ export-world (word auto-save-directory "/" auto-save-file (substring remove ":" date-and-time 0 6) ".csv")] set activity 0 end to auto-save-now if not auto-saving? [ set auto-save? user-yes-or-no? "Auto-save all data to file?" if auto-save? [ auto-save-prompt ] ] if auto-saving? [ export-world (word auto-save-directory "/" auto-save-file (substring remove ":" date-and-time 0 6) "NOW.csv") ] end to save-responses [to-where?] let my-file (word to-where? "/" user-id (substring remove ":" date-and-time 0 6) ".html") if file-exists? my-file [ file-delete my-file ] file-open my-file file-print "" file-print "" file-print (word "Poller Responses " user-id " " (substring remove ":" date-and-time 0 6) " ") file-print "" file-print "" file-print "" let counter-q 0 repeat length question-list [ file-print "
" file-print "" file-print "" file-close end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;; ;;;;;; Export poll responses as spreadsheet file ;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; to save-polls-prompt user-message "Select the directory and filename for your saved poll results. You may want to add an extension (like .txt or .poll)" let save-file user-new-file ifelse is-string? save-file [ save-polls save-file ] [ user-message "Save has been cancelled." ] end to save-polls [ towhere? ] if count turtles > 0 [ file-open towhere? file-type "User-ID\t" let counter-t 0 repeat count turtles [ file-type [ user-id ] of turtle counter-t file-type "\t" set counter-t counter-t + 1 ] file-print "" let counter-q 0 repeat length question-list [ file-type item 0 item counter-q question-list file-type "\t" set counter-t 0 repeat count turtles [ file-type [item counter-q my-choices] of turtle counter-t file-type "\t" set counter-t counter-t + 1 ] file-print "" set counter-q counter-q + 1 ] file-close ] end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;; ;;;;;; Pop Up Help ;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; to help-autosave user-message (word "HELP: Autosave settings\n\n" "When turned on, autosave will periodically automatically save your classroom data.\n" "The slider 'auto-save-every' determines how often auto-save happens. " "You can autosave all of the current data (student data and your current viewing settings) " "using the regular auto-save feature. You can turn this on using 'auto-save?'\n" "You can also autosave questions and students responses to an html file, for viewing on the web. " "You can turn this on using 'auto-save-web?'") end to help-save user-message (word "HELP: Save options : Page 1 of 2\n\n" "You can save all of the current data (student data and your current viewing settings) " "using the 'Save ALL' button. This saves data in the same format as 'auto-save' above.\n" "You can load this data for later viewing using the 'Load ALL' button. This will overwrite " "everything in the current model, so you may want to save current data before using this.") user-message (word "HELP: Save options : Page 2 of 2\n\n" "'Save RESPONSES as SPREADSHEET' will save the questions and student responses in a format " "readable by most spreadsheet programs.\n\n" "'Save RESPONSES as WEBPAGE' saves all questions and student responses to an html file. " "This file can be viewed in any web browser, and is the same format used by 'auto-save-web?' above.\n\n" "'Save INDIVIDUAL responses' saves each students responses (along with the questions) to a separate " "html file.") end to help-web user-message (word "HELP: Web Response settings : Page 1 of 2\n\n" "This tool can read responses that students have submitted to a web page " "(also generated by the discussion tool)\n" "When you have 'web-responses?' on, this tool will periodically check for new submissions " "to the web page. The web pages generated by this tool require that you use Formsaver " "(a free application for Macintosh servers) This is not an endorsement of said product, but a " "historical artifact of the originating project.") user-message (word "HELP: Web Response settings : Page 2 of 2\n\n" "To use web questions in class, you must first prepare the questions. Go to the third panel " "(scroll to the right) to find the preparation section. After the questions are prepared, you " "must put the web page on the server, where students can access the page. You should also prepare " "the page by submitting a set of default responses. In class, when you setup the activity, you can " "choose to load the questions from a web page. Put in the URL for this question page, and NetLogo " "will automatically load the questions you prepared and the students' responses.") end to help-prepare user-message (word "HELP: Preparation : Page 1 of 3\n\n" "In this screen, you can prepare questions for class. You can prepare in class questions that " "use HubNet to gather real time responses from your students, and you can prepare web-based " "questions to allow students to give responses out of class, too " "(or to share information not easily shared using the in class polling)\n\n" "'SETUP' will clear everything in the current activity, and give you the option of loading an existing " "set of questions.\n\n" "'New Poller Question' will generate a new question that uses the HubNet client. " "Using the HubNet client, students will be able to share integer responses from 0 to 50 and typed " "responses in real-time in class.\n\n" "'New Web Text Question' creates a new web based text entry question. Students will be able to go to the " "web page and submit a typed response to this question.\n\n") user-message (word "HELP: Preparation : Page 2 of 3\n\n" "'New Likert Scale Question' creates a question for which students choose a number from 0 to n.\n\n" "New Web Number Question' creates a question for which students supply a typed number response." "The arrow buttons allow you to move between the questions you've created.\n\n" "'Edit Question' allows you to Delete, Replace, or Insert a new question at the current " "spot in the question list.\n\n" "'Clear Questions' clears all of the current questions.") user-message (word "HELP: Preparation : Page 3 of 3\n\n" "When you are satisfied with the question list, hit 'PREPARATIONS FINISHED.' " "This will generate an html file in which you can view the questions (and to which you can add " "pictures or other materials). This file also contains the question data in a format that this " "NetLogo model can work with.\n\n" "If you have web based questions, you should copy this preparation file to a Formsaver equipped " "web server. You should then go to that page in your web browser and submit a sample set of responses " "using the name QUESTIONS. If you do not have web based questions, just be sure to remember where you " "put the file.\n\n" "In class, when the activity starts up, you can choose to load a question file. If you used " "web questions, then choose WEB. If you did not, just load a LOCAL file. Either way, tell " "NetLogo where to find your file. It will automatically load the questions, and you'll be ready to go.") end ; Copyright 2002 Uri Wilensky and Walter Stroup. ; See Info tab for full copyright and license." file-print " " set counter-q counter-q + 1 ] file-print "" file-print (word "" item 0 item counter-q question-list "") file-print " " file-print "" file-print item counter-q my-choices file-print " " file-print "
There are 7 versions of this model.
Attached files
File | Type | Description | Last updated | |
---|---|---|---|---|
Polling Advanced.png | preview | Preview for 'Polling Advanced' | over 11 years ago, by Uri Wilensky | Download |
This model does not have any ancestors.
This model does not have any descendants.