;; add play against the computer ;; occupy a space - no other turtle can take that space. ;; add a random number monitor to figure out who goes first. ;; the setup button makes the yellow boxes on the game board. to setup ca ask patches [set pcolor white - 2 if member? pxcor [4 11 17 -3 -10 -17] [set pcolor blue + 3] if member? pycor [4 11 17 -3 -10 -17] [set pcolor blue + 3] ] end ;; the row example button makes the game board and also sets the turtle's ;; characteristics along with position on the game board. This button shows ;; an example of a sequence that is in a row. to row-example ca ask patches [set pcolor white - 2 if member? pxcor [4 11 17 -3 -10 -17] [set pcolor blue + 3] if member? pycor [4 11 17 -3 -10 -17] [set pcolor blue + 3] ] crt 4 ask turtles [set size 7 set color red ] ask turtle 0 [set xcor -14 set ycor -13] ask turtle 1 [set xcor -7 set ycor -14] ask turtle 2 [set xcor 0 set ycor -13] ask turtle 3 [set xcor 8 set ycor -13] end ;; the column example button makes the game board and also sets the turtle's ;; characteristics along with position on the game board. This button shows ;; an example of a sequence that is in a column. to column-example ca ask patches [set pcolor white - 2 if member? pxcor [4 11 17 -3 -10 -17] [set pcolor blue + 3] if member? pycor [4 11 17 -3 -10 -17] [set pcolor blue + 3] ] crt 4 ask turtles [set shape "arrow" set size 7 set color pink ] ask turtle 0 [set xcor 0 set ycor 14] ask turtle 1 [set xcor 0 set ycor 8] ask turtle 2 [set xcor 0 set ycor 1] ask turtle 3 [set xcor 0 set ycor -6] end ;; the diagonal example button makes the game board and also sets the turtle's ;; characteristics along with position on the game board. This button shows ;; an example of a sequence that is in a diagonal. to diagonal-example ca ask patches [set pcolor white - 2 if member? pxcor [4 11 17 -3 -10 -17] [set pcolor blue + 3] if member? pycor [4 11 17 -3 -10 -17] [set pcolor blue + 3] ] crt 4 ask turtles [set shape "turtle" set size 7 set color green ] ask turtle 0 [set xcor -14 set ycor 14] ask turtle 1 [set xcor -6 set ycor 8] ask turtle 2 [set xcor 0 set ycor 1] ask turtle 3 [set xcor 7 set ycor -7] end ; *** NetLogo Model Copyright Notice *** ; ; This activity and associated models and materials were created as part of the project: ; MODELING ACROSS THE CURRICULUM. The project gratefully acknowledges the support of the ; National Science Foundation, National Institute of Health and the Department of Education ; (IERI program) -- grant number REC # 0115699. Additional support was provided through the ; project: PARTICIPATORY SIMULATIONS: NETWORK-BASED DESIGN FOR SYSTEMS LEARNING IN CLASSROOMS ; -- NSF (REPP program) -- grant number REC #9814682. ; ; Copyright 2003 by Uri Wilensky. Updated 2003. All rights reserved. ; ; Permission to use, modify or redistribute this model is hereby granted, ; provided that both of the following requirements are followed: ; a) this copyright notice is included. ; b) this model will not be redistributed for profit without permission ; from Uri Wilensky. ; Contact Uri Wilensky for appropriate licenses for redistribution for ; profit. ; ; To refer to this model in academic publications, please use: ; Wilensky, U. (2003). NetLogo Chem Sequence model. ; http://ccl.northwestern.edu/netlogo/models/ChemSequence. ; Center for Connected Learning and Computer-Based Modeling, ; Northwestern University, Evanston, IL. ; ; In other publications, please use: ; Copyright 1998 by Uri Wilensky. All rights reserved. See ; http://ccl.northwestern.edu/netlogo/models/ChemSequence ; for terms of use. ; ; *** End of NetLogo Model Copyright Notice *** @#$#@#$#@ GRAPHICS-WINDOW 314 10 639 356 17 17 9.0 1 10 1 1 1 CC-WINDOW 9 359 631 479 Command Center BUTTON 10 284 128 338 Setup setup NIL 1 T OBSERVER T TEXTBOX 12 31 302 79 The Goal of the Sequence Game:\nTo get four of your pieces to line up in a row, in a column, or diagonally. TEXTBOX 151 299 285 342 Press the SetUp Button to see the game board. BUTTON 146 73 281 106 A Row Sequence Row-example NIL 1 T OBSERVER T BUTTON 145 119 281 152 A Column Sequence column-example NIL 1 T OBSERVER T BUTTON 145 169 281 202 A Diagonal Sequence diagonal-example NIL 1 T OBSERVER T TEXTBOX 8 106 133 184 Use the buttons on the right to see all the different types of sequences. TEXTBOX 10 206 297 274 To Play the Game:\nUse the Command Center to create turtles, change their size, shape and headings and move them to your desired position on the board. TEXTBOX 27 498 209 648 Primatives list:\nO> crt #\nO> ask turtle # [set shape ....]\nO> ask turtle # [set size ....]\nO> ask turtle # [set color ....]\nO> ask turtle # [rt #]\nO> ask turtle # [lt #]\nO> ask turtle # [fd #]\nO> ask turtle # [bk #] @#$#@#$#@ Connected Chemistry Curriculum is currently under development, for more information please refer to http://ccl.northwestern.edu/curriculum/chemistry/ WHAT IS IT? ----------- Sequence is a classic board game where players are competing to get their tokens into a sequence. A sequence includes four of the same tokens arranged in a row, a column or diagonally. In the board game version, players use a deck of cards and a game board that has the matching cards imprinted upon it. The players use the cards as a way to determine where tokens can be placed on the board. If the player has the corresponding card in their hand, they may use that card to claim that spot on the board. In this model, we have removed the card element of the game. The players can decide without cards where their token should be placed. This model was designed to help users learn how to write commands within the Command Center. In this version of the game, users will create their own game tokens by creating turtles and altering their appearance (color, size, and shape). They will then have to instruct the turtle to a desired spot on the game board. The user has to try to make a sequence while also trying to keep the other player from making his or her own sequence. HOW IT WORKS ------------ Rules of the Game: --- Flip a coin to determine who goes first. --- At each turn, the player must create their own turtle by using the following... O>crt 1 --- After a turtle has been created, the player changes the turtle into a token. The player can change the turtle's color by using the set color command. The player can also change the size and shape of the turtle by using the set size and set shape command. O>ask turtle 0 [set color red set size 7 set shape "thin-arrow"] --- Player then moves turtle to desired location by using the rt, left bk and fd primitives. O>ask turtle 0 [rt 90 fd 7] This will move turtle # 0 right 90 degrees and forward 7 patches. O> ask turtle 0 [lt 180 fd 10] This will move turtle # 0 left 180 degrees and forward 10 patches. --- The player must create, change and move turtle in three or less commands within the command center. If the player does it in more than three commands, they loose their turtle and their turn. The opposing player has the authority to remove the token... O> ask turtle # [die] (this command will remove the turtle) --- All new turtles that are created start at point (0,0) or the middle square in the Graphics Window. If a turtle has already claimed that square, the newly created turtle will sit on top of the turtle until the player moves it. For the purpose of the game, no two turtles can claim the same square. It is physically possible for this to happen in NetLogo, but it is against the rules and should be corrected. --- When creating and moving turtles, they may occupy the same square while moving to their final square. This is permit able as long as they are only stopping on the already occupied square to reset their headings. When this happens, the square will look like it has only one turtle inside; this is because they are sitting on each other. --- The position of the pieces on the game board will not be saved. If you press any of the buttons to the left of the Graphics Window, all the tokens and their positions will be erased. HOW TO USE IT ------------- Buttons: A ROW SEQUENCE - illustrates what a row sequence would look like to win. A COLUMN SEQUENCE - illustrates on the game board what a column sequence would look like to win. A DIAGONAL SEQUENCE - illustrates on the game board what a diagonal sequence would look like to win. SETUP - sets up the game board at the beginning of play. THINGS TO NOTICE ---------------- The blue grid in the Graphics Window does not directly correlate with the position of the patches. You may notice that when you move a turtle forward one, it advances one patch not one square. Therefore, you may need to move the turtle forward 6 or 7 patches to place the turtle in the middle of a square. When turtles are created they are assigned a number. The first turtle created is numbered at 0 and the second turtle's number is 1 and so forth. To check a turtle's number, press the control button and click on the desired turtle simultaneously, if you are using a Mac. For PC users, right click on the desired turtle. You will see a pull down menu that says to inspect turtle #. This will tell you the turtle's number. There are a number of ways you can get your turtles to change their characteristics and move within the game board. One way to move your turtles is by using the Command Center and writing commands for the turtle as the observer. By changing the O> to a T> on the left side of the command box, all commands are directed to the turtles only. Once you understand how commands change the behavior of turtles and patches, you may want to use turtle monitors as a short cut to changing the turtle's characteristics and moving it to the desired location. You can open a turtle monitor on a particular turtle by using the above directions to inspect a turtle. THINGS TO TRY ------------- 1. Try to change all the turtle characteristics and move the turtle within one command in the command center. 2. Try to get your turtle in the desired square by only turning it once. 3. Use only the back command to move your turtle. 4. Have all the turtles move one square to the right after each turn. Notice the turtles wrap around the screen. This could make both getting a sequence and defending an area challenging. 5. Use the set xcor and ycor primitives to move turtles to desired squares. 6. Come up with more rules or adaptations of the game. EXTENDING THE MODEL ------------------- 1. Create a button that shows all three of the possible ways to win on the same game board. 2. Get all the shapes to point in the same direction. 3. Create a button that allows the user to change shapes in the middle of the game. 4. Write code that uses the mouse to place the turtles in the desired square. 5. Add a slider that changes the step size of the turtle. 6. Add a flip monitor to determine which player will go first. CREDITS AND REFERENCES ----------------------- To refer to this model in academic publications, please use: Wilensky, U. (2003). NetLogo Chem Sequence model. http://ccl.northwestern.edu/netlogo/models/ChemSequence. Center for Connected Learning and Computer-Based Modeling, Northwestern University, Evanston, IL. In other publications, please use: Copyright 2003 by Uri Wilensky. All rights reserved. See http://ccl.northwestern.edu/netlogo/models/ChemSequence for terms of use. @#$#@#$#@ default true 0 Polygon -7566196 true true 150 5 40 250 150 205 260 250 arrow true 0 Polygon -7566196 true true 150 0 0 150 105 150 105 293 195 293 195 150 300 150 spacecraft true 0 Polygon -7566196 true true 150 0 180 135 255 255 225 240 150 180 75 240 45 255 120 135 thin-arrow true 0 Polygon -7566196 true true 150 0 0 150 120 150 120 293 180 293 180 150 300 150 turtle true 0 Polygon -7566196 true true 138 75 162 75 165 105 225 105 225 142 195 135 195 187 225 195 225 225 195 217 195 202 105 202 105 217 75 225 75 195 105 187 105 135 75 142 75 105 135 105 @#$#@#$#@ NetLogo 2.0beta5 @#$#@#$#@ setup column-example @#$#@#$#@ @#$#@#$#@