⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ---groupd.nlogo

📁 NETLOGO
💻 NLOGO
📖 第 1 页 / 共 2 页
字号:
breeds [shark minnow]  ;; Makes the turtles into the breeds of sharks and minnows.globals [number-eaten time-left gameover?] ;; Makes globals for number-eaten and time-leftto setup    ca ;;Clears All.    set gameover? false    set number-eaten 0 ;;Set the moniter at no minnows been eaten.    create-custom-shark 1 ;; Turns a turtle in to the shark breed.    [        set color grey ;;Sets shark color gray.        set shape "shark" ;;Sets sharks shape to "shark."        set size 5 ;;Sets shark size 5.        setxy 0 4 ;;Makes shark start at corddinates 0,4 at beginning of each game.    ]       create-minnow 40 ;;Creates 40 minnows out of turtles.    ask minnow    [        set color brown  ;;Sets their color to be brown.        set shape "minnow" ;; Sets their shape to be a "minnow."        set size 2        ;;Sets all minnow sizes to be two.        setxy (random screen-size-x) (-20 + (random 6)) ;; Sets all the minnows to anywhere on the x-axis    ]                           ask patches     [     ;;Asks patches to do something.            set pcolor blue ;;Sets the patch color blue.        if (pycor < -14) [set pcolor green] ;; If the pycor is < -14 set the patch color green.            if (pycor > 18) [set pcolor red] ;; If the pycor is > 18 set the patch color red.    ]endto play    every 0.1 [ move-shark ]  ;;Shark moves every .1 of a second.    every 0.4 [ move-minnow ] ;;Minnows move every .4 of a second.     every 1 [decrement-time] ;;every second takes away a second from the timer.    check-gameover    if (gameover?) [stop] endto move-shark ;; Tells how to move the shark.    ask shark [ ;;Asks the shark to do something.        if ((ycor < 18) and (ycor > -14)) ;; If the ycor is < than 18 and > than - 14 go forward one (see next command).        [            fd 1        ]        if (ycor = 18);; If the ycor is equal to 18 set the heading for 180 degrees then go forward one patch. (See next two commands).        [            set heading 180             fd 1        ]        if (ycor = -14);; if the ycor is equal to -14 set the heading to 0 zero degrees and go forward one patch. (See next two commands)        [            set heading 0            fd 1        ]        ask minnow at-points [[0 0] [0 1] [1 1] [1 0] [1 -1] [0 -1] [-1 -1] [-1 0] [-1 1]]  ;;Anytime a minnnow is in once of these patches add to score then let the minnow die.        ;;See next two commands.        [            ;add to score            set number-eaten number-eaten + 1            die        ]    ]endto move-minnow  ;; Shows how to move minnows.    ask minnow [ ;;Ask minnows to do something.        if (ycor <= -19)  ;; If the ycor is <= -19        [            set heading 0 ;;Set the  heading to zero.            fd 5  ;;Move forward five spaces.        ]        if (ycor < 18) ;;If the ycor is  < than 18.        [             set heading (90 - random 181) ;; Set heading to 90 degrees minus a random 181 degrees.            fd 1 ;; Then go forward one patch.        ]    ]endto move-up    ask shark [ set heading 0 ]  ;;Asks the shark to set heading to zero to move up.endto move-left    ask shark [ set heading 270 ] ;; Asks shark to set heading to 270 degrees to move left.endto move-right    ask shark [set heading 90]  ;; Ask shark to set heading to 90 degrees to move to the right.endto move-down    ask shark [set heading 180] ;; Asks shark to set heading to 180 to move down.end    to decrement-time    set time-left precision (time-left - 1) 0 end                                                                      to Level1    setup  ;;See setup above.       set time-left 180 ;; Set the time to play game to 180 seconds.endto Level2  ;; See setup above.    setup     set time-left 150 ;; Set the time to play game to 150 seconds.endto Level3  ;; See setup above.    setup    set time-left 120 ;; Set the time to play game to 120 seconds.endto Level4  ;; See setup above.    setup    set time-left 90  ;; Set the time to play game to 90 seconds.endto Level5  ;; See setup above.    setup    set time-left 60  ;; Set the time to play game to 60 seconds.endto Level6  ;;See setup above.    setup    set time-left 30  ;;Set the time to play game to 30 seconds.end to check-gameover  ;; Checks to make sure game is over.    if (number-eaten >= 35) ;; If 35 minnows or more are eaten the timer sets to zero and you win        [set time-left 0              print "you won"   ;; Prints out " You won."             set gameover? true              ]       if (time-left <= 0 and number-eaten < 35) ;; If there is no time left and  the number of minnows eaten are less than 35 print " You Lost."      [print "you lost"       set gameover? true]             end  @#$#@#$#@GRAPHICS-WINDOW32034822557202012.011001CC-WINDOW426586751705Command CenterBUTTON113119177153rightmove-rightNIL1TOBSERVERBUTTON7983143117upmove-upNIL1TOBSERVERBUTTON68341168374Start playT1TOBSERVERBUTTON44120107153leftmove-leftNIL1TOBSERVERBUTTON77155146189downmove-downNIL1TOBSERVERMONITOR311921168Number of Minnows Eatennumber-eaten31MONITOR221130285179NILtime-left31BUTTON30216107249Level 1Level1NIL1TOBSERVERBUTTON30252107285Level 2Level2NIL1TOBSERVERBUTTON30289107322Level 3Level3NIL1TOBSERVERBUTTON125216202249Level 4Level4NIL1TOBSERVERBUTTON125252202285Level 5Level5NIL1TOBSERVERBUTTON125289202322Level 6Level6NIL1TOBSERVERTEXTBOX9222421012287  SHARKS \n   AND \n MINNOWS@#$#@#$#@INTRODUCTION:-------------	This game, Sharks and Minnows, played in and out of the pool, has now been moved to a new location, the computer! Sharks and Minnows now have a few minor changes you're sure to enjoy.A BRIEF DISCRIPTION OF THE GAME:--------------------------------	Sharks and Minnows is played by children in many places.	The basic idea is there is a startand finishline for the minnows to swim to.  While they swim across the shark trys to grab as many of the minnows in the amount of time given, and/or before all the minnows go to the otherside.	There are six levels to beat the game.  Each level gives you less time to catch thirty-five minnows out of the forty.  When your time is up you may press the play button to stop the game and move to the next level.	You control the shark!HOW TO USE:-----------1.Click the level you want to play to set up the game.  We recommend beginners starting at level one.2.)Click the start/stop button to start all the minnows movement.	-At this time you may start controlling the shark3.) Use the direction keys (up,down,left, and right)to control the shark.4.)If you pass the level you just played, to start the next level please click the button for the level above the one you just passed.5.) After you pass the level hit the start/stop buton to stop the game.6.) If you lose the level you may go back to hit start/stop and start again.7.) You may look at the timer to see how much time you have left.8.)You may look at the "Number of Minnows Eaten" moniter to see how many minnows you have eaten.9.) Press start/stop button when time-left is at zero.PLEASE TAKE NOTE:------------------ If you go all the way off the side of the page you will show up as the shark on the other side of the page.- Sharks may not go into the green or red zones. (It will bounce off the boundary lines for the zones.)- Any minnow you come in a small range of will dissapear. This means you have eaten the minnow. It will add this to the score.- The blue background is the sharks territory and is where the minnows can be eaten.- The timer may go negitive so make sure to press the play button when you are done.Idea's for Extending the Model:-------------------------------- If you really enjoy this game you can always modify it.- An idea to make it harder would be to make more minnnows to catch.- Or you could make the minnows go at a faster speed by using  the speed dial at the top of the screen.CREIDITS AND REFERENCES:------------------------- To refer to this model in academic publications, please use: WIlensky, U.- Computer Sciences G.A.M.E.S. 2003 teachers and councilers (THANKS!)- NetLogo Frogger Model.- NetLogo Pac-Man Model.@#$#@#$#@defaulttrue0Polygon -7566196 true true 150 5 40 250 150 205 260 250anttrue0Polygon -7566196 true true 136 61 129 46 144 30 119 45 124 60 114 82 97 37 132 10 93 36 111 84 127 105 172 105 189 84 208 35 171 11 202 35 204 37 186 82 177 60 180 44 159 32 170 44 165 60Polygon -7566196 true true 150 95 135 103 139 117 125 149 137 180 135 196 150 204 166 195 161 180 174 150 158 116 164 102Polygon -7566196 true true 149 186 128 197 114 232 134 270 149 282 166 270 185 232 171 195 149 186 149 186Polygon -7566196 true true 225 66 230 107 159 122 161 127 234 111 236 106Polygon -7566196 true true 78 58 99 116 139 123 137 128 95 119Polygon -7566196 true true 48 103 90 147 129 147 130 151 86 151Polygon -7566196 true true 65 224 92 171 134 160 135 164 95 175

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -