Alphabetical: アルファベット順: A B C D E F G H I J L M N O P R S T U V W X Y ? |
Categories:
Turtle -
Patch -
Agentset -
Color -
Task -
Control/Logic -
World -
Perspective Input/Output - File - List - String - Math - Plotting - Links - Movie - System - HubNet カテゴリ: タートル - パッチ - エージェント集合 - 色 - コントロール/論理 - タスク - ワールド - 視点 HubNet - 入出力 - ファイル - リスト - 文字列 - 数理演算 - プロット - リンク - 動画 - BehaviorSpace - システム |
Special: Variables - Keywords - Constants 特殊: 組み込み変数 - 予約語 - 定数 |
This is an approximate grouping. Remember that a turtle-related primitive might still be used by patches or the observer, and vice versa. To see which agents (turtles, patches, links, observer) can actually run a primitive, consult its dictionary entry.
以下の分類は大まかなものです。「タートル関連」に分類しているプリミティブをパッチやオブザーバーでも使うものもありますし、その逆のケースもあります。各プリミティブを動作させるのが実際にはどのエージェント(タートル、パッチ、リンク、オブザーバー)なのかはディクショナリの各項目を参照してください。
back (bk) can-move? clear-turtles (ct) create-turtles (crt) create-<breeds品種集合> create-ordered-turtles (cro) create-ordered-<breeds品種集合> die distance distancexy downhill downhill4 dx dy face facexy forward (fd) hatch hatch-<breeds品種集合> hide-turtle (ht) home inspect is-turtle? is-<breeds品種集合>? jump layout-circle left (lt) move-to myself nobody no-turtles of other patch-ahead patch-at patch-at-heading-and-distance patch-here patch-left-and-ahead patch-right-and-ahead pen-down (pd) pen-erase (pe) pen-up (pu) random-xcor random-ycor right (rt) self set-default-shape __set-line-thickness setxy shapes show-turtle (st) sprout sprout-<breeds品種集合> stamp stamp-erase stop-inspecting subject subtract-headings tie towards towardsxy turtle turtle-set turtles turtles-at <breeds品種集合>-at turtles-here <breeds品種集合>-here turtles-on <breeds品種集合>-on turtles-own untie uphill uphill4
clear-patches (cp) diffuse diffuse4 distance distancexy import-pcolors import-pcolors-rgb inspect is-patch? myself neighbors neighbors4 nobody no-patches of other patch patch-at patch-ahead patch-at-heading-and-distance patch-here patch-left-and-ahead patch-right-and-ahead patch-set patches patches-own random-pxcor random-pycor self sprout sprout-<breeds品種集合> stop-inspecting subject turtles-here
all? any? ask ask-concurrent at-points count in-cone in-radius is-agent? is-agentset? is-patch-set? is-turtle-set? link-heading link-length link-set link-shapes max-n-of max-one-of member? min-n-of min-one-of n-of neighbors neighbors4 no-patches no-turtles of one-of other patch-set patches sort sort-by sort-on turtle-set turtles with with-max with-min turtles-at <breeds品種集合>-at turtles-here <breeds品種集合>-here turtles-on <breeds品種集合>-on
approximate-hsb approximate-rgb base-colors color extract-hsb extract-rgb hsb import-pcolors import-pcolors-rgb pcolor rgb scale-color shade-of? wrap-color
and ask ask-concurrent carefully end error error-message every if ifelse ifelse-value let loop not or repeat report run runresult ; (semicolon) ; (セミコロン) set stop startup to to-report wait while with-local-randomness without-interruption xor
filter foreach is-command-task? is-reporter-task? map n-values reduce run runresult sort-by task
clear-all (ca) clear-drawing (cd) clear-globals clear-patches (cp) clear-ticks clear-turtles (ct) display import-drawing import-pcolors import-pcolors-rgb no-display max-pxcor max-pycor min-pxcor min-pycor patch-size reset-ticks resize-world set-patch-size stop-inspecting-dead-agents tick tick-advance ticks world-width world-height
follow follow-me reset-perspective (rp) ride ride-me subject watch watch-me
hubnet-broadcast hubnet-broadcast-clear-output hubnet-broadcast-message hubnet-clear-override hubnet-clear-overrides hubnet-clients-list hubnet-enter-message? hubnet-exit-message? hubnet-kick-all-clients hubnet-kick-client hubnet-fetch-message hubnet-message hubnet-message-source hubnet-message-tag hubnet-message-waiting? hubnet-reset hubnet-reset-perspective hubnet-send hubnet-send-clear-output hubnet-send-follow hubnet-send-message hubnet-send-override hubnet-send-watch hubnet-set-client-interface
beep clear-output date-and-time export-view export-interface export-output export-plot export-all-plots export-world import-drawing import-pcolors import-pcolors-rgb import-world mouse-down? mouse-inside? mouse-xcor mouse-ycor output-print output-show output-type output-write print read-from-string reset-timer set-current-directory show timer type user-directory user-file user-new-file user-input user-message user-one-of user-yes-or-no? write
file-at-end? file-close file-close-all file-delete file-exists? file-flush file-open file-print file-read file-read-characters file-read-line file-show file-type file-write user-directory user-file user-new-file
but-first but-last empty? filter first foreach fput histogram is-list? item last length list lput map member? modes n-of n-values of position one-of reduce remove remove-duplicates remove-item replace-item reverse sentence shuffle sort sort-by sort-on sublist
Operators 演算子 (<, >, =, !=, <=, >=) but-first but-last empty? first is-string? item last length member? position remove remove-item read-from-string replace-item reverse substring word
Arithmetic Operators 算術演算子 (+, *, -, /, ^, <, >, =, !=, <=, >=) abs acos asin atan ceiling cos e exp floor int is-number? ln log max mean median min mod modes new-seed pi precision random random-exponential random-float random-gamma random-normal random-poisson random-seed remainder round sin sqrt standard-deviation subtract-headings sum tan variance
autoplot? auto-plot-off auto-plot-on clear-all-plots clear-plot create-temporary-plot-pen export-plot export-all-plots histogram plot plot-name plot-pen-exists? plot-pen-down plot-pen-reset plot-pen-up plot-x-max plot-x-min plot-y-max plot-y-min plotxy set-current-plot set-current-plot-pen set-histogram-num-bars set-plot-pen-color set-plot-pen-interval set-plot-pen-mode set-plot-x-range set-plot-y-range setup-plots update-plots
both-ends clear-links create-link-from create-<breed品種>-from create-links-from create-<breeds品種集合>-from create-link-to create-<breed品種>-to create-links-to create-<breeds品種集合>-to create-link-with create-<breed品種>-with create-links-with create-<breeds品種集合>-with die hide-link in-link-neighbor? in-<breed品種>-neighbor? in-link-neighbors in-<breed品種>-neighbors in-link-from in-<breed品種>-from is-directed-link? is-link? is-link-set? is-undirected-link? layout-radial layout-spring layout-tutte link links link-heading link-length link-neighbor? <breed品種>-neighbor? link-neighbors <breed品種>-neighbors links-own <link-breeds品種集合>-own link-with <breed品種>-with my-links my-<breeds品種集合> my-in-links my-in-<breeds品種集合> my-out-links my-out-<breeds品種集合> no-links other-end out-link-neighbor? out-<breed品種>-neighbor? out-link-neighbors out-<breed品種>-neighbors out-link-to out-<breed品種>-to show-link tie untie
movie-cancel movie-close movie-grab-view movie-grab-interface movie-set-frame-rate movie-start movie-status
behaviorspace-experiment-name behaviorspace-run-number
netlogo-applet? netlogo-version netlogo-web?
breed color heading hidden? label label-color pen-mode pen-size shape size who xcor ycor
pcolor plabel plabel-color pxcor pycor
breed color end1 end2 hidden? label label-color shape thickness tie-mode
breed directed-link-breed end extensions globals __includes links-own patches-own to to-report turtles-own undirected-link-breed
e = 2.718281828459045
pi = 3.141592653589793
black = 0
gray = 5
white = 9.9
red = 15
orange = 25
brown = 35
yellow = 45
green = 55
lime = 65
turquoise = 75
cyan = 85
sky = 95
blue = 105
violet = 115
magenta = 125
pink = 135
See the Colors section of the Programming Guide for more details.
詳細はプログラミングガイドの「色」節をご覧ください。
Reports the absolute value of number.
数値の絶対値を返します。
show abs -7 => 7 show abs 5 => 5
Reports the arc cosine (inverse cosine) of the given number. The input must be in the range -1 to 1. The result is in degrees, and lies in the range 0 to 180.
指定の数値のアークコサイン(逆余弦)を返します。入力値は-1から1までの範囲でなければなりません。出力値は0から180までの範囲の角度となります。
Reports true if all of the agents in the agentset report true for the given reporter. Otherwise reports false as soon as a counterexample is found.
指定のレポーターに対してエージェント集合のすべてのエージェントがtrueを返すのであればtrueを返します。そうでなければ反証が見つかりしだいfalseを返します。
If the agentset is empty, reports true.
エージェント集合が空であればtrueを返します。
The reporter must report a boolean value for every agent (either true or false), otherwise an error occurs.
レポーターはすべてのエージェントに関してtrueかfalseのいずれかを返すものでなければなりません。そうでないならエラーが発生します。
if all? turtles [color = red] [ show "every turtle is red!" ]
See also: any? もご覧ください。
Reports true if both condition1 and condition2 are true.
条件1と条件2の両方がtrueであればtrueを返します。
Note that if condition1 is false, then condition2 will not be run (since it can't affect the result).
条件1がfalseであれば条件2はテストされません(結果には影響しないためです)。
if (pxcor > 0) and (pycor > 0) [ set pcolor blue ] ;; the upper-right quadrant of ;; patches turn blue右上の象限のパッチが青く変わる
Reports true if the given agentset is non-empty, false otherwise.
エージェント集合が空でなければtrueを返し、空ならばfalseを返します。
Equivalent to "count agentset > 0", but more efficient (and arguably more readable).
"count エージェント集合 > 0"と同等ですが、より効率的(かつ見やすい)です。
if any? turtles with [color = red] [ show "at least one turtle is red!" ]
Note: nobody is not an agentset. You only get nobody back in situations where you were expecting a single agent, not a whole agentset. If any? gets nobody as input, an error results.
注意:nobodyはエージェント集合ではありません。レポーターの戻り値がエージェント集合ではなくエージェント単体である場合、エージェントが見つからないときの戻り値は、空のエージェント集合ではなくnobodyとなります。any?の入力値がnobodyであるとき、結果はエラーとなります。
See also: all?, nobody もご覧ください。
Reports a number in the range 0 to 140, not including 140 itself, that represents the given color, specified in the HSB spectrum, in NetLogo's color space.
HSB色空間で表現された指定の色を、NetLogo色空間の数値に変換して返します。数値の範囲は0以上140未満です。
The first value (hue) should be in the range of 0 to 360, the second and third (saturation and brightness) in the range between 0 and 100.
最初の値(色相)の範囲は0から360、2番目と3番目の値(彩度と明度)の範囲は0から100となります。
The color reported may be only an approximation, since the NetLogo color space does not include all possible colors.
NetLogo色空間はすべての色を表現することはできないため、返される色は近似値となります。
show approximate-hsb 0 0 0 => 0 ;; (black)黒 show approximate-hsb 180 57.143 76.863 => 85 ;; (cyan)シアン
See also: extract-hsb, approximate-rgb, extract-rgb もご覧ください。
Reports a number in the range 0 to 140, not including 140 itself, that represents the given color, specified in the RGB spectrum, in NetLogo's color space.
RGB色空間で表現された指定の色を、NetLogo色空間の数値に変換して返します。数値の範囲は0以上140未満です。
All three inputs should be in the range 0 to 255.
RGB色空間の3つの数値は0から255の範囲で指定します。
The color reported may be only an approximation, since the NetLogo color space does not include all possible colors. (See approximate-hsb for a description of what parts of the HSB color space NetLogo colors cover; this is difficult to characterize in RGB terms.)
NetLogo色空間はすべての色を表現することはできないので、返される色は近似値となります。(HSB色空間の中でNetLogo色空間がカバーできる部分についてapproximate-hsbで説明していますが、これをRGB色空間で表現するのは困難です。)
show approximate-rgb 0 0 0 => 0 ;; black黒 show approximate-rgb 0 255 255 => 85.2 ;; cyanシアン
See also: extract-rgb, approximate-hsb, extract-hsb もご覧ください。
All of these operators take two inputs, and all act as "infix operators" (going between the two inputs, as in standard mathematical use). NetLogo correctly supports order of operations for infix operators.
これらすべての演算子は2つの入力値を取り、"中置演算子"(通常の数学での用法のように、2つの入力値の中間に置かれる)として作用します。NetLogoは中置演算子の適用順序を正しくサポートしています。
The operators work as follows: + is addition, * is multiplication, - is subtraction, / is division, ^ is exponentiation, < is less than, > is greater than, = is equal to, != is not equal to, <= is less than or equal, >= is greater than or equal.
演算子は次のように動作します: + 加算、 * 乗算、 - 減算、 / 除算、 ^ べき乗、 < 小なり、 > 大なり、 = 等しい、 != 等しくない、 <= 以下、 >= 以上。
Note that the subtraction operator (-) always takes two inputs unless you put parentheses around it, in which case it can take one input. For example, to take the negative of x, write (- x), with the parentheses.
減算演算子(-)はかっこで囲わなければ2つ、かっこで囲えば1つの入力値を取ります。たとえば、xの負数を得るためには、かっこで囲って(- x)と書きます。
All of the comparison operators also work on strings.
すべての比較演算子は文字列に対しても動作します。
All of the comparison operators work on agents. Turtles are compared by who number. Patches are compared top to bottom left to right, so patch 0 10 is less than patch 0 9 and patch 9 0 is less than patch 10 0. Links are ordered by end points and in case of a tie by breed. So link 0 9 is before link 1 10 as the end1 is smaller, and link 0 8 is less than link 0 9. If there are multiple breeds of links unbreeded links will come before breeded links of the same end points and breeded links will be sorted in the order they are declared in the Code tab.
すべての比較演算子はエージェントに対しても動作します。タートルはwho番号で比較されます。パッチは上から下、左から右の順序で比較されます。つまりパッチ 0 10 はパッチ 0 9 よりも小さく、パッチ 9 0 はパッチ 10 0 よりも小さいと判定されます。リンクは端点で比較され、タイの場合は品種で比較されます。リンク0 9はリンク1 10よりも端点が小さいので小さいと判定され、同様にリンク0 8はリンク0 9よりも小さいと判定されます。リンクに複数の品種がある場合は、品種指定のないリンクは品種指定のあるリンクよりも小さいと判定され、品種指定のあるリンク間ではコードタブで宣言された順序で比較されます。
Agentsets can be tested for equality or inequality. Two agentsets are equal if they are the same type (turtle or patch) and contain the same agents.
エージェント集合は等しいか等しくないかを比較できます。2つのエージェント集合は種類(タートルかパッチか)が同じで同じエージェントを含んでいるなら等しいと判定されます。
If you are not sure how NetLogo will interpret your code, you should add parentheses.
NetLogoがコードをどう解釈するかよくわからないときは、かっこを書き加えると良いでしょう。
show 5 * 6 + 6 / 3 => 32 show 5 * (6 + 6) / 3 => 20
Reports the arc sine (inverse sine) of the given number. The input must be in the range -1 to 1. The result is in degrees, and lies in the range -90 to 90.
指定の数値のアークサイン(逆正弦)を返します。入力値は-1から1までの範囲でなければなりません。出力値は-90から90までの範囲の角度となります。
The specified agent or agentset runs the given commands.
エージェントもしくはエージェント集合が指定のコマンドを実行します。
ask turtles [ fd 1 ] ;; all turtles move forward one stepすべてのタートルが1ステップ前へ進む ask patches [ set pcolor red ] ;; all patches turn redすべてのパッチが赤く変わる ask turtle 4 [ rt 90 ] ;; only the turtle with id 4 turns right4番タートルだけが右に向く
Note: only the observer can ask all turtles or all patches. This prevents you from inadvertently having all turtles ask all turtles or all patches ask all patches, which is a common mistake to make if you're not careful about which agents will run the code you are writing.
注意:オブザーバーだけがすべてのタートルとすべてのパッチにaskすることができます。タートルからすべてのタートルにaskしたり、パッチからすべてのパッチにaskしたりすることはできません。これは、どのエージェントがどのコードを実行するのか気を付けていないと起こりやすい間違いです。
Note: Only the agents that are in the agentset at the time the ask begins run the commands.
注意:最初にaskした時点でエージェント集合に属していたエージェントだけがコマンドを実行します。
This primitive exists only for backwards compatibility. We don't recommend using it new models.
このプリミティブは後方互換性の確保のために存在しています。新たなモデルで使用することは推奨しません。
The agents in the given agentset run the given commands, using a turn-taking mechanism to produce simulated concurrency. See the Ask-Concurrent section of the Programming Guide for details on how this works.
指定のエージェント集合に属している各エージェントが、同時実行をシミュレートするためのturn-takingのメカニズムを使って、指定のコマンドを実行します。どのように動作するかについての詳細はプログラミングガイドの「Ask-Concurrent」節をご覧ください。
Note: Only the agents that are in the agentset at the time the ask begins run the commands.
注意:最初にaskした時点でエージェント集合に属していたエージェントだけがコマンドを実行します。
See also: without-interruption もご覧ください。
Reports a subset of the given agentset that includes only the agents on the patches the given distances away from this agent. The distances are specified as a list of two-item lists, where the two items are the x and y offsets.
指定のエージェント集合のうち、実行したエージェントから指定の相対位置にあるパッチ上にいるエージェントのみを含む部分集合を返します。相対位置はx, yオフセットを表す2要素リストのリストによって指定します。
If the caller is the observer, then the points are measured relative to the origin, in other words, the points are taken as absolute patch coordinates.
実行したエージェントがオブザーバーであるときは、各点は原点からの相対位置、すなわちパッチの絶対座標となります。
If the caller is a turtle, the points are measured relative to the turtle's exact location, and not from the center of the patch under the turtle.
実行したエージェントがタートルであるときは、各点はタートルの正確な位置からの相対位置となります。タートルがいるパッチの中心点からの相対位置ではありません。
ask turtles at-points [[2 4] [1 2] [10 15]] [ fd 1 ] ;; only the turtles on the patches at the ;; distances (2,4), (1,2) and (10,15), ;; relative to the caller, move実行したエージェントから相対位置で ;; (2,4), (1,2), (10,15) のパッチにいるタートルだけが移動する
Converts x and y offsets to a turtle heading in degrees (from 0 to 360).
x方向とy方向のオフセットをタートルの向きの角度表示(0以上360未満)に変換します。
Note that this version of atan is designed to conform to the geometry of the NetLogo world, where a heading of 0 is straight up, 90 is to the right, and so on clockwise around the circle. (Normally in geometry an angle of 0 is right, 90 is up, and so on, counterclockwise around the circle, and atan would be defined accordingly.)
現在のバージョンのatanはNetLogoワールドでの幾何学に合わせた形で設計されています。NetLogoワールドでは0は上、90は右というように時計回りで定義されています。(通常の幾何学では0度は右、90度は上というように左回りであり、atanもそれに合わせて定義されています。)
When y is 0: if x is positive, it reports 90; if x is negative, it reports 270; if x is zero, you get an error.
yが0のとき、xが正であれば90を返し、xが負であれば270を返します。xも0であればエラーとなります。
show atan 1 -1 => 135 show atan -1 1 => 315 crt 1 [ set heading 30 fd 1 print atan xcor ycor ] => 30
In the final example, note that the result of atan equals the turtle's heading.
最後の例では、atanの結果はタートルの向きと等しくなります。
If you ever need to convert a turtle heading (obtained with atan or otherwise) to a normal mathematical angle, the following should be helpful:
もしタートルの向き(atanや他の方法で得られたもの)を通常の数学での角度に変換する必要があるのであれば、次の例が役立つでしょう。
to-report heading-to-angle [ h ] report (90 - h) mod 360 end
Reports true if auto-plotting is on for the current plot, false otherwise.
カレントプロットでオートプロットがオンであればtrueを、そうでなければfalseを返します。
This pair of commands is used to control the NetLogo feature of auto-plotting in the current plot. Auto-plotting will automatically update the x and y axes of the plot whenever the current pen exceeds these boundaries. It is useful when wanting to show all plotted values in the current plot, regardless of the current plot ranges.
このペアのコマンドはカレントプロットでNetLogoの機能であるオートプロットを操作するためのものです。オートプロットはカレントペンが境界を超えてしまったときにプロットのx軸とy軸を自動的に更新する機能です。この機能はカレントプロットの範囲に関係なく全体を表示させたい場合に便利です。
The turtle moves backward by number steps. (If number is negative, the turtle moves forward.)
タートルが数値ステップだけ後方に動きます。(数値が負数であるときはタートルは前方に動きます。)
Turtles using this primitive can move a maximum of one unit per time increment. So bk 0.5 and bk 1 both take one unit of time, but bk 3 takes three.
このプリミティブを使うタートルは時間間隔ごとに最大で1単位だけ移動することができます。ですのでbk 0.5とbk 1はともに1単位の時間を使いますが、bk 3は3単位使います。
If the turtle cannot move backward number steps because it is not permitted by the current topology the turtle will complete as many steps of 1 as it can and stop.
もしタートルがトポロジーの制限のために数値ステップ後方へは移動できない場合は、タートルは1ステップ以上動けるだけ動いてそこで停止します。
See also: forward, jump, can-move? もご覧ください。
Reports a list of the 14 basic NetLogo hues.
14の基本NetLogo色相のリストを返します。
print base-colors => [5 15 25 35 45 55 65 75 85 95 105 115 125 135] ask turtles [ set color one-of base-colors ] ;; each turtle turns a random base color各タートルがランダムな基本色のいずれかに変わる ask turtles [ set color one-of remove gray base-colors ] ;; each turtle turns a random base color except for gray各タートルが灰色を除くランダムな基本色のいずれかに変わる
Emits a beep. Note that the beep sounds immediately, so several beep commands in close succession may produce only one audible sound.
ビープ音を発します。ビープ音はすぐに発せられるため、ごく短い間隔で複数のビープ音を発しても、耳に聞こえる音としては一つの音にしか聞こえないかもしれません。
Example:
beep ;; emits one beep repeat 3 [ beep ] ;; emits 3 beeps at once, ;; so you only hear one sound repeat 3 [ beep wait 0.1 ] ;; produces 3 beeps in succession, ;; separated by 1/10th of a second
beep ;; ビープ音を1回発する repeat 3 [ beep ] ;; 3回のビープ音を一度に発する。1回にしか聞こえないかもしれない repeat 3 [ beep wait 0.1 ] ;; 1/10秒の間隔を置いて、3回のビープ音を続けて発する
When running headless, this command has no effect.
モニターなしで実行した場合は、このコマンドでは何も起きません。
Reports the current experiment name in the current experiment.
現在のBehaviorSpace実験の実験名を返します。
If no BehaviorSpace experiment is running, reports "".
BehaviorSpace実験が実行されていないならば""を返します。
Reports the current run number in the current BehaviorSpace experiment, starting at 1.
1から始まる、現在のBehaviorSpace実験の実行番号を返します。
If no BehaviorSpace experiment is running, reports 0.
BehaviorSpace実験が実行されていないならば0を返します。
Reports the agentset of the 2 nodes connected by this link.
実行したリンクが結んでいる2つのタートルからなるエージェント集合を返します。
crt 2 ask turtle 0 [ create-link-with turtle 1 ] ask link 0 1 [ ask both-ends [ set color red ] ;; turtles 0 and 1 both turn redタートル0とタートル1の両方が赤に変わる ]
This is a built-in turtle and link variable. It holds the agentset of all turtles or links of the same breed as this turtle or link. (For turtles or links that do not have any particular breed, this is the turtles agentset of all turtles or the links agentset of all links respectively.)
組み込みのタートル変数とリンク変数です。実行したタートルもしくはリンクと同じ品種のすべてのタートルもしくはリンクからなるエージェント集合を保有します。(タートルもしくはリンクの品種を特定しないエージェント集合にあたるものは、すべてのタートルを含むものはturtles、すべてのリンクを含むものはlinksです。)
You can set this variable to change a turtle or link's breed. (When a turtle changes breeds, its shape is reset to the default shape for that breed. See set-default-shape.)
この変数を設定することでタートルもしくはリンクの品種を変更することができます。(タートルが品種を変更する場合は、形状はその品種のデフォルトの形状に再設定されます。set-default-shapeもご覧ください。)
See also: breed, directed-link-breed, undirected-link-breed もご覧ください。
Example:
例:
breed [cats cat] breed [dogs dog] ;; turtle code:以下はタートルコード if breed = cats [ show "meow!" ] set breed dogs show "woof!"
directed-link-breed [ roads road ] ;; link code以下はリンクコード if breed = roads [ set color gray ]
This keyword, like the globals, turtles-own, and patches-own keywords, can only be used at the beginning of the Code tab, before any procedure definitions. It defines a breed. The first input defines the name of the agentset associated with the breed. The second input defines the name of a single member of the breed.
globals, breed, directed-link-breed, undirected-link-breed, patches-own, turtles-own, links-own, <品種集合>-ownの各予約語は、プロシージャ定義よりも前のコードタブの先頭においてのみ使用することができます。breedは品種を定義します。第1入力値は品種に関連するエージェント集合の名称を定義します。第2入力値は品種の単一メンバーの名称を定義します。
Any turtle of the given breed:
指定の品種のすべてのタートルは:
Most often, the agentset is used in conjunction with ask to give commands to only the turtles of a particular breed.
多くの場合、特定の品種のタートルにのみコマンドを実行させるために、askと合わせて用いられます。
breed [mice mouse] breed [frogs frog] to setup clear-all create-mice 50 ask mice [ set color white ] create-frogs 50 ask frogs [ set color green ] show [breed] of one-of mice ;; prints miceを表示 show [breed] of one-of frogs ;; prints frogsを表示 end show mouse 1 ;; prints (mouse 1)を表示 show frog 51 ;; prints (frog 51)を表示 show turtle 51 ;; prints (frog 51)を表示
See also: globals, patches-own, turtles-own, <breeds>-own, create-<breeds>, <breeds>-at, <breeds>-here もご覧ください。
When used on a list, but-first reports all of the list items of list except the first, and but-last reports all of the list items of list except the last.
リストの場合、but-firstはリストの最初の要素を除いた残りの要素を、but-lastはリストの最後の要素を除いた残りの要素を返します。
On strings, but-first and but-last report a shorter string omitting the first or last character of the original string.
文字列の場合、but-firstとbut-lastは元の文字列の最初または最後の文字を除いたより短い文字列を返します。
;; mylist is は[2 4 6 5 8 12] set mylist but-first mylist ;; mylist is now は現在[4 6 5 8 12] set mylist but-last mylist ;; mylist is now は現在[4 6 5 8] show but-first "string" ;; prints "tring"と表示 show but-last "string" ;; prints "strin"と表示
Reports true if this turtle can move distance in the direction it is facing without violating the topology; reports false otherwise.
タートルが現在面している方向に向かって位相によって遮られずに距離だけ移動できるのであればtrueを、そうでなければfalseを返します。
It is equivalent to:
以下と同等です:
patch-ahead distance != nobody
Runs commands1. If a runtime error occurs inside commands1, NetLogo won't stop and alert the user that an error occurred. It will suppress the error and run commands2 instead.
コマンド1を実行します。コマンド1の内部でランタイムエラーが発生したら、NetLogoは停止せずにエラーが発生したことをユーザーに警告します。そしてエラーを表示させずに代わりにコマンド2を実行します。
The error-message reporter can be used in commands2 to find out what error was suppressed in commands1. See error-message.
コマンド2では、コマンド1でどのようなエラーが発生したかを知るためのエラーメッセージレポーターを用いることができます。error-messageをご覧ください。
carefully [ print one-of [1 2 3] ] [ print error-message ] => 3 observer> carefully [ print one-of [] ] [ print error-message ] => ONE-OF got an empty list as input.
Reports the smallest integer greater than or equal to number.
数値と等しいかより大きい最小の整数を返します。
show ceiling 4.5 => 5 show ceiling -4.5 => -4
See also: floor, round, precision もご覧ください。
Combines the effects of clear-globals, clear-ticks, clear-turtles, clear-patches, clear-drawing, clear-all-plots, and clear-output.
clear-globals, clear-ticks, clear-turtles, clear-patches, clear-drawing, clear-all-plots, clear-outputを合わせた効果となります。
Clears every plot in the model. See clear-plot for more information.
モデルのすべてのプロットをクリアします。詳細はclear-plotをご覧ください。
Clears all lines and stamps drawn by turtles.
タートルが描いたすべての線とスタンプをクリアします。
Sets all global variables to 0.
すべてのグローバル変数を0に設定します。
Kills all links.
すべてのリンクを消去します。
See also: die もご覧ください。
Clears all text from the model's output area, if it has one. Otherwise does nothing.
モデルの出力エリアの中にテキストがあれば、すべてのテキストを消去します。そうでなければ何もしません。
Clears the patches by resetting all patch variables to their default initial values, including setting their color to black.
すべてのパッチ変数をデフォルトの初期値に再設定します。これには色を黒に設定することを含みます。
In the current plot only, resets all plot pens, deletes all temporary plot pens, resets the plot to its default values (for x range, y range, etc.), and resets all permanent plot pens to their default values. The default values for the plot and for the permanent plot pens are set in the plot Edit dialog, which is displayed when you edit the plot. If there are no plot pens after deleting all temporary pens, that is to say if there are no permanent plot pens, a default plot pen will be created with the following initial settings:
カレントプロットにおいてのみ、すべてのプロットペンを再設定し、すべての一時プロットペンを削除し、すべてのプロットをデフォルト値に戻し(x軸の範囲やy軸の範囲など)、すべての恒久プロットペンをデフォルト値に戻します。プロットと恒久プロットペンのデフォルト値はプロット編集ダイアログで設定され、プロットを編集したときに表示されます。すべての一時プロットペンを削除するとプロットペンが残らない場合、すなわち恒久プロットペンがない場合は、以下の初期設定のもとでデフォルトのプロットペンが作成されます:
See also: clear-all-plots もご覧ください。
Clears the tick counter.
ティックカウンターをクリアします。
Does not set the counter to zero. After this command runs, the tick counter has no value. Attempting to access or update it is an error until reset-ticks is called.
カウンターをゼロにするわけではありません。このコマンドを実行するとティックカウンターは何も値を持たない状態になります。reset-ticksが実行されるまでは、ティックカウンターにアクセスしたり更新したりしようとするとエラーになります。
See also: reset-ticks もご覧ください。
Kills all turtles.
すべてのタートルを消去します。
Also resets the who numbering, so the next turtle created will be turtle 0.
who番号もリセットします。そのため次に作成されるタートルは0番となります。
See also: die もご覧ください。
This is a built-in turtle or link variable. It holds the color of the turtle or link. You can set this variable to make the turtle or link change color. Color can be represented either as a NetLogo color (a single number), or an RGB color (a list of 3 numbers). See details in the Colors section of the Programming Guide.
組み込みのタートル変数とリンク変数です。タートルかリンクの色を保有します。この値を設定すればタートルかリンクの色を変えられます。色はNetLogo色空間(数値1個)かRGB色空間(数値3個)で表すことができます。詳細はプログラミングガイドの「色」節をご覧ください。
See also: pcolor もご覧ください。
Reports the cosine of the given angle. Assumes the angle is given in degrees.
指定の角度の余弦を返します。
show cos 180 => -1
Reports the number of agents in the given agentset.
指定のエージェント集合のエージェント数を返します。
show count turtles ;; prints the total number of turtlesタートル数を表示 show count patches with [pcolor = red] ;; prints the total number of red patches赤いパッチの数を表示
Creates number new turtles. New turtles start at position (0, 0), are created with the 14 primary colors, and have headings from 0 to 360, evenly spaced.
数値個の新しいタートルを作成します。新しいタートルは座標(0, 0)に置かれます。色は14の主要色のどれかとなり、向きは0度から360度までの間で等間隔に設定されます。
If the create-ordered-<breeds> form is used, the new turtles are created as members of the given breed.
create-ordered-<品種集合> を実行する場合は、新しいタートルは指定の品種となります。
If commands are supplied, the new turtles immediately run them. This is useful for giving the new turtles a different color, heading, or whatever. (The new turtles are created all at once then run one at a time, in random order.)
コマンドを記載した場合は、新しいタートルは直ちにそれらを実行します。この機能は新しいタートルに任意の色や向きなどを設定したい場合に有用です。(新しいタートルは一度にすべて作成され、ランダムな順序でコマンドを実行します。)
cro 100 [ fd 10 ] ;; makes an evenly spaced circle等間隔で間の開いた円を作成
Used for creating breeded and unbreeded links between turtles.
タートル間のリンクを作成するために使われます。
create-link-with creates an undirected link between the caller and agent. create-link-to creates a directed link from the caller to agent. create-link-from creates a directed link from agent to the caller.
create-link-withは実行した側とタートルとの間の無向リンクを作成します。create-link-toは実行した側からタートルへの有向リンクを作成します。create-link-fromはタートルから実行した側への有向リンクを作成します。
When the plural form of the breed name is used, an agentset is expected instead of an agent and links are created between the caller and all agents in the agentset.
リンク先としてタートルではなくタートル品種集合が指定された場合は、実行した側とタートル品種集合のすべてのタートルとの間にリンクが作成されます。
The optional command block is the set of commands each newly formed link runs. (The links are created all at once then run one at a time, in random order.)
オプションのコマンドブロックには新しく作成されたリンクに実行させるコマンドを記載します。(リンクは一度にすべてが作成され、次にランダムな順序で1個ずつコマンドを実行します。)
A node cannot be linked to itself. Also, you cannot have more than one undirected link of the same breed between the same two nodes, nor can you have more than one directed link of the same breed going in the same direction between two nodes.
タートルは自分自身とリンクすることはできません。また、2つのタートル間に同じ品種の無向リンクを2個以上持つことも、2つのタートル間の同じ方向に同じ品種の有向リンクを2個以上持つこともできません。
If you try to create a link where one (of the same breed) already exists, nothing happens. If you try to create a link from a turtle to itself you get a runtime error.
すでに同じ品種で同じ向きのリンクが存在しているところにリンクを作ろうとしても何も起きません。タートルからタートル自身へリンクを作ろうとするとランタイムエラーとなります。
to setup clear-all create-turtles 5 ;; turtle 1 creates links with all other turtles ;; the link between the turtle and itself is ignored ;; タートル0は他のタートルとのリンクを作成 タートル自身とのリンクは無視される ask turtle 0 [ create-links-with other turtles ] show count links ;; shows 4 ;; this does nothing since the link already exists4を表示 ;; 以下はリンクがすでに存在しているので何もしない ask turtle 0 [ create-link-with turtle 1 ] show count links ;; shows 4 since the previous link already existedすでにリンクが存在しているので4を表示 ask turtle 2 [ create-link-with turtle 1 ] show count links ;; shows 55を表示 end
directed-link-breed [red-links red-link] undirected-link-breed [blue-links blue-link] to setup clear-all create-turtles 5 ;; create links in both directions between turtle 0 ;; and all other turtles ;; タートル0と他のタートルとの間で両方の方向の有向リンクを作成 ask turtle 0 [ create-red-links-to other turtles ] ask turtle 0 [ create-red-links-from other turtles ] show count links ;; shows 88を表示 ;; now create undirected links between turtle 0 and other turtles追加でタートル0と他のタートルとの間に無向リンクを作成 ask turtle 0 [ create-blue-links-with other turtles ] show count links ;; shows 1212を表示 end
Creates number new turtles at the origin. New turtles have random integer headings and the color is randomly selected from the 14 primary colors.
数値個の新しいタートルを原点に作成します。新しいタートルはランダムな整数の向きとなり、14の主要色からランダムに選んだ色となります。
If the create-<breeds> form is used, the new turtles are created as members of the given breed.
create-<品種集合>を実行する場合は、新しいタートルは指定の品種となります。
If commands are supplied, the new turtles immediately run them. This is useful for giving the new turtles a different color, heading, or whatever. (The new turtles are created all at once then run one at a time, in random order.)
コマンドを記載した場合は、新しいタートルは直ちにそれらを実行します。この機能は新しいタートルに任意の色や向きなどを設定したい場合に有用です。(新しいタートルは一度にすべて作成され、ランダムな順序でコマンドを実行します。)
crt 100 [ fd 10 ] ;; makes a randomly spaced circleランダムに間が開いた円を作成
breed [canaries canary] breed [snakes snake] to setup clear-all create-canaries 50 [ set color yellow ] create-snakes 50 [ set color green ] end
See also: hatch, sprout もご覧ください。
A new temporary plot pen with the given name is created in the current plot and set to be the current pen.
カレントプロットに新しい一時プロットペンを指定の名前で作成し、カレントペンとして設定します。
Few models will want to use this primitive, because all temporary pens disappear when clear-plot or clear-all-plots are called. The normal way to make a pen is to make a permanent pen in the plot's Edit dialog.
clear-plot や clear-all-plots が呼び出されるとすべての一時ペンがなくなってしまいますので、このプリミティブが必要になるモデルもあるでしょう。ペンを作成する通常の方法は、プロットのEditダイアログで恒久ペンを作成する方法です。
If a pen with that name already exists in the current plot, no new pen is created, and the existing pen is set to the current pen.
カレントプロットに指定の名前のペンが既に存在している場合は、新しいペンは作成されず、既存のペンがカレントペンとして指定されます。
The new temporary plot pen has the following initial settings:
新しい一時プロットペンは以下の初期設定となります:
See also: clear-plot, clear-all-plots, set-current-plot-pen もご覧ください。
Reports a string containing the current date and time. The format is shown below. All fields are fixed width, so they are always at the same locations in the string. The potential resolution of the clock is milliseconds. (Whether you get resolution that high in practice may vary from system to system, depending on the capabilities of the underlying Java Virtual Machine.)
現時点での日付と時刻を含む文字列を返します。書式は下記の通りです。すべてのフィールドは固定長ですので文字列の中で常に同じ位置にあります。時計の最大の分解能はミリ秒です。(これほどの高い分解能が得られるかどうかは、依存するJava仮想マシンの性能によりますので、システムによって異なります。)
show date-and-time => "01:19:36.685 PM 19-Sep-2002"
The turtle or link dies.
タートルもしくはリンクが死にます。
if xcor > 20 [ die ] ;; all turtles with xcor greater than 20 diex座標が20より大きいすべてのタートルが死ぬ ask links with [color = blue] [ die ] ;; all the blue links will dieすべての青いリンクが死ぬ
A dead agent ceases to exist. The effects of this include:
死んだエージェントは存在しなくなります。このとき次の影響が生じます:
ask turtles [ die print "last words?" ]
, no last words will be printed, because the turtles are already dead before they have a chance to print anything.ask turtles [ die print "last words?" ]
と記載しても、文字列を表示する前にタートルが死んでいるので、何も表示されません。nobody
in it. So for example let x one-of turtles ask x [ die ] print x
prints nobody
.nobody
に入れ替わります。たとえばlet x one-of turtles ask x [ die ] print x
とすればnobody
を表示します。reset-perspective
had been run.reset-perspective
を実行した場合と同様に、オブザーバー視点はリセットされます。See also: clear-turtles clear-links もご覧ください。
Tells each patch to give equal shares of (number * 100) percent of the value of patch-variable to its eight neighboring patches. number should be between 0 and 1. Regardless of topology the sum of patch-variable will be conserved across the world. (If a patch has fewer than eight neighbors, each neighbor still gets an eighth share; the patch keeps any leftover shares.)
各パッチに対して、パッチ変数の値の(数値×100)パーセントを8等分して隣接する8つのパッチへ渡すよう指示します。数値は0から1の間の値でなければなりません。ワールドの位相に関わりなく、パッチ変数の合計は一定となります。(隣接するパッチが8個以下である場合は、隣接するパッチが受け取る量は8分の1で、余った分は元のパッチが保持します。)
Note that this is an observer command only, even though you might expect it to be a patch command. (The reason is that it acts on all the patches at once -- patch commands act on individual patches.)
このコマンドはパッチコマンドように見えるかもしれませんが、オブザーバーコマンドです。(なぜならばこのコマンドは一度にすべてのパッチに対して作用するからです。パッチコマンドは個々のパッチに対して作用します。)
diffuse chemical 0.5 ;; each patch diffuses 50% of its variable ;; chemical to its neighboring 8 patches. Thus, ;; each patch gets 1/8 of 50% of the chemical ;; from each neighboring patch.) ;; 各パッチはchemicalという変数の50%を隣接する8個のパッチへ渡す ;; ゆえに各パッチはchemicalという変数の50%の8分の1を ;; 隣接する8個のパッチから受け取る
Like diffuse, but only diffuses to the four neighboring patches (to the north, south, east, and west), not to the diagonal neighbors.
diffuseと似ていますが、4つの隣接するパッチ(北、南、東、西)にのみ渡し、斜めに隣接するパッチには渡しません。
diffuse4 chemical 0.5 ;; each patch diffuses 50% of its variable ;; chemical to its neighboring 4 patches. Thus, ;; each patch gets 1/4 of 50% of the chemical ;; from each neighboring patch.) ;; 各パッチはchemicalという変数の50%を隣接する4個のパッチへ渡す ;; ゆえに各パッチはchemicalという変数の50%の4分の1を ;; 隣接する4個のパッチから受け取る
This keyword, like the globals and breeds keywords, can only be used at the beginning of the Code tab, before any procedure definitions. It defines a directed link breed. Links of a particular breed are always all directed or all undirected. The first input defines the name of the agentset associated with the link breed. The second input defines the name of a single member of the breed. Directed links can be created using create-link(s)-to, and create-link(s)-from, but not create-link(s)-with
globals, breed, directed-link-breed, undirected-link-breed, patches-own, turtles-own, links-own, <品種集合>-ownの各予約語は、プロシージャ定義よりも前のコードタブの先頭においてのみ使用することができます。directed-link-breedは有向リンク品種を定義します。ある品種のリンクはすべて有向かすべて無向かのいずれかになります。第1入力値はリンク品種に関連するエージェント集合の名称を定義します。第2入力値は品種の単一のメンバーの名称を定義します。有向リンクはcreate-link(s)-toかcreate-link(s)-fromで作成することができますが、create-link(s)-withでは作成されません。
Any link of the given link breed:
指定のリンク品種のリンクは:
Most often, the agentset is used in conjunction with ask to give commands to only the links of a particular breed.
多くの場合、このエージェント集合は特定の品種のリンクに対してのみコマンドを実行させるために、askと組み合わせて用いられます。
directed-link-breed [streets street] directed-link-breed [highways highway] to setup clear-all crt 2 ;; create a link from turtle 0 to turtle 1タートル0からタートル1へのリンクを作成 ask turtle 0 [ create-street-to turtle 1 ] ;; create a link from turtle 1 to turtle 0タートル1からタートル0へのリンクを作成 ask turtle 0 [ create-highway-from turtle 1 ] end ask turtle 0 [ show one-of my-in-links ] ;; prints (street 0 1) を表示 ask turtle 0 [ show one-of my-out-links ] ;; prints (highway 1 0) を表示
See also: breed, undirected-link-breed もご覧ください。
Causes the view to be updated immediately. (Exception: if the user is using the speed slider to fast-forward the model, then the update may be skipped.)
ビューを即座に更新します。(例外:ユーザーがスピードスライダーを最速に設定しているときは、更新はスキップされます。)
Also undoes the effect of the no-display command, so that if view updates were suspended by that command, they will resume.
また、no-displayコマンドの効果を取り消しますので、そのコマンドによってビューの更新が停止していたならば、更新を再開します。
no-display ask turtles [ jump 10 set color blue set size 5 ] display ;; turtles move, change color, and grow, with none of ;; their intermediate states visible to the user, only ;; their final state ;; タートルは移動し、色を変更し、成長するが、 ;; 中間の状態はユーザーには見せずに、最後の状態だけを見せる
Even if no-display was not used, "display" can still be useful, because ordinarily NetLogo is free to skip some view updates, so that fewer total updates take place, so that models run faster. This command lets you force a view update, so whatever changes have taken place in the world are visible to the user.
no-displayが使われていなかったとしても、"display"を使う効果はあります。なぜなら通常のNetLogoでは、モデルを速く走らせるために、ビューの更新の一部をスキップして少ない数の更新しか行わないからです。このコマンドは強制的にビューを更新させますので、ワールドでどのような変更があったとしてもユーザーに見えるようになります。
ask turtles [ set color red ] display ask turtles [ set color blue] ;; turtles turn red, then blue; use of "display" forces ;; red turtles to appear briefly ;; タートルが赤に変わり、次に青に変わる ;; "display"を使うことで赤いタートルがわずかの間見える
Note that display and no-display operate independently of the switch in the view control strip that freezes the view.
displayとno-displayは、ビューを固定するビューコントロールバーのスイッチとは独立して動作します。
See also: no-display もご覧ください。
Reports the distance from this agent to the given turtle or patch.
実行したエージェントから指定したタートルもしくはパッチまでの距離を返します。
The distance to or from a patch is measured from the center of the patch. Turtles and patches use the wrapped distance (around the edges of the world) if wrapping is allowed by the topology and the wrapped distance is shorter.
パッチまでの距離はパッチの中心点から測ります。ワールドの位相に循環が適用されていて、循環した場合の距離(反対側の辺とつながっている辺を経由した距離)の方が近いのであれば、その距離を返します。
ask turtles [ show max-one-of turtles [distance myself] ] ;; each turtle prints the turtle farthest from itself各タートルが自分自身から最も遠いタートルを表示する
Reports the distance from this agent to the point (xcor, ycor).
実行したエージェントから点 (x座標, y座標) までの距離を返します。
The distance from a patch is measured from the center of the patch. Turtles and patches use the wrapped distance (around the edges of the world) if wrapping is allowed by the topology and the wrapped distance is shorter.
パッチからの距離はパッチの中心点から測ります。もしワールドの位相に循環が適用されていて、循環した場合の距離(反対側の辺とつながっている辺を経由した距離)の方が近いのであれば、その距離を返します。
if (distancexy 0 0) > 10 [ set color green ] ;; all turtles more than 10 units from ;; the center of the world turn green. ;; ワールドの中心点から10単位以上離れているすべてのタートルが緑に変わる
Moves the turtle to the neighboring patch with the lowest value for patch-variable. If no neighboring patch has a smaller value than the current patch, the turtle stays put. If there are multiple patches with the same lowest value, the turtle picks one randomly. Non-numeric values are ignored.
隣接するパッチのうちパッチ変数の値が最も小さいパッチへタートルが移動します。現在いるパッチよりも値が小さい隣接パッチが存在しない場合はタートルはその場にとどまります。複数のパッチが同じ最小値であるときは、タートルはその中から1個をランダムに選びます。数値でない値は無視されます。
downhill considers the eight neighboring patches; downhill4 only considers the four neighbors.
downhillでは8個の隣接パッチを考慮しますが、downhill4では4個の隣接パッチのみを考慮します。
Equivalent to the following code (assumes variable values are numeric):
以下のコードと同等です(変数値は数値であると仮定します):
move-to patch-here ;; go to patch centerパッチの中心へ移動 let p min-one-of neighbors [patch-variable] ;; or またはneighbors4 if [patch-variable] of p < patch-variable [ face p move-to p ]
Note that the turtle always ends up on a patch center and has a heading that is a multiple of 45 (downhill) or 90 (downhill4).
タートルは常にパッチの中心で動作を終了し、そのときの向きは45の倍数(downhill)もしくは90の倍数(downhill4)になります。
See also: uphill, uphill4 もご覧ください。
Reports the x-increment or y-increment (the amount by which the turtle's xcor or ycor would change) if the turtle were to take one step forward in its current heading.
タートルが現在の向きで1ステップ前進しようとするときのx増分もしくはy増分(タートルのx座標もしくはy座標が変化する程度)を返します。
Note: dx is simply the sine of the turtle's heading, and dy is simply the cosine. (If this is the reverse of what you expected, it's because in NetLogo a heading of 0 is north and 90 is east, which is the reverse of how angles are usually defined in geometry.)
注:dxは単にタートルの向きの正弦、dyは余弦にあたります。(NetLogoでは向き0は北向き、90は東向きになりますので、幾何学での一般的な角度の定義とは逆になります。)
Note: In earlier versions of NetLogo, these primitives were used in many situations where the new patch-ahead primitive is now more appropriate.
注:NetLogoの古いバージョンでは、これらのプリミティブは今ではpatch-aheadプリミティブがより適切な多くの状況で使われていました。
Reports true if the given list or string is empty, false otherwise.
指定のリストまたは文字列が空であればtrueを、そうでなければfalseを返します。
Note: the empty list is written []. The empty string is written "".
注意:空のリストは[]、空の文字列は""と書かれます。
Used to conclude a procedure. See to and to-report.
プロシージャを終わらせるために使われます。toとto-reportをご覧ください。
This is a built-in link variable. It indicates the first endpoint (turtle) of a link. For directed links this will always be the source for undirected links it will always be the turtle with the lower who number. You cannot set end1.
組み込みのリンク変数です。リンクの一番目の端点(タートル)を意味します。これは、有向グラフの場合は始点、無向グラフの場合はwho番号が少ない方のタートルとなります。end1を直接設定することはできません。
crt 2 ask turtle 0 [ create-link-to turtle 1 ] ask links [ show end1 ] ;; shows turtle 0タートル0を表示
This is a built-in link variable. It indicates the second endpoint (turtle) of a link. For directed links this will always be the destination for undirected links it will always be the turtle with the higher who number. You cannot set end2.
組み込みのリンク変数です。リンクの二番目の端点(タートル)を意味します。これは、有向グラフの場合は終点、無向グラフの場合はwho番号が少ない方のタートルとなります。end2を直接設定することはできません。
crt 2 ask turtle 1 [ create-link-with turtle 0 ] ask links [ show end2 ] ;; shows turtle 1タートル1を表示
Causes a runtime error to occur.
ランタイムエラーを発生させます。
The given value is converted to a string (if it isn't one already) and used as the error message.
指定の値は(すでに同じものがなければ)文字列に変換され、エラーメッセージとして用いられます。
See also: error-message, carefully もご覧ください。
Reports a string describing the error that was suppressed by carefully.
carefullyコマンドのために出力されなかったエラーの内容を説明する文字列を返します。
This reporter can only be used in the second block of a carefully command.
このレポーターはcarefullyコマンドの第2ブロックにおいてのみ使用することができます。
See also: error, carefully もご覧ください。
Runs the given commands only if it's been more than number seconds since the last time this agent ran them in this context. Otherwise, the commands are skipped.
エージェントが同じコンテキストで指定のコマンドを最後に実行してから数値秒以上が経過していれば同じコマンドを実行します。そうでなければコマンドはスキップされます。
By itself, every doesn't make commands run over and over again. You need to use every inside a loop, or inside a forever button, if you want the commands run over and over again. every only limits how often the commands run.
every自身はコマンドを反復させるわけではありません。コマンドを反復させたいのであればeveryをループの中やフォーエバーボタンの中で使う必要があります。everyはコマンドが実行される頻度を制限する機能を持つだけです。
Above, "in this context" means during the same ask (or button press or command typed in the Command Center). So it doesn't make sense to write ask turtles [ every 0.5 [ ... ] ], because when the ask finishes the turtles will all discard their timers for the "every". The correct usage is shown below.
上記の"同じコンテキスト"とは、同じask(またはボタン押し、コマンドセンターでのコマンド記入)の中という意味です。したがってask turtles [ every 0.5 [ ... ] ]と書いても意味を持ちません。なぜならaskが終了したときにタートルは"every"を動作させるためのタイマーをリセットしてしまうからです。正しい用法は下記となります。
every 0.5 [ ask turtles [ fd 1 ] ] ;; twice a second the turtles will move forward 1毎秒2回タートルが1前に進む every 2 [ set index index + 1 ] ;; every 2 seconds index is incremented2秒おきにindexが増加する
See also: wait もご覧ください。
Reports the value of e raised to the number power.
e の数値乗の値を返します。
Note: This is the same as e ^ number.
注:これは e ^ 数値 と同じです。
export-view writes the current contents of the current view to an external file given by the string filename. The file is saved in PNG (Portable Network Graphics) format, so it is recommended to supply a filename ending in ".png".
export-viewはカレントビューの現在の内容をファイル名の文字列で指定した外部ファイルに書き込みます。ファイルはPNG (Portable Network Graphics) フォーマットで保存されますので、".png"で終わるファイル名にすることを推奨します。
export-interface is similar, but for the whole interface tab.
export-interfaceは似ていますが、インターフェースタブ全体を出力します。
Note that export-view still works when running NetLogo in headless mode, but export-interface doesn't.
export-viewはNetLogoをディスプレイなしモードで動かしているときも動作しますが、export-interfaceは動作しません。
export-output writes the contents of the model's output area to an external file given by the string filename. (If the model does not have a separate output area, the output portion of the Command Center is used.)
export-outputはファイル名文字列で指定した外部ファイルにモデルの出力領域の内容を書き込みます。(モデルに独立した出力領域がない場合は、コマンドセンターの出力部分が使われます。)
export-plot writes the x and y values of all points plotted by all the plot pens in the plot given by the string plotname to an external file given by the string filename. If a pen is in bar mode (mode 0) and the y value of the point plotted is greater than 0, the upper-left corner point of the bar will be exported. If the y value is less than 0, then the lower-left corner point of the bar will be exported.
export-plotは、プロット名文字列で指定したプロット内のすべてのプロットペンがプロットしたすべての点のxとyの値を、ファイル名文字列で指定した外部ファイルへ書き込みます。ペンが棒グラフモード(mode 0)でプロットされた点のyの値が0より大きいときは、棒グラフの左上の端点をエキスポートします。yの値が0より小さい場合は、棒グラフの左下の端点をエキスポートします。
export-all-plots writes every plot in the current model to an external file given by the string filename. Each plot is identical in format to the output of export-plot.
export-all-plotsはファイル名文字列で指定した外部ファイルへ実行しているモデルの各プロットを書き込みます。各プロットはexport-plotの出力フォーマットの中で区別されます。
export-world writes the values of all variables, both built-in and user-defined, including all observer, turtle, and patch variables, the drawing, the contents of the output area if one exists, the contents of any plots and the state of the random number generator, to an external file given by the string filename. (The result file can be read back into NetLogo with the import-world primitive.) export-world does not save the state of open files.
export-worldは、オブザーバー変数、タートル変数、パッチ変数のすべてを含む、組み込みとユーザー定義の両方の変数値、ドローイング、出力領域が存在しているならばその内容、すべてのプロットの内容、乱数生成器の状態を、ファイル名文字列で指定した外部ファイルへ書き込みます。(出力先のファイルはimport-worldプリミティブでNetLogoに読み込むことができます。)export-worldは開いているファイルの状態は保存しません。
export-plot, export-all-plots and export-world save files in in plain-text, "comma-separated values" (.csv) format. CSV files can be read by most popular spreadsheet and database programs as well as any text editor.
export-plot, export-all-plots, export-worldは、"comma-separated values" (.csv) フォーマットのプレーンテキストで情報を保存します。CSVファイルはテキストエディターの他、各種のスプレッドシートやデータベースプログラムで読むことができます。
If you wish to export to a file in a location other than the model's location, you should include the full path to the file you wish to export. (Use the forward-slash "/" as the folder separator.)
モデルの場所とは異なる場所にあるファイルにエキスポートしたいときは、エキスポートしたい先のファイル名のフルパスを記載します。(フォルダー名の区切りにはフォワードスラッシュ"/"を使います。)
Note that the functionality of these primitives is also available directly from NetLogo's File menu.
これらのプリミティブの機能はNetLogoの [File] メニューでも使うことができます。
export-world "fire.csv" ;; exports the state of the model to the file fire.csv ;; located in the NetLogo folder ;; NetLogoフォルダーのfire.csvファイルにモデルの状態をエキスポート export-plot "Temperature" "c:/My Documents/plot.csv" ;; exports the plot named ;; "Temperature" to the file plot.csv located in ;; the C:\My Documents folder ;; C:\My Documents フォルダーのplot.csvファイルに ;; "Temperature"というプロットをエキスポート export-all-plots "c:/My Documents/plots.csv" ;; exports all plots to the file plots.csv ;; located in the C:\My Documents folder ;; C:\My Documents フォルダーのplot.csvファイルにすべてのプロットをエキスポート
If the file already exists, it is overwritten. To avoid this you may wish to use some method of generating fresh names. Examples:
ファイルが既に存在している場合は上書きされます。これを避けたいときは新しい名前を生成する何らかの方法を用います。例えば:
export-world user-new-file export-world (word "results " date-and-time ".csv") ;; Colon characters in the time cause errors on WindowsWindowsでは時刻のコロン(:)はエラーの原因になります。 export-world (word "results " random-float 1.0 ".csv")
Allows the model to use primitives from the extensions with the given names. See the Extensions guide for more information.
指定の名前を持つ拡張機能のプリミティブをモデルで使えるようにします。詳細は拡張機能ガイドをご覧ください。
Reports a list of three values, the first (hue) in the range of 0 to 360, the second and third (brightness and saturation) in the range of in the range 0 to 100, of the given NetLogo color in the range 0 to 140, not including 140 itself.
0以上140未満の数値である指定のNetLogo色を、色相、彩度、明度を表すそれぞれ0-360、0-100、0-100の3つの数値のリストに変換して返します。
show extract-hsb red => [3.103 80.93 84.314] show extract-hsb cyan => [180 57.143 76.863]
See also: approximate-hsb, approximate-rgb, extract-rgb もご覧ください。
Reports a list of three values in the range 0 to 255 representing the levels of red, green, and blue, respectively, of the given NetLogo color in the range 0 to 140, not including 140 itself.
0以上140未満の数値である指定のNetLogo色を、赤、緑、青を表す0以上255以下の3つの数値のリストに変換して返します。
show extract-rgb red => [215 50 41] show extract-rgb cyan => [84 196 196]
See also: approximate-rgb, approximate-hsb, extract-hsb もご覧ください。
Set the caller's heading towards agent.
実行したエージェントの向きをエージェントに向けます。
If wrapping is allowed by the topology and the wrapped distance (around the edges of the world) is shorter, face will use the wrapped path.
もしワールドの位相に循環が適用されていて、循環した場合の距離(反対側の辺とつながっている辺を経由した距離)の方が近いのであれば、faceは循環する経路を用います。
If the caller and the agent are at the exact same position, the caller's heading won't change.
実行したエージェントとエージェントとが正確に同じ位置にいる場合は、実行したエージェントの向きは変わりません。
Set the caller's heading towards the point (x, y).
実行したタートルの向きを点(x, y)に向けます。
If wrapping is allowed by the topology and the wrapped distance (around the edges of the world) is shorter and wrapping is allowed, facexy will use the wrapped path.
もしワールドの位相に循環が適用されていて、循環した場合の距離(反対側の辺とつながっている辺を経由した距離)の方が点(x, y)への距離が近いのであれば、facexyはその経路を用います。
If the caller is on the point (x, y), the caller's heading won't change.
実行したタートルが点(x, y)にいるのであれば、向きは変わりません。
Reports true when there are no more characters left to read in from the current file (that was opened previously with file-open). Otherwise, reports false.
使用中のファイル(あらかじめfile-openで開かれているファイル)に読むべき文字がこれ以上残っていない場合はtrueを返します。そうでなければfalseを返します。
file-open "my-file.txt" print file-at-end? => false ;; Can still read in more charactersこれ以上文字を読めるか print file-read-line => This is the last line in file print file-at-end? => true ;; We reached the end of the fileファイルの最後に到達した
See also: file-open, file-close-all もご覧ください。
Closes a file that has been opened previously with file-open.
file-openによって既に開かれているファイルがあれば1個だけ閉じます。
Note that this and file-close-all are the only ways to restart to the beginning of an opened file or to switch between file modes.
開かれているファイルの先頭に戻って再実行する方法、あるいはファイルモードを入れ替える方法は、このコマンドとfile-close-allだけです。
If no file is open, does nothing.
ファイルが開かれていなければ、何もしません。
See also: file-close-all, file-open もご覧ください。
Closes all files (if any) that have been opened previously with file-open.
file-openによって既に開かれているファイルがもしあればすべてのファイルを閉じます。
See also: file-close, file-open もご覧ください。
Deletes the file specified as string.
文字列のファイル名のファイルを削除します。
string must be an existing file with writable permission by the user. Also, the file cannot be open. Use the command file-close to close an opened file before deletion.
文字列は存在するファイル名で、ユーザーに書き込み許可が与えられているものでなければなりません。また、ファイルは閉じていなければなりません。削除の前にfile-closeコマンドを使って開いているファイルを閉じてください。
Note that the string can either be a file name or an absolute file path. If it is a file name, it looks in whatever the current directory is. This can be changed using the command set-current-directory. It is defaulted to the model's directory.
文字列はファイル名か絶対ファイルパスのいずれかになりえます。ファイル名のときはカレントディレクトリの中から探します。カレントディレクトリはset-current-directoryコマンドで変更できます。デフォルトではモデルがあるディレクトリになります。
Reports true if string is the name of an existing file on the system. Otherwise it reports false.
文字列がシステム上に存在するファイル名であればtrueを、そうでなければfalseを返します。
Note that the string can either be a file name or an absolute file path. If it is a file name, it looks in whatever the current directory is. This can be changed using the command set-current-directory. It defaults to the model's directory.
文字列はファイル名か絶対ファイルパスのいずれかになりえます。ファイル名のときはカレントディレクトリの中から探します。カレントディレクトリはset-current-directoryコマンドで変更できます。デフォルトではモデルがあるディレクトリになります。
Forces file updates to be written to disk. When you use file-write or other output commands, the values may not be immediately written to disk. This improves the performance of the file output commands. Closing a file ensures that all output is written to disk.
ファイルの更新を強制的にディスクに書き込みます。file-writeや他の出力コマンドを使っても、値は直ちにディスクに書き込まれるわけではありません。これはファイル出力コマンドの効率向上のためです。ファイルを閉じるときにすべての出力はディスクに書き込まれます。
Sometimes you need to ensure that data is written to disk without closing the file. For example, you could be using a file to communicate with another program on your machine and want the other program to be able to see the output immediately.
ファイルを閉じなくてもデータを確実にディスクに書き込む必要がある場合があります。例えば計算機上の他のプログラムとコミュニケートする必要があり、そのプログラムに出力内容を直ちに渡したい場合などです。
This command will interpret string as a path name to a file and open the file. You may then use the reporters file-read, file-read-line, and file-read-characters to read in from the file, or file-write, file-print, file-type, or file-show to write out to the file.
このコマンドは文字列をファイルへのパス名と解釈し、そのファイルを開きます。ファイルを開くと、そのファイルから読み込むためにfile-read, file-read-line, file-read-charactersを使えるようになり、またそのファイルへ書き込むためにfile-write, file-print, file-type, file-showを使えるようになります。
Note that you can only open a file for reading or writing but not both. The next file i/o primitive you use after this command dictates which mode the file is opened in. To switch modes, you need to close the file using file-close.
ファイルは読み込むか書き込むかのどちらかの目的で開くことができますが、両方はできません。このコマンドの直後に用いられるファイル入出力プリミティブによって、どちらのモードでファイルが開かれているかが決定されます。モードを切り替えるには、file-closeを使ってファイルを閉じなければなりません。
Also, the file must already exist if opening a file in reading mode.
また、読み込みモードでファイルを開くには事前にファイルが存在している必要があります。
When opening a file in writing mode, all new data will be appended to the end of the original file. If there is no original file, a new blank file will be created in its place. (You must have write permission in the file's directory.) (If you don't want to append, but want to replace the file's existing contents, use file-delete to delete it first, perhaps inside a carefully if you're not sure whether it already exists.)
書き込みモードでファイルを開くときは、新しいデータは元のファイルの末尾に追記されます。元のファイルがない場合は、その場所に新しい空のファイルが作成されます。(ファイルのディレクトリには書き込み許可を設定する必要があります。)(もし追記ではなく既存のファイルの内容を置き換えたいときは、最初にfile-deleteでファイルを削除してください。ファイルが既存かどうか定かでない場合はcarefullyの内側で使ってください。)
Note that the string can either be a file name or an absolute file path. If it is a file name, it looks in whatever the current directory is. This can be changed using the command set-current-directory. It is defaulted to the model's directory.
文字列はファイル名か絶対ファイルパスのいずれかにすることができます。ファイル名を指定したときはカレントディレクトリの中を検索します。カレントディレクトリはset-current-directoryコマンドで変更できます。デフォルトではモデルのあるディレクトリとなります。
file-open "my-file-in.txt" print file-read-line => First line in file ;; File is in reading modeファイルは読み込みモード file-open "C:\\NetLogo\\my-file-out.txt" ;; assuming Windows machineWindowsマシンを仮定 file-print "Hello World" ;; File is in writing modeファイルは書き込みモード
Opening a file does not close previously opened files. You can use file-open
to switch back and forth between multiple open files.
ファイルを開いてもそれまでに開いていたファイルは閉じられません。file-open
は複数の開いているファイルを切り替えるために使うことができます。
See also: file-close, file-close-all もご覧ください。
Prints value to an opened file, followed by a carriage return.
開いているファイルに、値、改行記号の順で出力します。
This agent is not printed before the value, unlike file-show.
file-showとは異なり、実行したエージェントは値の前には表示されません。
Note that this command is the file i/o equivalent of print, and file-open needs to be called before this command can be used.
このコマンドはprintと同等のファイル入出力です。また、このコマンドを実行する前にfile-openを呼び出す必要があります。
See also: file-show, file-type, file-write もご覧ください。
This reporter will read in the next constant from the opened file and interpret it as if it had been typed in the Command Center. It reports the resulting value. The result may be a number, list, string, boolean, or the special value nobody.
このレポーターは開いているファイルの次の定数を読み込んでコマンドセンターに入力されたものと同様に解釈します。このレポーターはその結果を返します。結果は数値、リスト、文字列、論理定数、nobodyとなりえます。
Whitespace separates the constants. Each call to file-read will skip past both leading and trailing whitespace.
空白は定数の間を区分します。file-readは前にある空白と後にある空白をスキップします。
Note that strings need to have quotes around them. Use the command file-write to have quotes included.
文字列は引用符で囲む必要があります。引用符を記入するにはfile-writeコマンドを使ってください。
Also note that the file-open command must be called before this reporter can be used, and there must be data remaining in the file. Use the reporter file-at-end? to determine if you are at the end of the file.
file-openコマンドをこのレポーターを使う前に呼び出す必要があり、またファイルにデータが残っている必要があります。ファイルの終端にいるかどうかを確認するにはfile-at-end?を使用してください。
file-open "my-file.data" print file-read + 5 ;; Next value is the number 次の値は数値1 => 6 print length file-read ;; Next value is the list次の値はリスト [1 2 3 4] => 4
See also: file-open, file-write もご覧ください。
Reports the given number of characters from an opened file as a string. If there are fewer than that many characters left, it will report all of the remaining characters.
開いているファイルから指定の個数の文字を文字列として読み込んで返します。残っている文字数のほうが少ない場合は残っているすべての文字を読み込みます。
Note that it will return every character including newlines and spaces.
改行と空白を含むすべての文字を返します。
Also note that the file-open command must be called before this reporter can be used, and there must be data remaining in the file. Use the reporter file-at-end? to determine if you are at the end of the file.
file-openコマンドをこのレポーターを使う前に呼び出す必要があり、またファイルにデータが残っている必要があります。ファイルの終端にいるかどうかを確認するにはfile-at-end?を使用してください。
file-open "my-file.txt" print file-read-characters 5 ;; Current line in file isファイルの現在の行は "Hello World" => Hello
See also: file-open もご覧ください。
Reads the next line in the file and reports it as a string. It determines the end of the file by a carriage return, an end of file character or both in a row. It does not return the line terminator characters.
ファイルの次の1行を読み込んで文字列として返します。改行記号、エンドオブファイル文字もしくはその両方があればファイルの終わりと判定します。このコマンドが返す値にはラインターミネーターは含まれません。
Also note that the file-open command must be called before this reporter can be used, and there must be data remaining in the file. Use the reporter file-at-end? to determine if you are at the end of the file.
file-openコマンドをこのレポーターを使う前に呼び出す必要があり、またファイルにデータが残っている必要があります。ファイルの終端にいるかどうかを確認するにはfile-at-end?を使用してください。
file-open "my-file.txt" print file-read-line => Hello World
See also: file-open もご覧ください。
Prints value to an opened file, preceded by this agent agent, and followed by a carriage return. (This agent is included to help you keep track of what agents are producing which lines of output.) Also, all strings have their quotes included similar to file-write.
開いているファイルに、実行したエージェント、値、改行記号の順で出力します。(実行したエージェントは、どのエージェントが出力内容のどの行を出力したかをたどれるようにするために出力結果に含まれます。)また、file-writeと同様にすべての文字列は引用符で囲まれます。
Note that this command is the file i/o equivalent of show, and file-open needs to be called before this command can be used.
このコマンドはshowと同等のファイル入出力です。また、このコマンドを実行する前にfile-openを呼び出す必要があります。
See also: file-print, file-type, file-write もご覧ください。
Prints value to an opened file, not followed by a carriage return (unlike file-print and file-show). The lack of a carriage return allows you to print several values on the same line.
開いているファイルに値を、改行記号を伴わずに出力します(file-printやfile-showとは異なります)。改行記号がないので、同じ行に他の値を続けて表示することができます。
This agent is not printed before the value, unlike file-show.
file-showとは異なり、実行したエージェントは値の前には表示されません。
Note that this command is the file i/o equivalent of type, and file-open needs to be called before this command can be used.
このコマンドはtypeと同等のファイル入出力です。また、このコマンドを実行する前にfile-openを呼び出す必要があります。
See also: file-print, file-show, file-write もご覧ください。
This command will output value, which can be a number, string, list, boolean, or nobody to an opened file, not followed by a carriage return (unlike file-print and file-show).
開いているファイルに、空白、値の順で出力します。値は数値、文字列、リスト、boolean、nobodyのいずれかとなります。(file-printやfile-showとは異なり、改行記号は伴いません。)
This agent is not printed before the value, unlike file-show. Its output also includes quotes around strings and is prepended with a space. It will output the value in such a manner that file-read will be able to interpret it.
file-showとは異なり、実行したエージェントは値の前には表示されません。出力が文字列の場合は引用符で囲まれます。このコマンドはfile-readが読み取れるような書式で値を出力します。
Note that this command is the file i/o equivalent of write, and file-open needs to be called before this command can be used.
このコマンドはwriteと同等のファイル入出力です。また、このコマンドを実行する前にfile-openを呼び出す必要があります。
file-open "locations.txt" ask turtles [ file-write xcor file-write ycor ]
See also: file-print, file-show, file-type もご覧ください。
Reports a list containing only those items of list for which the task reports true -- in other words, the items satisfying the given condition.
リストの要素のうちタスクがtrueを返す要素だけを含むリストを返します。言い換えれば、指定の条件を満たす要素のリストです。
show filter is-number? [1 "2" 3] => [1 3] show filter [? < 3] [1 3 2] => [1 2] show filter [first ? != "t"] ["hi" "there" "everyone"] => ["hi" "everyone"]
See also: map, reduce, ? もご覧ください。
On a list, reports the first (0th) item in the list.
リストの場合、リストの最初(0番目)の要素を返します。
On a string, reports a one-character string containing only the first character of the original string.
文字列の場合、元の文字列の最初の文字だけを含む一文字だけの文字列を返します。
Reports the largest integer less than or equal to number.
数値と等しいかより小さい最大の整数を返します。
show floor 4.5 => 4 show floor -4.5 => -5
See also: ceiling, round, precision もご覧ください。
Similar to ride, but, in the 3D view, the observer's vantage point is behind and above turtle.
rideと似ていますが、3Dビューでは、オブザーバーの視点はタートルの後方上側となります。
See also: follow-me, ride, reset-perspective, watch, subject もご覧ください。
Asks the observer to follow this turtle.
オブザーバーに実行したタートルをfollowさせます。
See also: follow もご覧ください。
With a single list, runs the task for each item of list.
単一のリストの場合、リストの各要素に対してタスクを実行します。
foreach [1.1 2.2 2.6] show => 1.1 => 2.2 => 2.6 foreach [1.1 2.2 2.6] [ show (word ? " -> " round ?) ] => 1.1 -> 1 => 2.2 -> 2 => 2.6 -> 3
With multiple lists, runs command-task for each group of items from each list. So, they are run once for the first items, once for the second items, and so on. All the lists must be the same length.
複数のリストの場合、各リストの要素の各グループに対してコマンドタスクを実行します。したがって、最初の要素に対して1回、次の要素に対して1回、というように実行されます。すべてのリストは同じ長さでなければなりません。
Some examples make this clearer:
このことは例を見ればはっきりします。
(foreach [1 2 3] [2 4 6] [ show word "the sum is: " (?1 + ?2) ]) => "the sum is: 3" => "the sum is: 6" => "the sum is: 9" (foreach list (turtle 1) (turtle 2) [3 4] [ ask ?1 [ fd ?2 ] ]) ;; turtle 1 moves forward 3 patchesタートル1は3パッチ前進 ;; turtle 2 moves forward 4 patchesタートル2は4パッチ前進
The turtle moves forward by number steps, one step at a time. (If number is negative, the turtle moves backward.)
タートルが1回に1ステップずつ数値ステップだけ前方へ進みます。(もし数値が負数であるときはタートルは後方へ進みます。)
fd 10 is equivalent to repeat 10 [ jump 1 ]. fd 10.5 is equivalent to repeat 10 [ jump 1 ] jump 0.5.
fd 10はrepeat 10 [ jump 1 ]と等しくなります。fd 10.5はrepeat 10 [ jump 1 ] jump 0.5と等しくなります。
If the turtle cannot move forward number steps because it is not permitted by the current topology the turtle will complete as many steps of 1 as it can, then stop.
もしタートルが位相の制限のために数値ステップ前方へは移動できない場合は、タートルは1ステップ以上動けるだけ動いてそこで停止します。
See also: jump, can-move? もご覧ください。
Adds item to the beginning of a list and reports the new list.
要素を指定のリストの先頭に追加した新しいリストを返します。
;; suppose mylist is [5 7 10] set mylist fput 2 mylist ;; mylist is now [2 5 7 10]
;; mylist が [5 7 10] であると仮定 set mylist fput 2 mylist ;; mylist は [2 5 7 10] となった
This keyword, like the breed, <breeds>-own, patches-own, and turtles-own keywords, can only be used at the beginning of a program, before any function definitions. It defines new global variables. Global variables are "global" because they are accessible by all agents and can be used anywhere in a model.
globals, breed, directed-link-breed, undirected-link-breed, patches-own, turtles-own, links-own, <品種集合>-ownの各予約語は、プロシージャ定義よりも前のコードタブの先頭においてのみ使用することができます。globalsはグローバル変数を定義します。グローバル変数はすべてのエージェントがアクセスでき、モデルのどこでも使うことができます。
Most often, globals is used to define variables or constants that need to be used in many parts of the program.
多くの場合、globalsはプログラムの多くの部分で必要になる変数や定数を定義するために用いられます。
This turtle creates number new turtles. Each new turtle inherits of all its variables, including its location, from its parent. (Exceptions: each new turtle will have a new who number, and it may be of a different breed than its parent if the hatch-<breeds> form is used.)
実行したタートルが数値個の新しいタートルを作成します。新しいタートルは親から位置を含むすべての変数値を受け継ぎます。(例外として、新しいタートルはそれぞれ新しいwho番号を持ち、またhatch-<品種集合>の形が用いられたときは親とは異なる品種になります。)
The new turtles then run commands. You can use the commands to give the new turtles different colors, headings, locations, or whatever. (The new turtles are created all at once, then run one at a time, in random order.)
新しいタートルはコマンドを実行します。コマンドは新しいタートルに異なる色、位置、向きなどを設定するために使うことができます。(新しいタートルは一度にすべて作成され、次にコマンドをランダムな順序で1個ずつ実行します。)
If the hatch-<breeds> form is used, the new turtles are created as members of the given breed. Otherwise, the new turtles are the same breed as their parent.
hatch-<品種集合>の形が用いられたときは、新しいタートルは指定の品種のメンバーとして作成されます。そうでないときは新しいタートルは親と同じ品種になります。
hatch 1 [ lt 45 fd 1 ] ;; this turtle creates one new turtle, ;; and the child turns and moves away hatch-sheep 1 [ set color black ] ;; this turtle creates a new turtle ;; of the sheep breed
hatch 1 [ lt 45 fd 1 ] ;; 実行したタートルが新しいタートルを1個作成、その子供は回転して移動する hatch-sheep 1 [ set color black ] ;; 実行したタートルがsheep品種の新しいタートルを1個作成
See also: create-turtles, sprout もご覧ください。
This is a built-in turtle variable. It indicates the direction the turtle is facing. This is a number greater than or equal to 0 and less than 360. 0 is north, 90 is east, and so on. You can set this variable to make a turtle turn.
組み込みのタートル変数です。タートルが面している向きを意味します。変数値は0以上360未満の数値となります。0は北向き、90は東向きを意味します。変数値を設定することでタートルの向きを変更することができます。
See also: right, left, dx, dy もご覧ください。
Example:
set heading 45 ;; turtle is now facing northeastタートルが北東を向く set heading heading + 10 ;; same effect as "rt 10"と同じ効果
This is a built-in turtle or link variable. It holds a boolean (true or false) value indicating whether the turtle or link is currently hidden (i.e., invisible). You can set this variable to make a turtle or link disappear or reappear.
組み込みのタートル変数もしくはリンク変数です。タートルもしくはリンクが現時点で不可視かどうかの論理変数を保有します。変数値を設定することでタートルもしくはリンクを不可視もしくは可視に変更することができます。
See also: hide-turtle, show-turtle, hide-link, show-link もご覧ください。
Example:
set hidden? not hidden? ;; if turtle was showing, it hides, and if it was hiding, ;; it reappears ;; タートルが不可視であれば可視に、可視であれば不可視に変更される
The link makes itself invisible.
リンクが自分自身を不可視にします。
Note: This command is equivalent to setting the link variable "hidden?" to true.
注意:このコマンドはリンク変数の"hidden?"をtrueに変更するのと同等です。
See also: show-link もご覧ください。
The turtle makes itself invisible.
タートルが自分自身を不可視にします。
Note: This command is equivalent to setting the turtle variable "hidden?" to true.
注意:このコマンドはタートル変数の"hidden?"をtrueに変更するのと同等です。
See also: show-turtle もご覧ください。
Histograms the values in the given list.
指定のリストに含まれる値のヒストグラムを作成します。
Draws a histogram showing the frequency distribution of the values in the list. The heights of the bars in the histogram represent the numbers of values in each subrange.
リストに含まれる値の頻度分布を表すヒストグラムを描きます。ヒストグラムの棒の高さは各区間における値の出現数を表します。
Before the histogram is drawn, first any previous points drawn by the current plot pen are removed.
ヒストグラムを描く前に、カレントプロットペンが描いたすべての点を消去します。
Any non-numeric values in the list are ignored.
リスト中に数値でない値が含まれていれば無視されます。
The histogram is drawn on the current plot using the current plot pen and pen color. Auto scaling does not affect a histogram's horizontal range, so set-plot-x-range should be used to control the range, and the pen interval can then be set (either directly with set-plot-pen-interval, or indirectly via set-histogram-num-bars) to control how many bars that range is split up into.
ヒストグラムはカレントプロットにおいてカレントプロットペンとペン色を用いて描かれます。自動スケーリングではヒストグラムの水平方向の範囲は変更されませんので、set-plot-x-rangeで範囲を調整します。またプロットペンの間隔を設定(set-plot-pen-intervalを用いて直接、もしくはset-histogram-num-barsを用いて間接的に)することで、範囲を区切る縦棒の数を調整します。
Be sure that if you want the histogram drawn with bars that the current pen is in bar mode (mode 1).
ヒストグラムを棒グラフで描きたい場合はカレントペンが棒グラフモード(モード1)でなければなりません。
For histogramming purposes the plot's X range is not considered to include the maximum X value. Values equal to the maximum X will fall outside of the histogram's range.
ヒストグラムを描く目的では、プロットのXの範囲はXの最大値を含むようには考慮されません。Xの最大値に等しい値はヒストグラムの範囲の外側にはみ出ます。
histogram [color] of turtles ;; draws a histogram showing how many turtles there are ;; of each color ;; 何個のタートルがそれぞれの色になっているかを表示するヒストグラムを描く
This turtle moves to the origin (0,0). Equivalent to setxy 0 0.
タートルが原点(0,0)へ移動します。setxy 0 0と同等です。
Reports a RGB list when given three numbers describing an HSB color. Hue, saturation, and brightness are integers in the range 0-360, 0-100, 0-100 respectively. The RGB list contains three integers in the range of 0-255.
HSB色空間を表す3つの数値を指定すると、RGB色空間を表す3つの数値のリストを返します。色相、彩度、明度はそれぞれ0-360、0-100、0-100の範囲の整数で指定します。RGBリストは0-255の範囲の整数となります。
See also: rgb もご覧ください。
This broadcasts value from NetLogo to the interface element with the name tag-name on the clients.
NetLogoからクライアントのインターフェースエレメントへタグ名の名前で値を送ります。
See the HubNet Authoring Guide for details and instructions.
詳細と方法説明はHubNet編集ガイドをご覧ください。
This clears all messages printed to the text area on every client.
すべてのクライアントのテキストエリアに表示されたすべてのメッセージを消去します。
See also: hubnet-broadcast-message, hubnet-send-clear-output もご覧ください。
This prints the value in the text area on each client. This is the same functionality as the "Broadcast Message" button in the HubNet Control Center.
各クライアントのテキスト領域に値を表示します。HubNetコントロールセンターの"Broadcast Message"ボタンの機能と同等です。
See also: hubnet-send-message もご覧ください。
Remove overrides from the override list on client. hubnet-clear-override removes only the override for the specified variable for the specified agent or agentset. hubnet-clear-overrides removes all overrides from the specified client.
クライアントのオーバーライドリストからオーバーライドを削除します。hubnet-clear-overrideは特定のエージェントもしくはエージェント集合の特定の変数へのオーバーライドだけを削除します。hubnet-clear-overridesは特定のクライアントへのすべてのオーバーライドを削除します。
See also: hubnet-send-override もご覧ください。
Reports a list containing the names of all the clients currently connected to the HubNet server.
現時点でHubNetサーバーに接続しているすべてのクライアント名のリストを返します。
Reports true if a new client just entered the simulation. Reports false otherwise. hubnet-message-source will contain the user name of the client that just logged on.
新しいクライアントがシミュレーションに直前に加わったのであればtrueを、そうでなければfalseを返します。hubnet-message-sourceは直前にログオンしたクライアントのユーザー名を含みます。
See the HubNet Authoring Guide for details and instructions.
詳細と方法説明はHubNet編集ガイドをご覧ください。
Reports true if a client just exited the simulation. Reports false otherwise. hubnet-message-source will contain the user name of the client that just logged off.
クライアントがシミュレーションから直前に退出したのであればtrueを、そうでなければfalseを返します。hubnet-message-sourceは直前にログオフしたクライアントのユーザー名を含みます。
See the HubNet Authoring Guide for details and instructions.
詳細と方法説明はHubNet編集ガイドをご覧ください。
If there is any new data sent by the clients, this retrieves the next piece of data, so that it can be accessed by hubnet-message, hubnet-message-source, and hubnet-message-tag. This will cause an error if there is no new data from the clients.
クライアントから送られた新しいデータがあるときは、このプリミティブは次のデータを取得しますので、hubnet-message, hubnet-message-source, hubnet-message-tagからアクセスすることができます。クライアントからの新しいデータがない場合はエラーになります。
See the HubNet Authoring Guide for details.
詳細はHubNet編集ガイドをご覧ください。
Kicks the client with the given client-name. This is equivalent to clicking the client name in the HubNet Control Center and pressing the Kick button.
指定のクライアント名のクライアントを切断します。HubNet Control Centerでクライアント名をクリックして切断ボタンを押すのと同じ動作になります。
Kicks out all currently connected HubNet clients. This is equivalent to selecting all clients in the HubNet Control Center and pressing the Kick button.
現在HubNetにつながっているすべてのクライアントを切断します。HubNet Control Centerですべてのクライアントを選択して切断ボタンを押すのと同じ動作になります。
Reports the message retrieved by hubnet-fetch-message.
hubnet-fetch-messageで取得したメッセージを返します。
See the HubNet Authoring Guide for details.
詳細はHubNet編集ガイドをご覧ください。
Reports the name of the client that sent the message retrieved by hubnet-fetch-message.
hubnet-fetch-messageで取得したメッセージを送り出したクライアント名を返します。
See the HubNet Authoring Guide for details.
詳細はHubNet編集ガイドをご覧ください。
Reports the tag that is associated with the data that was retrieved by hubnet-fetch-message. The tag will be one of the Display Names of the interface elements in the client interface.
hubnet-fetch-messageで取得したデータに関連付けられたタグを返します。タグはクライアントインターフェース中のインターフェース要素のDisplay Namesの1つです。
See the HubNet Authoring Guide for details.
詳細はHubNet編集ガイドをご覧ください。
This looks for a new message sent by the clients. It reports true if there is one, and false if there is not.
クライアントが送った新しいメッセージを探します。メッセージがあればtrue、なければfalseを返します。
See the HubNet Authoring Guide for details.
詳細はHubNet編集ガイドをご覧ください。
Starts up the HubNet system. HubNet must be started to use any of the other hubnet primitives with the exception of hubnet-set-client-interface.
HubNetシステムを開始します。hubnet-set-client-interface以外のHubNet関連プリミティブはHubNetを開始してから使えるようになります。
See the HubNet Authoring Guide for details.
詳細はHubNet編集ガイドをご覧ください。
Clears watch or follow sent directly to the client. The view perspective will revert to the server perspective.
watchかfollowのクリアがクライアントに直接送られます。ビューの視点はサーバーの視点に戻されます。
See also: hubnet-send-watch, hubnet-send-follow もご覧ください。
For a string, this sends value from NetLogo to the tag tag-name on the client that has string for its user name.
文字列の場合は、このコマンドは文字列というユーザー名を持つクライアント上のタグ名というタグに対してNetLogoから値を送ります。
For a list-of-strings, this sends value from NetLogo to the tag tag-name on all the clients that have a user name that is in the list-of-strings.
文字列リストの場合は、このコマンドは文字列リストにあるユーザー名を持つすべてのクライアント上のタグ名というタグに対してNetLogoから値を送ります。
Sending a message to a non-existent client, using hubnet-send, generates a hubnet-exit-message.
hubnet-sendを使って存在しないクライアントにメッセージを送ると、hubnet-exit-messageを生成します。
See the HubNet Authoring Guide for details.
詳細はHubNet編集ガイドをご覧ください。
This clears all messages printed to the text area on the given client or clients (specified in the string or list-of-strings).
指定のクライアント(文字列または文字列リストで指定)のテキスト領域に表示されたすべてのメッセージを消去します。
See also: hubnet-send-message, hubnet-broadcast-clear-output もご覧ください。
Tells the client associated with client-name to follow agent showing a radius sized Moore neighborhood around the agent.
クライアント名に関連するクライアントに対して、エージェントの周囲のムーア近傍で測られる半径を示すエージェントをフォローするよう指示します。
See also: hubnet-send-watch, hubnet-reset-perspective もご覧ください。
This prints value in the text area on the client specified by string.
文字列で特定されるクライアントのテキスト領域に値を表示します。
See also: hubnet-broadcast-message もご覧ください。
Evaluates reporter for the agent or agentset indicated then sends the values to the client to "override" the value of variable-name only on client-name. This is used to change the appearance of agents in the client view, hence, only built-in variables that affect the appearance of the agent may be selected. For example, you can override the color variable of a turtle:
指定されているエージェントまたはエージェント集合に関してレポーターを計算し、その値をクライアント名上の変数名の値を"上書き"するためにクライアントに送ります。このコマンドはクライアントのビューにおけるエージェントの外見を変更するために使われますので、エージェントの外見に影響する組み込み変数のみが選ばれる可能性があります。たとえば、タートルの色変数を次のようにして上書きします:
ask turtles [ hubnet-send-override client-name self "color" [ red ] ]
In this example assume that there is a turtles-own variable client-name which is associated with a logged in client, and all the turtles are blue. This code makes the turtle associated with each client appear red in his or her own view but not on anyone else's or on the server.
この例はログインされているクライアントに関連するclient-nameというturtles-own変数があり、すべてのタートルが青であることを前提としています。このコードは、各クライアントに関連したタートルを、そのクライアントのビューにおいてのみ赤に変えますが、他の人のビューやサーバーでは何もしません。
See also: hubnet-clear-overrides もご覧ください。
Tells the client associated with client-name to watch agent.
クライアント名に関連付けられたクライアントに対してエージェントをウォッチするよう指示します。
See also: hubnet-send-follow, hubnet-reset-perspective もご覧ください。
If client-type is "COMPUTER", client-info is ignored.
クライアントタイプが "COMPUTER" である場合は、クライアント情報は無視されます。
hubnet-set-client-interface "COMPUTER" []
Future versions of HubNet will support other client types. Even for computer clients, the meaning of the second input to this command may change.
HubNetの将来のバージョンでは他のクライアントタイプをサポートする予定です。コンピュータークライアントであっても、このコマンドの第2引数の意味は変更になるかもしれません。
See the HubNet Authoring Guide for details.
詳細はHubNet編集ガイドをご覧ください。
Reporter must report a boolean (true or false) value.
レポーターは論理値(trueかfalse)を返すものでなくてはなりません。
If condition reports true, runs commands.
もしレポーターがtrueであればコマンドを実行します。
The reporter may report a different value for different agents, so some agents may run commands and others don't.
レポーターは異なるエージェントに対して異なる値を返すかもしれませんので、コマンドを実行するエージェントもあればそうでないものもあります。
if xcor > 0[ set color blue ] ;; turtles in the right half of the world ;; turn blue ;; ワールドの右半分にいるタートルが青に変わる
See also: ifelse, ifelse-value もご覧ください。
Reporter must report a boolean (true or false) value.
レポーターは論理値(trueかfalse)を返すものでなくてはなりません。
If reporter reports true, runs commands1.
レポーターがtrueのときはコマンド1を実行します。
If reporter reports false, runs commands2.
レポーターがfalseのときはコマンド2を実行します。
The reporter may report a different value for different agents, so some agents may run commands1 while others run commands2.
レポーターは異なるエージェントに対して異なる値を返すかもしれませんので、コマンド1を実行するエージェントもあればコマンド2を実行するものもあります。
ask patches [ ifelse pxcor > 0 [ set pcolor blue ] [ set pcolor red ] ] ;; the left half of the world turns red and ;; the right half turns blue ;; ワールドの左半分にいるタートルが赤に変わり、右半分にいるタートルが青に変わる
See also: if, ifelse-value もご覧ください。
Reporter must report a boolean (true or false) value.
レポーターは論理値(trueかfalse)を返すものでなくてはなりません。
If reporter reports true, the result is the value of reporter1.
レポーターがtrueのときはレポーター1の値を返します。
If reporter reports false, the result is the value of reporter2.
レポーターがfalseのときはレポーター2の値を返します。
This can be used when a conditional is needed in the context of a reporter, where commands (such as ifelse) are not allowed.
このプリミティブはコマンド(例えばifelse)が使えず、条件のみが必要になる文脈において使われます。
ask patches [ set pcolor ifelse-value (pxcor > 0) [blue] [red] ] ;; the left half of the world turns red and ;; the right half turns blue ;; ワールドの左半分にいるタートルが赤に変わり、右半分にいるタートルが青に変わる show n-values 10 [ifelse-value (? < 5) [0] [1]] => [0 0 0 0 0 1 1 1 1 1] show reduce [ifelse-value (?1 > ?2) [?1] [?2]] [1 3 2 5 3 8 3 2 1] => 8
Reads an image file into the drawing, scaling it to the size of the world, while retaining the original aspect ratio of the image. The image is centered in the drawing. The old drawing is not cleared first.
ドローイングに画像ファイルを読み込み、画像の元々のアスペクト比を維持しつつワールドの大きさにあてはめます。画像はドローイングの中心に置かれます。以前のドローイングは最初には消去されません。
Agents cannot sense the drawing, so they cannot interact with or process images imported by import-drawing. If you need agents to sense an image, use import-pcolors or import-pcolors-rgb.
エージェントはドローイングを知覚できませんので、import-drawingで読み込んだ画像と相互作用したり処理したりすることはできません。エージェントに画像を知覚させる必要がある場合は、import-pcolorsかimport-pcolors-rgbを使ってください。
The following image file formats are supported: BMP, JPG, GIF, and PNG. If the image format supports transparency (alpha), that information will be imported as well.
BMP, JPG, GIF, PNGの画像フォーマットをサポートしています。画像が透過(アルファ値)をサポートしている場合は、この情報も同様にインポートされます。
Reads an image file, scales it to the same dimensions as the patch grid while maintaining the original aspect ratio of the image, and transfers the resulting pixel colors to the patches. The image is centered in the patch grid. The resulting patch colors may be distorted, since the NetLogo color space does not include all possible colors. (See the Color section of the Programming Guide.) import-pcolors may be slow for some images, particularly when you have many patches and a large image with many different colors.
画像ファイルを読み込み、画像の元々のアスペクト比を維持しつつパッチグリッドと同じ次元にあてはめ、パッチのピクセル色に変換します。画像はパッチグリッドの中心に置かれます。NetLogo色空間はすべての色を含んではいませんので、変換後のパッチの色はゆがめられます。(プログラミングガイドの「色」節をご覧ください。)import-pcolorsは、パッチの数が多く、多くの種類の色を使っている大きなサイズの画像を使う場合は動作が遅くなります。
Since import-pcolors sets the pcolor of patches, agents can sense the image. This is useful if agents need to analyze, process, or otherwise interact with the image. If you want to simply display a static backdrop, without color distortion, see import-drawing.
import-pcolorsはパッチのpcolorを設定しますので、エージェントは画像を知覚することができます。この機能はエージェントが画像と分析、処理その他の相互作用をする場合に有用です。もし色をゆがめることなく単に静的な背景を表示したいだけである場合は、import-drawingをご覧ください。
The following image file formats are supported: BMP, JPG, GIF, and PNG. If the image format supports transparency (alpha), then all fully transparent pixels will be ignored. (Partially transparent pixels will be treated as opaque.)
BMP, JPG, GIF, PNGの画像フォーマットをサポートしています。画像が透過(アルファ値)をサポートしている場合は、完全に透明なピクセルは無視されます。(部分的に透明なセルは不透明なものとして扱われます。
Reads an image file, scales it to the same dimensions as the patch grid while maintaining the original aspect ratio of the image, and transfers the resulting pixel colors to the patches. The image is centered in the patch grid. Unlike import-pcolors, the exact colors in the original image are retained. The pcolor variable of all the patches will be an RGB list rather than an (approximated) NetLogo color.
画像ファイルを読み込み、画像のもともとの縦横比を維持しつつパッチグリッドと同じ次元にあてはめ、パッチのピクセル色に変換します。画像はパッチグリッドの中心に置かれます。import-pcolorsとは異なり、もともとの画像の正確な色が保持されます。パッチのpcolor変数は(すべての色は含まない)NetLogo色ではなくRGB色となります。
The following image file formats are supported: BMP, JPG, GIF, and PNG. If the image format supports transparency (alpha), then all fully transparent pixels will be ignored. (Partially transparent pixels will be treated as opaque.)
BMP, JPG, GIF, PNGのファイル形式をサポートしています。画像の形式が透過(アルファ値)をサポートしている場合は、完全に透明なピクセルは無視されます。(部分的に透明なピクセルは不透明なものとして扱われます。
Reads the values of all variables for a model, both built-in and user-defined, including all observer, turtle, and patch variables, from an external file named by the given string. The file should be in the format used by the export-world primitive.
モデルに含まれる、オブザーバー変数、タートル変数、パッチ変数のすべてを含む、組み込みとユーザー定義の両方の変数値を、指定の文字列の名前の外部ファイルから読み込みます。ファイルはexport-worldで使われたフォーマットでなければなりません。
Note that the functionality of this primitive is also directly available from NetLogo's File menu.
このプリミティブの機能はNetLogoの [File] メニューでも使うことができます。
When using import-world, to avoid errors, perform these steps in the following order:
import-worldを使うときは、エラーを避けるために、以下の順序でステップを実行してください。
If you wish to import a file from a location other than the model's location, you may include the full path to the file you wish to import. See export-world for an example.
モデルの位置以外の位置からファイルをインポートしたい場合は、インポートしたいファイルのフルパスを含めることができます。例はexport-worldをご覧ください。
This reporter lets you give a turtle a "cone of vision" in front of itself. The cone is defined by the two inputs, the vision distance (radius) and the viewing angle. The viewing angle may range from 0 to 360 and is centered around the turtle's current heading. (If the angle is 360, then in-cone is equivalent to in-radius.)
このレポーターはタートルの前方に"円錐形の視野"を与えます。円錐は2個の入力値で定義されます。視野の距離(半径)と視野角です。視野角は0度以上360度以下で、タートルの現在の向きが中心となります。(もし角度が360度であれば、in-coneはin-radiusと等しくなります。)
in-cone reports an agentset that includes only those agents from the original agentset that fall in the cone. (This can include the agent itself.)
in-coneは元のエージェント集合のうち円錐の範囲内にいるエージェントのみからなるエージェント集合を返します。(これには実行したエージェント自身も含まれる場合があります。)
The distance to a patch is measured from the center of the patch.
パッチへの距離はパッチの中心点から計測されます。
ask turtles [ ask patches in-cone 3 60 [ set pcolor red ] ] ;; each turtle makes a red "splotch" of patches in a 60 degree ;; cone of radius 3 ahead of itself ;; 各タートルは前方距離3で60度の円錐内のパッチで赤の"splotch"を作る
Reports true if there is a directed link going from turtle to the caller.
タートルから実行したタートルへの有向リンクがあればtrueを返します。
crt 2 ask turtle 0 [ create-link-to turtle 1 show in-link-neighbor? turtle 1 ;; prints falseを表示 show out-link-neighbor? turtle 1 ;; prints trueを表示 ] ask turtle 1 [ show in-link-neighbor? turtle 0 ;; prints trueを表示 show out-link-neighbor? turtle 0 ;; prints falseを表示 ]
Reports the agentset of all the turtles that have directed links coming from them to the caller.
実行したタートルへの有向リンクを持つすべてのタートルからなるエージェント集合を返します。
crt 4 ask turtle 0 [ create-links-to other turtles ] ask turtle 1 [ ask in-link-neighbors [ set color blue ] ] ;; turtle 0 turns blueタートル 0 が青に変わる
Report the directed link from turtle to the caller. If no link exists then it reports nobody.
タートルから実行したエージェントへの有向リンクを返します。もしリンクが存在しない場合はnobodyを返します。
crt 2 ask turtle 0 [ create-link-to turtle 1 ] ask turtle 1 [ show in-link-from turtle 0 ] ;; shows link 0 1リンク 0 1 を表示 ask turtle 0 [ show in-link-from turtle 1 ] ;; shows nobodyを表示
See also: out-link-to, link-with もご覧ください。
Causes external NetLogo source files (with the .nls suffix) to be included in this model. Included files may contain breed, variable, and procedure definitions. __includes can only be used once per file.
外部のNetLogoソースファイル(.nls拡張子があるもの)をモデルに取り込みます。取り込むファイルには品種、変数、プロシージャ定義を記載することができます。__includesは各ファイルにつき1回だけ使うことができます。
Reports an agentset that includes only those agents from the original agentset whose distance from the caller is less than or equal to number. (This can include the agent itself.)
元のエージェント集合のうち実行したエージェントからの距離が数値以下のエージェントのみからなるエージェント集合を返します。(これには実行したエージェント自身も含まれる場合があります。)
The distance to or a from a patch is measured from the center of the patch.
パッチから、またはパッチへの距離はパッチの中心点を基準にして測ります。
ask turtles [ ask patches in-radius 3 [ set pcolor red ] ] ;; each turtle makes a red "splotch" around itself ;; 各タートルが自分自身の周囲に赤い"斑点"を作る
Opens an agent monitor for the given agent (turtle or patch).
指定のエージェント(タートルもしくはパッチ)に関するエージェントモニターを開きます。
inspect patch 2 4 ;; an agent monitor opens for that patch inspect one-of sheep ;; an agent monitor opens for a random turtle from ;; the "sheep" breed
inspect patch 2 4 ;; このパッチに関するエージェントモニターを開く inspect one-of sheep ;; "sheep"品種からランダムに選んだタートルに関する ;; エージェントモニターを開く
Reports the integer part of number -- any fractional part is discarded.
数値の整数部分を返します。小数部分は切り捨てられます。
show int 4.7 => 4 show int -3.5 => -3
Reports true if value is of the given type, false otherwise.
値が指定の型であればtrueを、そうでなければfalseを返します。
On lists, reports the value of the item in the given list with the given index.
リストの場合、指定のリストの指定の番号の要素の値を返します。
On strings, reports the character in the given string at the given index.
文字列の場合、指定の文字列の指定の番号の文字を返します。
Note that the indices begin from 0, not 1. (The first item is item 0, the second item is item 1, and so on.)
番号の数値は1からではなく0から始まります。(最初の要素が要素0、2番目の要素が要素1というようになります。)
;; suppose mylist is [2 4 6 8 10]mylistが[2 4 6 8 10]であると仮定 show item 2 mylist => 6 show item 3 "my-shoe" => "s"
The turtle moves forward by number units all at once (rather than one step at a time as with the forward command).
タートルが一度に数値単位前へ進みます(forwardコマンドで1回に1ステップずつ進むのとは異なります)。
If the turtle cannot jump number units because it is not permitted by the current topology the turtle does not move at all.
もし位相のためにタートルが数値単位ジャンプすることができない場合は、タートルはまったく動きません。
See also: forward, can-move? もご覧ください。
This is a built-in turtle or link variable. It may hold a value of any type. The turtle or link appears in the view with the given value "attached" to it as text. You can set this variable to add, change, or remove a turtle or link's label.
組み込みのタートル変数もしくはリンク変数です。どのような種類の値でも保有することができます。タートルもしくはリンクは、この値をテキストとして伴った形でビューに表示されます。この変数を設定することでタートルもしくはリンクのラベルを追加、変更、削除することができます。
See also: label-color, plabel, plabel-color もご覧ください。
Example:
ask turtles [ set label who ] ;; all the turtles now are labeled with their ;; who numbers ask turtles [ set label "" ] ;; all turtles now are not labeled
ask turtles [ set label who ] ;; すべてのタートルにwho番号をラベルとして付与 ask turtles [ set label "" ] ;; すべてのタートルにラベルはない
This is a built-in turtle or link variable. It holds a number greater than or equal to 0 and less than 140. This number determines what color the turtle or link's label appears in (if it has a label). You can set this variable to change the color of a turtle or link's label.
組み込みのタートル変数もしくはリンク変数です。0以上140未満の数値を保有します。この数値はタートルもしくはリンクのラベルの色(もしそれらにラベルがあれば)を決定します。この変数値を設定することでタートルもしくはリンクのラベルの色を変更することができます。
See also: label, plabel, plabel-color もご覧ください。
Example:
ask turtles [ set label-color red ] ;; all the turtles now have red labelsすべてのタートルのラベルの色が赤になった
On a list, reports the last item in the list.
リストの場合、リストの最後の要素を返します。
On a string, reports a one-character string containing only the last character of the original string.
文字列の場合、元の文字列の最後の文字だけを含む1文字だけの文字列を返します。
Arranges the given turtles in a circle centered on the patch at the center of the world with the given radius. (If the world has an even size the center of the circle is rounded down to the nearest patch.) The turtles point outwards.
指定のタートルをワールドの中心にあるパッチの中心点から指定の半径で円形に配置します。(ワールドの大きさが偶数であるときは円の中心は数値を切り捨てた最寄りのパッチになります。)タートルは外側を向きます。
If the first input is an agentset, the turtles are arranged in random order.
第一入力値がエージェント集合のときは、タートルはランダムな順序で並べられます。
If the first input is a list, the turtles are arranged clockwise in the given order, starting at the top of the circle. (Any non-turtles in the list are ignored.)
第一入力値がリストのときは、タートルは指定の順序で円の上端から時計回りに並べられます。(リスト中のタートルでない要素は無視されます。)
;; in random orderランダムな順で layout-circle turtles 10 ;; in order by who numberwho番号の順で layout-circle sort turtles 10 ;; in order by size大きさの順で layout-circle sort-by [[size] of ?1 < [size] of ?2] turtles 10
Arranges the turtles in turtle-set connected by links in link-set, in a radial tree layout, centered around the root-agent which is moved to the center of the world view.
リンク集合のリンクで繋がれたタートル集合のタートルを、ワールドのビューの中心に移動したルートエージェントを中心とする放射状のツリーレイアウトに配置します。
Only links in the link-set will be used to determine the layout. If links connect turtles that are not in turtle-set those turtles will remain stationary.
リンク集合のリンクだけがレイアウトを決定することに使われます。リンクがタートル集合に含まれないタートルを接続しているときは、それらのタートルは動かされません。
Even if the network does contain cycles, and is not a true tree structure, this layout will still work, although the results will not always be pretty.
ネットワークが循環を含んでいたとしても、またツリー構造でなかったとしても、このレイアウト機能は動作しますが、実行結果の見栄えは良くないでしょう。
to make-a-tree set-default-shape turtles "circle" crt 6 ask turtle 0 [ create-link-with turtle 1 create-link-with turtle 2 create-link-with turtle 3 ] ask turtle 1 [ create-link-with turtle 4 create-link-with turtle 5 ] ; do a radial tree layout, centered on turtle 0を中心とする放射状ツリーレイアウトを実行 layout-radial turtles links (turtle 0) end
Arranges the turtles in turtle-set, as if the links in link-set are springs and the turtles are repelling each other. Turtles that are connected by links in link-set but not included in turtle-set are treated as anchors and are not moved.
タートル集合のタートルを、リンク集合のリンクがバネの役割をして互いに反発しあうと仮定して配置します。リンク集合で接続されているがタートル集合には含まれないタートルは、アンカーの役割となり動きません。
spring-constant is a measure of the "tautness" of the spring. It is the "resistance" to change in their length. spring-constant is the force the spring would exert if it's length were changed by 1 unit.
バネ定数は、バネの"緊縮性"の指標です。これは長さの変化に対する"抵抗"の強さを表します。バネ定数は長さが1単位変わったときにバネが出す力の強さとなります。
spring-length is the "zero-force" length or the natural length of the springs. This is the length which all springs try to achieve either by pushing out their nodes or pulling them in.
バネ長は、バネに力がかかっていないときの長さ、いわばバネの自然な長さです。これは頂点を押し出すか引っ張り込まない限りはすべてのバネが達成しようとする長さです。
repulsion-constant is a measure of repulsion between the nodes. It is the force that 2 nodes at a distance of 1 unit will exert on each other.
反発定数は、頂点間の反発の強さの指標です。これは2つの頂点が1単位の距離にあるときに互いに働く力になります。
The repulsion effect tries to get the nodes as far as possible from each other, in order to avoid crowding and the spring effect tries to keep them at "about" a certain distance from the nodes they are connected to. The result is the laying out of the whole network in a way which highlights relationships among the nodes and at the same time is crowded less and is visually pleasing.
反発効果は頂点が混雑するのを避けるために互いにできるだけ離そうとし、バネ効果は隣接している頂点からの距離をある値に近い値に保とうとします。結果としてネットワーク全体は、頂点間の関係が明確で同時に混雑が少ないような、視覚的に好ましい形で配置されます。
The layout algorithm is based on the Fruchterman-Reingold layout algorithm. More information about this algorithm can be obtained here.
この配置アルゴリズムはFruchterman-Reingoldアルゴリズムに基づくものです。このアルゴリズムについての詳細はこちらをご覧ください。
to make-a-triangle set-default-shape turtles "circle" crt 3 ask turtle 0 [ create-links-with other turtles ] ask turtle 1 [ create-link-with turtle 2 ] repeat 30 [ layout-spring turtles links 0.2 5 1 ] ;; lays the nodes in a triangle頂点を三角形に配置 end
The turtles that are connected by links in link-set but not included in turtle-set are placed in a circle layout with the given radius. There should be at least 3 agents in this agentset.
リンク集合のリンクで繋がっているが、タートル集合には含まれないタートルが、指定の半径で円形に配置されます。このエージェント集合には少なくとも3個のエージェントが含まれている必要があります。
The turtles in turtle-set are then laid out in the following manner: Each turtle is placed at centroid (or barycenter) of the polygon formed by its linked neighbors. (The centroid is like a 2-dimensional average of the coordinates of the neighbors.)
タートル集合のタートルは次の方法で配置されます:各タートルはリンクのある隣接エージェントが形成する多角形の重心に配置されます。(重心とは隣接エージェントの座標の2次元平均のようなものです。)
(The purpose of the circle of "anchor agents" is to prevent all the turtles from collapsing down to one point.)
("アンカーエージェント"で円を作る目的は、すべてのタートルが1点に退化してしまうことを防ぐことにあります。)
After a few iterations of this, the layout will stabilize.
何回かの反復計算の後にレイアウトは安定します。
This layout is named after the mathematician William Thomas Tutte, who proposed it as a method for graph layout.
このレイアウトの名前は、グラフのレイアウト方法を提案した数学者であるWilliam Thomas Tutteにちなむものです。
to make-a-tree set-default-shape turtles "circle" crt 6 ask turtle 0 [ create-link-with turtle 1 create-link-with turtle 2 create-link-with turtle 3 ] ask turtle 1 [ create-link-with turtle 4 create-link-with turtle 5 ] ; place all the turtles with just one ; neighbor on the perimeter of a circle ; and then place the remaining turtles inside ; this circle, spread between their neighbors.隣接タートルを1個だけ持つすべてのタートルを ; 円周上に配置し、残りのタートルを円の内側に配置して、 ; それらの隣接エージェントの間で散布する。 repeat 10 [ layout-tutte (turtles with [link-neighbors = 1]) links 12 ] end
The turtle turns left by number degrees. (If number is negative, it turns right.)
タートルが数値度左に向きを変えます。(数値が負数のときは右に向きを変えます。)
Reports the number of items in the given list, or the number of characters in the given string.
指定のリストに含まれる要素数、もしくは指定の文字列に含まれる文字数を返します。
Creates a new local variable and gives it the given value. A local variable is one that exists only within the enclosing block of commands.
新しいローカル変数を作成し指定の値を設定します。ローカル変数は囲まれているコマンドのブロックの中だけに存在できる変数です。
If you want to change the value afterwards, use set.
後から変数の値を変更したいときはsetを使います。
Example:
let prey one-of sheep-here if prey != nobody [ ask prey [ die ] ]
Given the who numbers of the endpoints, reports the link connecting the turtles. If there is no such link reports nobody. To refer to breeded links you must use the singular breed form with the endpoints.
2つの端点のwho番号を指定すると、これらのタートルをつなぐリンクを返します。そのようなリンクがない場合はnobodyを返します。品種のあるリンクを参照したいときは端点と共に品種名の品種の単一メンバーの名称を用います。
ask link 0 1 [ set color green ] ;; unbreeded link connecting turtle 0 and turtle 1 will turn greenタートル0とタートル1をつなぐ品種のないリンクが緑に変わる ask directed-link 0 1 [ set color red ] ;; directed link connecting turtle 0 and turtle 1 will turn redタートル0からタートル1への有向リンクが赤に変わる
See also: patch-at もご覧ください。
Reports the heading in degrees (at least 0, less than 360) from end1 to end2 of the link. Throws a runtime error if the endpoints are at the same location.
リンクの端点1から端点2への向きを角度(0以上360未満)で返します。もし両方の端点が同じ位置にあるときはランタイムエラーとなります。
ask link 0 1 [ print link-heading ] ;; prints [[towards other-end] of end1] of link 0 1リンク 0 1 の[[towards other-end] of end1]を表示
See also: link-length もご覧ください。
Reports the distance between the endpoints of the link.
リンクの両端の間の距離を返します。
ask link 0 1 [ print link-length ] ;; prints [[distance other-end] of end1] of link 0 1リンク 0 1の[[distance other-end] of end1]を表示
See also: link-heading もご覧ください。
Reports an agentset containing all of the links anywhere in any of the inputs. The inputs may be individual links, link agentsets, nobody, or lists (or nested lists) containing any of the above.
入力値に含まれるあらゆるリンクのすべてからなるエージェント集合を返します。入力値は個々のリンク、リンク集合、もしくはこれらのいずれかを含むリスト(またはネストされたリスト)のいずれを取ることもできます。
link-set self link-set [my-links] of nodes with [color = red]
See also: turtle-set, patch-set もご覧ください。
Reports a list of strings containing all of the link shapes in the model.
モデルが含んでいるすべてのリンク形状を文字列のリストとして返します。
New shapes can be created, or imported from other models, in the Link Shapes Editor.
リンク形状エディターを用いて、新しい形状を作成したり、他のモデルからインポートしたりできます。
show link-shapes => ["default"]
Reports the agentset consisting of all links.
すべてのリンクからなるエージェント集合を返します。
show count links ;; prints the number of linksリンクの数を表示
The links-own keyword, like the globals, breed, <breeds>-own, turtles-own, and patches-own keywords, can only be used at the beginning of a program, before any function definitions. It defines the variables belonging to each link.
globals, breed, directed-link-breed, undirected-link-breed, patches-own, turtles-own, links-own, <品種集合>-ownの各予約語は、プロシージャ定義よりも前のコードタブの先頭においてのみ使用することができます。links-ownは各リンクが保有する変数を定義します。
If you specify a breed instead of "links", only links of that breed have the listed variables. (More than one link breed may list the same variable.)
"links"ではなく品種を指定した場合は、その品種のリンクだけが列挙された変数を保有します。(2個以上のリンク品種が同じ変数を保有することもできます。)
undirected-link-breed [sidewalks sidewalk] directed-link-breed [streets street] links-own [traffic] ;; applies to all breedsすべての品種に適用される sidewalks-own [pedestrians] streets-own [cars bikes]
Reports a list containing the given items. The items can be of any type, produced by any kind of reporter.
指定の要素を含むリストを返します。要素はどのようなレポーターによって作成されたどのようなタイプのものでも可能です。
show list (random 10) (random 10) => [4 9] ;; or similar listまたは同様のリスト show (list 5) => [5] show (list (random 10) 1 2 3 (random 10)) => [4 1 2 3 9] ;; or similar listまたは同様のリスト
Reports the natural logarithm of number, that is, the logarithm to the base e (2.71828...).
数値の自然対数を返します。すなわち、e (2.71828...) を底とする対数です。
Reports the logarithm of number in base base.
底を底とする数値の対数を返します。
show log 64 2 => 6
See also: ln もご覧ください。
Repeats the commands forever, or until the enclosing procedure exits through use of the stop or report commands.
永久に、もしくはstopコマンドかreportコマンドを使って囲まれているプロシージャから抜け出るまでの間、コマンドを繰り返し実行します。
to move-to-world-edge ;; turtle procedureタートルプロシージャ loop [ if not can-move? 1 [ stop ] fd 1 ] end
In this example, stop
exits not just the loop, but the entire procedure.
この例では、stop
によってループを抜け出るだけでなく、プロシージャ全体からも抜け出ます。
Note: in many circumstances, it is more appropriate to use a forever button to repeat something indefinitely. See Buttons in the Programming Guide.
注意:多くの状況では、何かを無期限に繰り返すにはフォーエバーボタンを使う方が適切です。プログラミングガイドの「ボタン」節をご覧ください。
Adds value to the end of a list and reports the new list.
値をリストの末尾に加えた新たなリストを返します。
;; suppose mylist is [2 7 10 "Bob"] set mylist lput 42 mylist ;; mylist now is [2 7 10 "Bob" 42]
;; mylist が [2 7 10 "Bob"] であると仮定 set mylist lput 42 mylist ;; mylist は [2 7 10 "Bob" 42] となった
With a single list, the given task is run for each item in the list, and a list of the results is collected and reported.
単一のリストの場合、リストの各要素に対してタスクを実行し、結果のリストを接続して返します。
show map round [1.1 2.2 2.7] => [1 2 3] show map [? * ?] [1 2 3] => [1 4 9]
With multiple lists, the given reporter is run for each group of items from each list. So, it is run once for the first items, once for the second items, and so on. All the lists must be the same length.
複数のリストの場合、各リストの要素の各グループに対して指定のレポーターを実行します。したがって、最初の要素に対して1回、次の要素に対して1回、というように実行されます。すべてのリストは同じ長さでなければなりません。
Some examples make this clearer:
このことは例を見ればはっきりします。
show (map + [1 2 3] [2 4 6]) => [3 6 9] show (map [?1 + ?2 = ?3] [1 2 3] [2 4 6] [3 5 9]) => [true false true]
Reports the maximum number value in the list. It ignores other types of items.
リスト中の最大の数値を返します。要素が他のデータ型であれば無視します。
show max [xcor] of turtles ;; prints the x coordinate of the turtle which is ;; farthest right in the world ;; ワールドの中で最も右側にいるタートルのx座標を表示 show max list a b ;; prints the larger of the two variables a and b2変数aとbの大きい方を表示 show max (list a b c) ;; prints the largest of the three variables a, b, and c3変数a,b,cの中で最大のものを表示
Reports an agentset containing number agents from agentset with the highest values of reporter. The agentset is built by finding all the agents with the highest value of reporter, if there are not number agents with that value then agents with the second highest value are found, and so on. At the end, if there is a tie that would make the resulting agentset too large, the tie is broken randomly.
エージェント集合のうちレポーターの値が大きくなる方から選ばれた数値個のエージェントを含むエージェント集合を返します。エージェント集合にはまずレポーターの値が最大値を取るエージェントが含まれます。エージェントの数が数値に足りないときは2番目の値を取るものが選ばれます。それによってエージェントの数が数値を超えてしまうときは同じ値を取るものの中からランダムに選ばれます。
;; assume the world is 11 x 11ワールドを11×11と仮定 show max-n-of 5 patches [pxcor] ;; shows 5 patches with pxcor = max-pxcor である5パッチを表示 show max-n-of 5 patches with [pycor = 0] [pxcor] ;; shows an agentset containing: ;; (patch 1 0) (patch 2 0) (patch 3 0) (patch 4 0) (patch 5 0) ;; を含むエージェント集合を表示
See also: max-one-of, with-max もご覧ください。
Reports the agent in the agentset that has the highest value for the given reporter. If there is a tie this command reports one random agent with the highest value. If you want all such agents, use with-max instead.
エージェント集合の中でレポーターの値が最大になるエージェントを返します。複数ある場合はそれらの中から1つをランダムに選んで返します。複数ある場合にすべてのエージェントを得たいのであればwith-maxを代わりに使ってください。
show max-one-of patches [count turtles-here] ;; prints the first patch with the most turtles on it最も多くタートルが位置しているパッチの1つを表示
See also: max-n-of, with-max もご覧ください。
These reporters give the maximum x-coordinate and maximum y-coordinate, (respectively) for patches, which determines the size of the world.
これらのレポーターはパッチのx座標の最大値とy座標の最大値をそれぞれ返します。これらぱワールドの大きさになります。
Unlike in older versions of NetLogo the origin does not have to be at the center of the world. However, the maximum x- and y-coordinates must be greater than or equal to zero.
NetLogoの古いバージョンとは異なり、原点はワールドの中心点になる必要はありません。しかし、x座標の最大値とy座標の最大値は0以上でなければなりません。
Note: You can set the size of the world only by editing the view -- these are reporters which cannot be set.
注意:ワールドの大きさはビューを編集することによってのみ設定することができます。これらは設定することができないレポーターです。
crt 100 [ setxy random-float max-pxcor random-float max-pycor ] ;; distributes 100 turtles randomly in the ;; first quadrant ;; 100個のタートルを第1象限にランダムに配置
See also: min-pxcor, min-pycor, world-width, world-height もご覧ください。
Reports the statistical mean of the numeric items in the given list. Errors on non-numeric items. The mean is the average, i.e., the sum of the items divided by the total number of items.
指定のリストの数値要素の算術平均を返します。すなわち要素の合計を要素数で割ったものです。数値でない要素はエラーになります。
show mean [xcor] of turtles ;; prints the average of all the turtles' x coordinatesすべてのタートルのx座標の平均を表示
Reports the statistical median of the numeric items of the given list. Ignores non-numeric items. The median is the item that would be in the middle if all the items were arranged in order. (If two items would be in the middle, the median is the average of the two.)
指定のリストの数値要素の中央値を返します。数値でない要素は無視されます。中央値とはすべての要素を大きさ順に並べたときに中央に来る要素です。(2つの要素が中央に来る場合は中央値は2つの要素の平均値になります。)
show median [xcor] of turtles ;; prints the median of all the turtles' x coordinatesすべてのタートルのx座標の中央値を表示
For a list, reports true if the given value appears in the given list, otherwise reports false.
リストの場合、指定の値が指定のリストの中に現れるならばtrueを、そうでなければfalseを返します。
For a string, reports true or false depending on whether string1 appears anywhere inside string2 as a substring.
文字列の場合、文字列1が部分文字列として文字列2のどこかに現れるか否かによってtrueまたはfalseを返します。
For an agentset, reports true if the given agent is appears in the given agentset, otherwise reports false.
エージェント集合の場合は、指定のエージェントが指定のエージェント集合の中に現れるならばtrueを、そうでなければfalseを返します。
show member? 2 [1 2 3] => true show member? 4 [1 2 3] => false show member? "bat" "abate" => true show member? turtle 0 turtles => true show member? turtle 0 patches => false
See also: position もご覧ください。
Reports the minimum number value in the list. It ignores other types of items.
リスト中の最小の数値を返します。要素が他のデータ型であれば無視します。
show min [xcor] of turtles ;; prints the lowest x-coordinate of all the turtlesすべてのタートルの中で最小のx座標を表示 show min list a b ;; prints the smaller of the two variables a and b2変数aとbの小さい方を表示 show min (list a b c) ;; prints the smallest of the three variables a, b, and c3変数a,b,cの中で最小のものを表示
Reports an agentset containing number agents from agentset with the lowest values of reporter. The agentset is built by finding all the agents with the lowest value of reporter, if there are not number agents with that value then the agents with the second lowest value are found, and so on. At the end, if there is a tie that would make the resulting agentset too large, the tie is broken randomly.
エージェント集合のうちレポーターの値が小さくなる方から選ばれた数値個のエージェントを含むエージェント集合を返します。エージェント集合にはまずレポーターの値が最小値を取るエージェントが含まれます。エージェントの数が数値に足りないときは2番目の値を取るものが選ばれます。それによってエージェントの数が数値を超えてしまうときは同じ値を取るものの中からランダムに選ばれます。
;; assume the world is 11 x 11ワールドを11×11と仮定 show min-n-of 5 patches [pxcor] ;; shows 5 patches with pxcor = min-pxcor である5パッチを表示 show min-n-of 5 patches with [pycor = 0] [pxcor] ;; shows an agentset containing: ;; (patch -5 0) (patch -4 0) (patch -3 0) (patch -2 0) (patch -1 0) ;; を含むエージェント集合を表示
See also: min-one-of, with-min もご覧ください。
Reports a random agent in the agentset that reports the lowest value for the given reporter. If there is a tie, this command reports one random agent that meets the condition. If you want all such agents use with-min instead.
エージェント集合の中でレポーターの値が最小になるエージェントを返します。複数ある場合はそれらの中から1つをランダムに選んで返します。複数ある場合にすべてのエージェントを得たいのであればwith-minを代わりに使ってください。
show min-one-of turtles [xcor + ycor] ;; reports the first turtle with the smallest sum of ;; coordinates座標の値の合計が最小になるタートルの1つを表示
See also: with-min, min-n-of もご覧ください。
These reporters give the minimum x-coordinate and minimum y-coordinate, (respectively) for patches, which determines the size of the world.
これらのレポーターはパッチのx座標の最小値とy座標の最小値をそれぞれ返します。これらぱワールドの大きさになります。
Unlike in older versions of NetLogo the origin does not have to be at the center of the world. However, the minimum x- and y-coordinates must be less than or equal to zero.
NetLogoの古いバージョンとは異なり、原点はワールドの中心点になる必要はありません。しかし、x座標の最小値とy座標の最小値は0以下でなければなりません。
Note: You can set the size of the world only by editing the view -- these are reporters which cannot be set.
注意:ワールドの大きさはビューを編集することによってのみ設定することができます。これらは設定することができないレポーターです。
crt 100 [ setxy random-float min-pxcor random-float min-pycor ] ;; distributes 100 turtles randomly in the ;; third quadrant ;; 100個のタートルを第3象限にランダムに配置
See also: max-pxcor, max-pycor, world-width, world-height もご覧ください。
Reports number1 modulo number2: that is, the residue of number1 (mod number2). mod is is equivalent to the following NetLogo code:
数値2による数値1のモジュロを返します。すなわち、数値1の余り(mod 数値2)です。modは以下のNetLogoコードと同等です:
number1 - (floor (number1 / number2)) * number2
Note that mod is "infix", that is, it comes between its two inputs.
modは"中置演算子"です。すなわち2つの入力値の間に置かれます。
show 62 mod 5 => 2 show -8 mod 3 => 1
See also remainder. mod and remainder behave the same for positive numbers, but differently for negative numbers.
remainderもご覧ください。modとremainderが返す値は、正数に対しては同じですが負数に対しては異なります。
Reports a list of the most common item or items in list.
リストの中で最も多い要素もしくは複数の要素からなるリストを返します。
The input list may contain any NetLogo values.
NetLogoで扱うあらゆる値を入力値とすることができます。
If the input is an empty list, reports an empty list.
入力値が空のリストのときは空のリストを返します。
show modes [1 2 2 3 4] => [2] show modes [1 2 2 3 3 4] => [2 3] show modes [ [1 2 [3]] [1 2 [3]] [2 3 4] ] => [[1 2 [3]]] show modes [pxcor] of turtles ;; shows which columns of patches have the most ;; turtles on them ;; パッチのどの列に最も多くタートルが乗っているかを表示
Reports true if the mouse button is down, false otherwise.
マウスボタンがdownであればtrueを返し、そうでなければfalseを返します。
Note: If the mouse pointer is outside of the current view, mouse-down? will always report false.
注意:マウスポインターがカレントビューの外側にあるときはmouse-down?は常にfalseを返します。
Reports true if the mouse pointer is inside the current view, false otherwise.
マウスポインターがカレントビューの内側にあればtrueを返し、そうでなければfalseを返します。
Reports the x or y coordinate of the mouse in the 2D view. The value is in terms of turtle coordinates, so it might not be an integer. If you want patch coordinates, use round mouse-xcor and round mouse-ycor.
2Dビューでのマウスのx座標とy座標を返します。この値はタートル座標であるため整数になるとは限りません。パッチ座標を得たいときはround mouse-xcorとround mouse-ycorを使ってください。
Note: If the mouse is outside of the 2D view, reports the value from the last time it was inside.
注意:マウスが2Dビューの外側にある場合は、最後に内側にあったときの値を返します。
;; to make the mouse "draw" in red:マウスの跡を赤くするには: if mouse-down? [ ask patch mouse-xcor mouse-ycor [ set pcolor red ] ]
The turtle sets its x and y coordinates to be the same as the given agent's.
タートルの座標を指定したエージェントと同じ座標に設定します。
(If that agent is a patch, the effect is to move the turtle to the center of that patch.)
(エージェントがパッチであるときは、タートルをパッチの中心に動かします。)
move-to turtle 5 ;; turtle moves to same point as turtle 5タートルがタートル5と同じ場所に移動する move-to one-of patches ;; turtle moves to the center of a random patchタートルがランダムなパッチの中心に移動 move-to max-one-of turtles [size] ;; turtle moves to same point as biggest turtleタートルが最も大きいタートルと同じ地点へ移動
Note that the turtle's heading is unaltered. You may want to use the face command first to orient the turtle in the direction of motion.
タートルの向きは変更されません。移動する方向にタートルを向けるには最初にfaceコマンドを使うと良いでしょう。
See also: setxy もご覧ください。
Cancels the current movie.
実行中の動画をキャンセルします。
Stops the recording of the current movie.
動画の録画を停止します。
Adds an image of the current view (2D or 3D) or the interface panel to the current movie.
実行中の動画にカレントビュー(2Dまたは3D)もしくはインターフェースパネルの画像を追加します。
;; make a 20-step movie of the current viewカレントビューの20ステップ動画を作成 setup movie-start "out.mov" repeat 20 [ movie-grab-view go ] movie-close
Sets the frame rate of the current movie. The frame rate is measured in frames per second. (If you do not explicitly set the frame rate, it defaults to 15 frames per second.)
実行中の動画のフレームレートを設定します。フレームレートは1秒あたりのフレーム数で表されます。(フレームレートを明示的に設定しない場合は、デフォルトでは15フレーム毎秒となります。)
Must be called after movie-start, but before movie-grab-view or movie-grab-interface.
movie-startの後、movie-grab-viewまたはmovie-grab-interfaceの前に呼び出す必要があります。
See also: movie-status もご覧ください。
Creates a new movie. filename specifies a new QuickTime file where the movie will be saved, so it should end with ".mov
".
新しい動画を作成します。ファイル名は動画が保存される新しいQuickTime形式ファイルを表します。ですので".mov
"で終わる必要があります。
See also: movie-grab-view, movie-grab-interface, movie-cancel, movie-status, movie-set-frame-rate, movie-close もご覧ください。
Reports a string describing the current movie.
実行中の動画の状態を文字列で返します。
print movie-status => No movie. movie-start print movie-status => 0 frames; frame rate = 15. movie-grab-view print movie-status 1 frames; frame rate = 15; size = 315x315.
Reports an agentset of all links connected to the caller, regardless of directedness.
実行したタートルと連結しているすべての有向および無向リンクからなるエージェント集合を返します。
crt 5 ask turtle 0 [ create-links-with other turtles show my-links ;; prints the agentset containing all linksすべてのリンクを含むエージェント集合を表示 ;; (since all the links we created were with turtle 0 )(なぜならすべてのリンクはタートル0との間で作成されたものなので) ] ask turtle 1 [ show my-links ;; shows an agentset containing the link 0 1リンク 0 1 を含むエージェント集合を表示 ] end
Reports an agentset of all the directed links coming in from other nodes to the caller.
他のタートルから実行したタートルへ連結しているすべての有向リンクからなるエージェント集合を返します。
crt 5 ask turtle 0 [ create-links-to other turtles show my-in-links ;; shows an empty agentset空のエージェント集合を表示 ] ask turtle 1 [ show my-in-links ;; shows an agentset containing the link 0 1リンク 0 1 を含むエージェント集合を表示 ]
Reports an agentset of all the directed links going out from the caller to other nodes.
実行したタートルから他のタートルへ連結しているすべての有向リンクからなるエージェント集合を返します。
crt 5 ask turtle 0 [ create-links-to other turtles show my-out-links ;; shows agentset containing all the linksすべてのリンクを含むエージェント集合を表示 ] ask turtle 1 [ show my-out-links ;; shows an empty agentset空のエージェント集合を表示 ]
"self" and "myself" are very different. "self" is simple; it means "me". "myself" means "the turtle, patch or link who asked me to do what I'm doing right now."
"self"と"myself"とはまったく違います。"self"は単純であり"自分自身"を意味します。"myself"は"私がいましていることを私にaskしたタートルまたはパッチまたはリンク"を意味します。
When an agent has been asked to run some code, using myself in that code reports the agent (turtle, patch or link) that did the asking.
エージェントが何かコードを実行するようaskされたとき、コードの中でmyselfを使うとaskをしたエージェント(タートルまたはパッチまたはリンク)を返します。
myself is most often used in conjunction with of to read or set variables in the asking agent.
myselfはaskしたエージェントの変数を読むか設定するためにofとの組み合わせで頻繁に用いられます。
myself can be used within blocks of code not just in the ask command, but also hatch, sprout, of, with, all?, with-min, with-max, min-one-of, max-one-of, min-n-of, max-n-of.
myselfはaskコマンドだけでなくhatch, sprout, of, with, all?, with-min, with-max, min-one-of, max-one-of, min-n-of, max-n-ofでもコードブロックの内部で用いられます。
ask turtles [ ask patches in-radius 3 [ set pcolor [color] of myself ] ] ;; each turtle makes a colored "splotch" around itself各タートルが自己の周囲に斑点を作る
See the "Myself Example" code example for more examples.
"Myself Example"コード例にはより多くの例が掲載されています。
See also: self もご覧ください。
From an agentset, reports an agentset of size size randomly chosen from the input set, with no repeats.
エージェント集合の場合は、入力集合から繰り返しなしで選択した個数個からなるエージェント集合を返します。
From a list, reports a list of size size randomly chosen from the input set, with no repeats. The items in the result appear in the same order that they appeared in the input list. (If you want them in random order, use shuffle on the result.)
リストの場合は、入力リストから繰り返しなしで選択した個数個からなるリストを返します。出力の要素は入力と同じ順序で並んでいます。(もしランダムな順序にしたいときは出力をシャッフルしてください。)
It is an error for size to be greater than the size of the input.
個数が入力の個数よりも大きい場合はエラーとなります。
ask n-of 50 patches [ set pcolor green ] ;; 50 randomly chosen patches turn greenランダムに選択された50個のパッチが緑に変わる
See also: one-of もご覧ください。
Reports a list of length size containing values computed by repeatedly running the task.
タスクを繰り返し実行することにより得られる値を含む個数の長さのリストを返します。
If the task accepts inputs, the input will be the number of the item currently being computed, starting from zero.
タスクが入力値を取るときは、入力値はゼロから始まる現在計算対象となっている要素の番号となります。
show n-values 5 [1] => [1 1 1 1 1] show n-values 5 [?] => [0 1 2 3 4] show n-values 3 turtle => [(turtle 0) (turtle 1) (turtle 2)] show n-values 5 [? * ?] => [0 1 4 9 16]
See also: reduce, filter, ? もご覧ください。
Reports an agentset containing the 8 surrounding patches (neighbors) or 4 surrounding patches (neighbors4).
8個の周囲のパッチ(neighborsの場合)もしくは4個の周囲のパッチ(neighbors4の場合)からなるエージェント集合を返します、
show sum [count turtles-here] of neighbors ;; prints the total number of turtles on the eight ;; patches around this turtle or patch ;; 実行したタートルもしくはパッチの周囲8個のパッチにいるタートルの個数の合計を表示 show count turtles-on neighbors ;; a shorter way to say the same thing同じ内容のより短い表現 ask neighbors4 [ set pcolor red ] ;; turns the four neighboring patches red4つの隣接するパッチを赤に変える
Reports the agentset of all turtles found at the other end of undirected links connected to this turtle.
実行したタートルとの間で無向リンクを持つすべてのタートルからなるエージェント集合を返します。
crt 3 ask turtle 0 [ create-links-with other turtles ask link-neighbors [ set color red ] ;; turtles 1 and 2 turn redタートル1とタートル2が赤に変わる ] ask turtle 1 [ ask link-neighbors [ set color blue ] ;; turtle 0 turns blueタートル0が青に変わる ] end
Reports true if there is an undirected link between turtle and the caller.
タートルと実行したタートルとの間に無向リンクがあればtrueを返します。
crt 2 ask turtle 0 [ create-link-with turtle 1 show link-neighbor? turtle 1 ;; prints trueを表示 ] ask turtle 1 [ show link-neighbor? turtle 0 ;; prints trueを表示 ]
Reports true if the model is running as an applet.
モデルがアプレットとして実行されている場合はtrueを返します。
Reports a string containing the version number of the NetLogo you are running.
実行中のNetLogoのバージョン番号を含む文字列を返します。
show netlogo-version => "5.3.1"
Reports true if the model is running in NetLogo Web.
モデルがNetLogo Webで実行中であればtrueを返します。
Reports a number suitable for seeding the random number generator.
乱数生成器のシードとして使うことができる数値を返します。
The numbers reported by new-seed are based on the current date and time in milliseconds and lie in the generator's usable range of seeds, -2147483648 to 2147483647.
new-seedが返す数値は、ミリ秒単位の現在の時刻に基づいており、シードがとりうる-2147483648から2147483647の範囲内となります。
new-seed never reports the same number twice in succession, even across parallel BehaviorSpace runs. (This is accomplished by waiting a millisecond if the seed for the current millisecond was already used.)
new-seedは、パラレルで実行されているBehaviorSpaceの間であっても、2回続けて同じ数値を返すことはありません。(現在のミリ秒が既にシードとして使われているときは1ミリ秒待って処理します。)
See also: random-seed もご覧ください。
Turns off all updates to the current view until the display command is issued. This has two major uses.
displayコマンドが実行されるまでの間、カレントビューのすべての更新を停止します。このコマンドには2つの主要な用途があります。
One, you can control when the user sees view updates. You might want to change lots of things on the view behind the user's back, so to speak, then make them visible to the user all at once.
1つ目は、ユーザーがいつビュー更新を見るかをコントロールできます。ユーザーが見ている背後でいろいろなことを変更したい場合もあるでしょう。そのような場合に変更内容を一度にユーザーに見せることができます。
Two, your model will run faster when view updating is off, so if you're in a hurry, this command will let you get results faster. (Note that normally you don't need to use no-display for this, since you can also use the on/off switch in view control strip to freeze the view.)
2つ目は、ビューの更新頻度が少なければモデルは速く動くということです。急ぐ場合にこのコマンドを使えば結果が早く得られます。(ただしこの目的のためには、ビューを固定するためにビューコントロールバーのon/offスイッチを使うことができますので、通常はno-displayを使う必要はありません。)
Note that display and no-display operate independently of the switch in the view control strip that freezes the view.
displayとno-displayは、ビューを固定するビューコントロールバーのスイッチとは独立に動作します。
See also: display もご覧ください。
This is a special value which some primitives such as turtle, one-of, max-one-of, etc. report to indicate that no agent was found. Also, when a turtle dies, it becomes equal to nobody.
turtle, one-of, max-one-ofなどのプリミティブが、エージェントが何も見つからなかったときに返す特別な値です。また、タートルが死んだときはnobodyと等しくなります。
Note: Empty agentsets are not equal to nobody. If you want to test for an empty agentset, use any?. You only get nobody back in situations where you were expecting a single agent, not a whole agentset.
注意:空のエージェント集合とnobodyとは同等ではありません。エージェント集合が空であるかを確かめたいときはany?を使ってください。レポーターの戻り値がエージェント集合ではなくエージェント単体である場合、エージェントが見つからないときの戻り値は、空のエージェント集合ではなくnobodyとなります。
set target one-of other turtles-here if target != nobody [ ask target [ set color red ] ]
Reports an empty link agentset.
空のリンク集合を返します。
Reports an empty patch agentset.
空のパッチ集合を返します。
Reports true if boolean is false, otherwise reports false.
もし条件がfalseならばtrueを、そうでなければfalseを返します。
if not any? turtles [ crt 10 ]
Reports an empty turtle agentset.
空のタートル集合を返します。
For an agent, reports the value of the reporter for that agent (turtle or patch).
エージェントの場合、そのエージェント(タートルまたはパッチ)のレポーターの値を返します。
show [pxcor] of patch 3 5 ;; prints 3と表示 show [pxcor] of one-of patches ;; prints the value of a random patch's pxcor variableランダムなパッチのpxcor変数の値を表示 show [who * who] of turtle 5 => 25 show [count turtles in-radius 3] of patch 0 0 ;; prints the number of turtles located within a ;; three-patch radius of the origin ;; 原点から半径3以内に位置しているタートルの数を返す
For an agentset, reports a list that contains the value of the reporter for each agent in the agentset (in random order).
エージェント集合の場合、そのエージェント集合に含まれる各エージェントのレポーターの値を(ランダムな順序で)格納するリストを返します。
crt 4 show sort [who] of turtles => [0 1 2 3] show sort [who * who] of turtles => [0 1 4 9]
From an agentset, reports a random agent. If the agentset is empty, reports nobody.
エージェント集合の場合、どれか1個のエージェントをランダムに返します。エージェント集合が空の場合はnobodyを返します。
From a list, reports a random list item. It is an error for the list to be empty.
リストの場合、どれか1個の要素をランダムに返します。リストが空の場合はエラーになります。
ask one-of patches [ set pcolor green ] ;; a random patch turns greenどれか1個のパッチが緑に変わる ask patches with [any? turtles-here] [ show one-of turtles-here ] ;; for each patch containing turtles, prints one of ;; those turtles ;; タートルを乗せている各パッチが、その中からどれか1個のタートルを表示 ;; suppose mylist is [1 2 3 4 5 6]mylistが [1 2 3 4 5 6] であると仮定 show one-of mylist ;; prints a value randomly chosen from the listリストからランダムに選んだ1個の値を表示
See also: n-of もご覧ください。
Reports true if either boolean1 or boolean2, or both, is true.
条件1と条件2のどちらか一方もしくは両方がtrueであればtrueを返します。
Note that if condition1 is true, then condition2 will not be run (since it can't affect the result).
条件1がfalseであれば条件2はテストされません(結果には影響しないためです)。
if (pxcor > 0) or (pycor > 0) [ set pcolor red ] ;; patches turn red except in lower-left quadrant左下の象限を除くパッチが赤く変わる
Reports an agentset which is the same as the input agentset but omits this agent.
指定のエージェント集合から実行したエージェントを除いたエージェント集合を返します。
show count turtles-here => 10 show count other turtles-here => 9
If run by a turtle, reports the turtle at the other end of the asking link.
タートルが実行する場合は、askするリンクの他の端にいるタートルを返します。
If run by a link, reports the turtle at the end of the link that isn't the asking turtle.
リンクが実行する場合は、askするタートルではない方の端にいるタートルを返します。
These definitions are difficult to understand in the abstract, but the following examples should help:
この要約は理解するのが難しいですが、下記の例を見れば理解できるでしょう:
ask turtle 0 [ create-link-with turtle 1 ] ask turtle 0 [ ask link 0 1 [ show other-end ] ] ;; prints turtle 1タートル1を表示 ask turtle 1 [ ask link 0 1 [ show other-end ] ] ;; prints turtle 0タートル0を表示 ask link 0 1 [ ask turtle 0 [ show other-end ] ] ;; prints turtle 1タートル1を表示
As these examples hopefully make plain, the "other" end is the end that is neither asking nor being asked.
上記の例から明らかなように、"other-end"とはaskもしないしaskされもしない端のことです。
Reports true if there is a directed link going from the caller to turtle.
タートルに向けて実行したタートルからの有向リンクがあればtrueを返します。
crt 2 ask turtle 0 [ create-link-to turtle 1 show in-link-neighbor? turtle 1 ;; prints falseを表示 show out-link-neighbor? turtle 1 ;; prints trueを表示 ] ask turtle 1 [ show in-link-neighbor? turtle 0 ;; prints trueを表示 show out-link-neighbor? turtle 0 ;; prints falseを表示 ]
Reports the agentset of all the turtles that have directed links from the caller.
実行したタートルからの有向リンクを持つすべてのタートルからなるエージェント集合を返します。
crt 4 ask turtle 0 [ create-links-to other turtles ask out-link-neighbors [ set color pink ] ;; turtles 1-3 turn pinkタートル1から3がピンクに変わる ] ask turtle 1 [ ask out-link-neighbors [ set color orange ] ;; no turtles change colors ;; since turtle 1 only has in-linksタートル1にはin-linkしかないのでどのタートルの色も変わらない ] end
Reports the directed link from the caller to turtle. If no link exists then it reports nobody.
実行したタートルからタートルへの有向リンクを返します。リンクが存在しないときはnobodyを返します。
crt 2 ask turtle 0 [ create-link-to turtle 1 show out-link-to turtle 1 ;; shows link 0 1リンク 0 1 を表示 ] ask turtle 1 [ show out-link-to turtle 0 ;; shows nobodyを表示 ]
See also: in-link-from, link-with もご覧ください。
These commands are the same as the print, show, type, and write commands except that value is printed in the model's output area, instead of in the Command Center. (If the model does not have a separate output area, then the Command Center is used.)
これらのコマンドは、値がコマンドセンターではなくモデルの出力領域に出力される点以外は、print, show, type, writeの各コマンドと同じです。(モデルに独立した出力領域がない場合はコマンドセンターが使われます。)
Given the x and y coordinates of a point, reports the patch containing that point. (The coordinates are absolute coordinates; they are not computed relative to this agent, as with patch-at.)
点のx座標とy座標を指定すれば、その点を含むパッチを返します。(座標は絶対座標です。patch-atのように実行したエージェントからの相対座標が計算されるわけではありません。)
If x and y are integers, the point is the center of a patch. If x or y is not an integer, rounding to the nearest integer is used to determine which patch contains the point.
xとyが整数であるときは、点はパッチの中心になります。xかyが整数ではないときは、点がどのパッチに含まれるかを決めるために最も近い整数に四捨五入されます。
If wrapping is allowed by the topology, the given coordinates will be wrapped to be within the world. If wrapping is not allowed and the given coordinates are outside the world, reports nobody.
位相に循環が適用されている場合は、指定の座標はワールドの内部になるように丸められます。循環が適用されておらず、指定の座標がワールドの外側になってしまう場合は、nobodyを返します。
ask patch 3 -4 [ set pcolor green ] ;; patch with pxcor of 3 and pycor of -4 turns green show patch 1.2 3.7 ;; prints (patch 1 4); note rounding show patch 18 19 ;; supposing min-pxcor and min-pycor are -17 ;; and max-pxcor and max-pycor are 17, ;; in a wrapping topology, prints (patch -17 -16); ;; in a non-wrapping topology, prints nobody
ask patch 3 -4 [ set pcolor green ] ;; pxcorが3でpycorが-4のパッチが緑に変わる show patch 1.2 3.7 ;; (パッチ 1 4) を表示する; 四捨五入があることに注意 show patch 18 19 ;; min-pxcorとmin-pycorが-17、max-pxcorとmax-pycorが17と仮定すると、 ;; 循環が適用されている場合は (パッチ -17 -16) を表示 ;; 循環が適用されていない場合は nobody を表示
See also: patch-at もご覧ください。
Reports the single patch that is the given distance "ahead" of this turtle, that is, along the turtle's current heading. Reports nobody if the patch does not exist because it is outside the world.
タートルの"前方"、すなわちタートルの現在の向きの方向の指定の距離にある1個のパッチを返します。ワールドの外側になるためにパッチが存在しない場合はnobodyを返します。
ask patch-ahead 1 [ set pcolor green ] ;; turns the patch 1 in front of this turtle ;; green; note that this might be the same patch ;; the turtle is standing on ;; タートルから1前方にあるパッチが緑に変わる ;; タートルが乗っているのと同じパッチになりうることに注意
See also: patch-at, patch-left-and-ahead, patch-right-and-ahead, patch-at-heading-and-distance もご覧ください。
Reports the patch at (dx, dy) from the caller, that is, the patch containing the point dx east and dy patches north of this agent.
実行したエージェントから (dx, dy) の相対位置にあるパッチ、すなわち、実行したエージェントからdxだけ東でdyだけ北の地点を含むパッチを返します。
Reports nobody if there is no such patch because that point is beyond a non-wrapping world boundary.
指定したパッチがワールドの循環のない境界を越えた先になってしまうときはnobodyを返します。
ask patch-at 1 -1 [ set pcolor green ] ;; if caller is a turtle or patch, turns the ;; patch just southeast of the caller green ;; 実行したエージェントの南東側で隣接するパッチを緑に変える
See also: patch, patch-ahead, patch-left-and-ahead, patch-right-and-ahead, patch-at-heading-and-distance もご覧ください。
patch-at-heading-and-distance reports the single patch that is the given distance from this turtle or patch, along the given absolute heading. (In contrast to patch-left-and-ahead and patch-right-and-ahead, this turtle's current heading is not taken into account.) Reports nobody if the patch does not exist because it is outside the world.
実行したタートルもしくはパッチから指定の向きおよび距離にある単一のパッチを返します。(patch-left-and-aheadやpatch-right-and-aheadとは異なり、実行したタートルの現時点での向きは考慮されません。)ワールドの外側になってしまうためにパッチが存在しない場合はnobodyを返します。
ask patch-at-heading-and-distance -90 1 [ set pcolor green ] ;; turns the patch 1 to the west of this patch green ;; 実行したパッチから西の方向に距離1にあるパッチが緑に変わる
See also: patch, patch-at, patch-left-and-ahead, patch-right-and-ahead もご覧ください。
patch-here reports the patch under the turtle.
実行したタートルが位置しているパッチを返します。
Note that this reporter isn't available to a patch because a patch can just say "self".
このレポーターはパッチは使うことができません。パッチが使えるのは"self"です。
Reports the single patch that is the given distance from this turtle, in the direction turned left or right the given angle (in degrees) from the turtle's current heading. Reports nobody if the patch does not exist because it is outside the world.
実行したタートルから指定の距離で、タートルの現在の向きから左もしくは右方向に指定の角度だけ向きを変えた位置にある単一のパッチを返します。ワールドの外側になってしまうためにパッチが存在しない場合はnobodyを返します。
(If you want to find a patch in a given absolute heading, rather than one relative to the current turtle's heading, use patch-at-heading-and-distance instead.)
(現在のタートルの向きには関係しない、絶対的な方向にあるパッチを選択したいのであれば、代わりにpatch-at-heading-and-distanceを使ってください。)
ask patch-right-and-ahead 30 1 [ set pcolor green ] ;; this turtle "looks" 30 degrees right of its ;; current heading at the patch 1 unit away, and turns ;; that patch green; note that this might be the same ;; patch the turtle is standing on ;; 実行したタートルが現在の向きの30度右で1単位前方にあるパッチを見つけ、 ;; そのパッチを緑に変える。タートルが乗っているのと同じパッチになりうることに注意
See also: patch, patch-at, patch-at-heading-and-distance もご覧ください。
Reports an agentset containing all of the patches anywhere in any of the inputs. The inputs may be individual patches, patch agentsets, nobody, or lists (or nested lists) containing any of the above.
入力値に含まれるすべてのパッチからなるエージェント集合を返します。入力値は個々のパッチ、パッチ集合、nobody、もしくはこれらのいずれかを含むリスト(またはネストされたリスト)のいずれを取ることもできます。
patch-set self patch-set patch-here (patch-set self neighbors) (patch-set patch-here neighbors) (patch-set patch 0 0 patch 1 3 patch 4 -2) (patch-set patch-at -1 1 patch-at 0 1 patch-at 1 1) patch-set [patch-here] of turtles patch-set [neighbors] of turtles
See also: turtle-set, link-set もご覧ください。
Reports the size of the patches in the view in pixels. The size is typically an integer, but may also be a floating point number.
ビューの中のパッチの大きさをピクセル数で返します。大きさは通常は整数ですが浮動小数点数とすることもできます。
See also: set-patch-size もご覧ください。
Reports the agentset consisting of all patches.
すべてのパッチからなるエージェント集合を返します。
This keyword, like the globals, breed, <breed>-own, and turtles-own keywords, can only be used at the beginning of a program, before any function definitions. It defines the variables that all patches can use.
globals, breed, directed-link-breed, undirected-link-breed, patches-own, turtles-own, links-own, <品種集合>-ownの各予約語は、プロシージャ定義よりも前のコードタブの先頭においてのみ使用することができます。patches-ownはすべてのパッチが使うことができる変数を定義します。
All patches will then have the given variables and be able to use them.
すべてのパッチが指定の変数を持つようになり、使えるようになります。
All patch variables can also be directly accessed by any turtle standing on the patch.
パッチ上にいるタートルはすべてのパッチ変数に直接アクセスすることができます。
See also: globals, turtles-own, breed, <breeds>-own もご覧ください。
This is a built-in patch variable. It holds the color of the patch. You can set this variable to make the patch change color.
組み込みのパッチ変数です。パッチの色を保有します。変数値を設定すればパッチの色を変えられます。
All patch variables can be directly accessed by any turtle standing on the patch. Color can be represented either as a NetLogo color (a single number) or an RGB color (a list of 3 numbers). See details in the Colors section of the Programming Guide.
パッチ上にいるタートルはすべてのパッチ変数に直接アクセスすることができます。色はNetLogo色空間(数値1個)かRGB色空間(数値3個)で表されます。詳細はプログラミングガイドの「色」節をご覧ください。
See also: color もご覧ください。
The turtle changes modes between drawing lines, removing lines or neither. The lines will always be displayed on top of the patches and below the turtles. To change the color of the pen set the color of the turtle using set color.
タートルが、線を描く、線を消す、何もしない、のいずれかにモードを変更します。線は常にパッチよりも上でタートルよりも下に表示されます。ペンの色を変えるにはset colorを使ってタートルの色を設定してください。
Note: When a turtle's pen is down, all movement commands cause lines to be drawn, including jump, setxy, and move-to.
注意:タートルのペンがdownであるときは、jump, setxy, move-toを含むすべての移動コマンドにおいて線が描かれます。
Note: These commands are equivalent to setting the turtle variable "pen-mode" to "down" , "up", and "erase".
注意:これらのコマンドはタートル変数"pen-mode"を"down", "up", "erase"に設定するのと同等です。
Note: On Windows drawing and erasing a line might not erase every pixel.
注意:Windowsでは線を描いたり消したりしてもピクセル単位で消されるわけではありません。
This is a built-in turtle variable. It holds the state of the turtle's pen. You set the variable to draw lines, erase lines or stop either of these actions. Possible values are "up", "down", and "erase".
組み込みのタートル変数です。タートルのペンの状態を保有します。変数を設定することで線を引いたり、線を消したり、これらの行動を停止させたりすることができます。変数値は"up", "down", "erase"のいずれかになります。
This is a built-in turtle variable. It holds the width of the line, in pixels, that the turtle will draw (or erase) when the pen is down (or erasing).
組み込みのタートル変数です。pen-downもしくはpen-eraseのときにタートルが描く(もしくは消す)線の太さをピクセル単位で保有します。
This is a built-in patch variable. It may hold a value of any type. The patch appears in the view with the given value "attached" to it as text. You can set this variable to add, change, or remove a patch's label.
組み込みのパッチ変数です。どのような種類の値でも保有することができます。パッチはこの値をテキストとして伴った形でビューに表示されます。この変数を設定することでパッチのラベルを追加、変更、削除することができます。
All patch variables can be directly accessed by any turtle standing on the patch.
パッチ上にいるタートルはすべてのパッチ変数に直接アクセスすることができます。
See also: plabel-color, label, label-color もご覧ください。
This is a built-in patch variable. It holds a number greater than or equal to 0 and less than 140. This number determines what color the patch's label appears in (if it has a label). You can set this variable to change the color of a patch's label.
組み込みのパッチ変数です。0以上140未満の数値を保有します。この数値はパッチのラベルの色(もしそれらにラベルがあれば)を決定します。この変数値を設定することでパッチのラベルの色を変更することができます。
All patch variables can be directly accessed by any turtle standing on the patch.
パッチ上にいるタートルはすべてのパッチ変数に直接アクセスすることができます。
See also: plabel, label, label-color もご覧ください。
Increments the x-value of the plot pen by plot-pen-interval, then plots a point at the updated x-value and a y-value of number. (The first time the command is used on a plot, the point plotted has an x-value of 0.)
プロットペンのxの値をplot-pen-intervalの間隔で増加させ、数値の更新されたxの値とyの値の点にプロットします。(プロットでこのコマンドが最初に使われるときは、プロットされる点のx値は0となります。)
Reports the name of the current plot (a string)
カレントプロットの名前を文字列で返します。
Reports true if a plot pen with the given name is defined in the current plot. Otherwise reports false.
カレントプロットで指定の名前のプロットペンが定義されていればtrueを、そうでなければfalseを返します。
Puts down (or up) the current plot-pen, so that it draws (or doesn't). (By default, all pens are down initially.)
カレントプロットペンをdown(もしくはup)に設定して、描画する(または描画しない)ようにします。(デフォルトではすべてのペンは最初はdownになります。)
Clears everything the current plot pen has drawn, moves it to (0,0), and puts it down. If the pen is a permanent pen, the color, mode, and interval are reset to the default values from the plot Edit dialog.
カレントプロットペンが描いたすべてのものをクリアし、カレントプロットペンを(0,0)に移動し、downに設定します。ペンが恒久ペンであるときは、色とモードと間隔はプロットのEditダイアログからデフォルト値にリセットされます。
Moves the current plot pen to the point with coordinates (number1, number2). If the pen is down, a line, bar, or point will be drawn (depending on the pen's mode).
カレントプロットペンを(数値1, 数値2)の座標点に移動させます。ペンがdownであるときは、線、棒、もしくは点が描かれます(ペンのモードによります)。
Reports the minimum or maximum value on the x or y axis of the current plot.
カレントプロットのx軸またはy軸の最大値または最小値を返します。
These values can be set with the commands set-plot-x-range and set-plot-y-range. (Their default values are set from the plot Edit dialog.)
これらの値はset-plot-x-rangeとset-plot-y-rangeコマンドで設定することができます。(これらのデフォルト値はプロットのEditダイアログで設定されます。)
On a list, reports the first position of item in list, or false if it does not appear.
リストの場合、リストの中で要素が現れる最初の位置を返し、要素が含まれない場合はfalseを返します。
On strings, reports the position of the first appearance string1 as a substring of string2, or false if it does not appear.
文字列の場合、文字列2の中で文字列1が部分文字列として現れる最初の位置を返し、文字列1が含まれない場合はfalseを返します。
Note: The positions are numbered beginning with 0, not with 1.
位置の数値は1からではなく0から始まります。
;; suppose mylist is [2 7 4 7 "Bob"]mylistを [2 7 4 7 "Bob"] と仮定 show position 7 mylist => 1 show position 10 mylist => false show position "in" "string" => 3
See also: member? もご覧ください。
Reports number rounded to places decimal places.
数値を位置の小数点以下の桁数で四捨五入した結果を返します。
If places is negative, the rounding takes place to the left of the decimal point.
位置が負数のときは、小数点の左側で四捨五入を行います。
show precision 1.23456789 3 => 1.235 show precision 3834 -3 => 4000
See also: round, ceiling, floor もご覧ください。
Prints value in the Command Center, followed by a carriage return.
コマンドセンターに、値、改行記号の順で出力します。
This agent is not printed before the value, unlike show.
showとは異なり、実行したエージェントは値の前に表示されません。
See also: show, type, write, output-print もご覧ください。
These are built-in patch variables. They hold the x and y coordinate of the patch. They are always integers. You cannot set these variables, because patches don't move.
組み込みのパッチ変数です。パッチのx座標とy座標を保有します。これらは常に整数となります。パッチは動きませんので、これらの値を設定することはできません。
pxcor is greater than or equal to min-pxcor and less than or equal to max-pxcor; similarly for pycor and min-pycor and max-pycor.
pxcorはmin-pxcor以上max-pxcor以下の範囲、pycorはmin-pycor以上max-pycor以下の範囲となります。
All patch variables can be directly accessed by any turtle standing on the patch.
パッチ上にいるタートルはすべてのパッチ変数に直接アクセスすることができます。
If number is positive, reports a random integer greater than or equal to 0, but strictly less than number.
数値が正のときは、0以上で数値未満のランダムな整数を返します。
If number is negative, reports a random integer less than or equal to 0, but strictly greater than number.
数値が負のときは、0以下で数値よりも大きいランダムな整数を返します。
If number is zero, the result is always 0 as well.
数値が0のときは常に0を返します。
Note: In versions of NetLogo prior to version 2.0, this primitive reported a floating point number if given a non-integer input. This is no longer the case. If you want a floating point answer, you must now use random-float instead.
注意:NetLogo 2.0以前のバージョンでは、このプリミティブは整数でない入力値を指定したときは浮動小数点数を返していましたが、現在のバージョンではそのような動作はしません。浮動小数点数を得たいときは代わりにrandom-floatを使う必要があります。
show random 3 ;; prints 0, 1, or 2 show random -3 ;; prints 0, -1, or -2 show random 3.5 ;; prints 0, 1, 2, or 3
show random 3 ;; 0, 1, 2 のいずれかを表示 show random -3 ;; 0, -1, -2 のいずれかを表示 show random 3.5 ;; 0, 1, 2, 3 のいずれかを表示
See also: random-float もご覧ください。
If number is positive, reports a random floating point number greater than or equal to 0 but strictly less than number.
数値が正のときは、0以上で数値未満のランダムな浮動小数点数を返します。
If number is negative, reports a random floating point number less than or equal to 0, but strictly greater than number.
数値が負のときは、0以下で数値よりも大きいランダムな浮動小数点数を返します。
If number is zero, the result is always 0.
数値が0のときは常に0を返します。
show random-float 3 ;; prints a number at least 0 but less than 3, ;; for example 0以上3未満の数値を表示 例えば2.589444906014774 show random-float 2.5 ;; prints a number at least 0 but less than 2.5, ;; for example 0以上2.5未満の数値を表示 例えば1.0897423196760796
Reports an accordingly distributed random number with the mean and, in the case of the normal distribution, the standard-deviation. (The standard deviation may not be negative.)
平均値と、正規分布の場合は標準偏差に従う分布の乱数値を返します。(標準偏差は負数を取ることはできません。)
random-exponential reports an exponentially distributed random floating point number. It is equivalent to (- mean) * ln random-float 1.0.
random-exponentialは指数分布に従う浮動小数点数の乱数値を返します。これは(- mean) * ln random-float 1.0と等しくなります。
random-gamma reports a gamma-distributed random floating point number as controlled by the floating point alpha and lambda parameters. Both inputs must be greater than zero. (Note: for results with a given mean and variance, use inputs as follows: alpha = mean * mean / variance; lambda = 1 / (variance / mean).)
random-gammaは浮動小数点数のパラメータαとλによって規定されるガンマ分布に従う浮動小数点数の乱数値を返します。両方の入力値は0より大きくなければなりません。(算術平均と分散がわかっているときは次の入力値を使います:α = 算術平均×算術平均 / 分散、λ = 1 / (分散 / 算術平均) 。)
random-normal reports a normally distributed random floating point number.
random-normalは正規分布に従う浮動小数点数を返します。
random-poisson reports a Poisson-distributed random integer.
random-poissonはポワソン分布に従う整数を返します。
show random-exponential 2 ;; prints an exponentially distributed random floating ;; point number with a mean of 2算術平均2で指数分布に従う浮動小数点数の乱数を表示 show random-normal 10.1 5.2 ;; prints a normally distributed random floating point ;; number with a mean of 10.1 and a standard deviation ;; of 5.2算術平均10.1、標準偏差5.2で正規分布に従う ;; 浮動小数点数の乱数を表示 show random-poisson 3.4 ;; prints a Poisson-distributed random integer with a ;; mean of 3.4算術平均3.4でポワソン分布に従う整数の乱数を表示
Reports a random integer ranging from min-pxcor (or -y) to max-pxcor (or -y) inclusive.
min-pxcor(またはmin-pycor)からmax-pxcor(またはmax-pycor)までの間でそれらの数自身を含むランダムな整数を返します。
ask turtles [ ;; move each turtle to the center of a random patch各タートルがランダムなパッチの中心に移動 setxy random-pxcor random-pycor ]
See also: random-xcor, random-ycor もご覧ください。
Sets the seed of the pseudo-random number generator to the integer part of number. The seed must be in the range -2147483648 to 2147483647; note that this is smaller than the full range of integers supported by NetLogo (-9007199254740992 to 9007199254740992).
疑似乱数生成器のシードを数値の整数部分に設定します。シードは-2147483648から2147483647の間でなければなりません。この範囲はNetLogoがサポートするすべての整数の範囲(-9007199254740992から9007199254740992まで)よりも狭くなります。
See the Random Numbers section of the Programming Guide for more details.
詳細はプログラミングガイドの「乱数」節をご覧ください。
random-seed 47822 show random 100 => 50 show random 100 => 35 random-seed 47822 show random 100 => 50 show random 100 => 35
Reports a random floating point number from the allowable range of turtle coordinates along the given axis, x or y.
指定のx軸もしくはy軸に沿ったタートル座標が取りうる範囲からランダムな浮動小数点数を返します。
Turtle coordinates range from min-pxcor - 0.5 (inclusive) to max-pxcor + 0.5 (exclusive) horizontally; vertically, substitute -y for -x.
タートル座標は水平方向では min-pxcor - 0.5(その数自身を含む)から max-pxcor + 0.5 (その数自身を含まない)までです。垂直方向では-xを-yに置き換えます。
ask turtles [ ;; move each turtle to a random point各タートルがランダムな点に移動 setxy random-xcor random-ycor ]
See also: random-pxcor, random-pycor もご覧ください。
Interprets the given string as if it had been typed in the Command Center, and reports the resulting value. The result may be a number, list, string, or boolean value, or the special value "nobody".
指定の文字列をコマンドセンターでタイプされたものとみなして解釈し、結果を返します。結果は数値、リスト、文字列、boolean値、もしくは "nobody" になりえます。
Useful in conjunction with the user-input primitive for converting the user's input into usable form.
ユーザーのインプットを利用可能な書式に変換するにはuser-inputとあわせて使用すると有用です。
show read-from-string "3" + read-from-string "5" => 8 show length read-from-string "[1 2 3]" => 3 crt read-from-string user-input "Make how many turtles?" ;; the number of turtles input by the user ;; are createdユーザーが入力した個数のタートルが作成される
Reduces a list from left to right using the given task, resulting in a single value. This means, for example, that reduce [?1 + ?2] [1 2 3 4] is equivalent to (((1 + 2) + 3) + 4). If list has a single item, that item is reported. It is an error to reduce an empty list.
指定のタスクを使って、左から右へとリストを減らしていき、単一の値を得ます。例えばreduce [?1 + ?2] [1 2 3 4]は(((1 + 2) + 3) + 4)と等しくなります。もしリストの要素が1個であるときはその要素を返します。空のリストをreduceしようとするとエラーとなります。
The first input passed to the task is the result so far, and the second input is the next item in the list.
タスクへ渡される第1入力値はこれまでの段階での結果であり、第2入力値はリストでの次の要素となります。
Since it can be difficult to develop an intuition about what reduce does, here are some simple examples which, while not useful in themselves, may give you a better understanding of this primitive:
reduceが行う内容について直感的に理解するのは難しいため、それ自身では有用ではないものの、このプリミティブをよく理解できる例を示します:
show reduce + [1 2 3] => 6 show reduce - [1 2 3] => -4 show reduce [?2 - ?1] [1 2 3] => 2 show reduce [?1] [1 2 3] => 1 show reduce [?2] [1 2 3] => 3 show reduce sentence [[1 2] [3 [4]] 5] => [1 2 3 [4] 5] show reduce [fput ?2 ?1] (fput [] [1 2 3 4 5]) => [5 4 3 2 1]
Here are some more useful examples:
以下はより有用な例です:
;; find the longest string in a listリストで最も長い文字列を見つけます to-report longest-string [strings] report reduce [ifelse-value (length ?1 >= length ?2) [?1] [?2]] strings end show longest-string ["hi" "there" "!"] => "there" ;; count the number of occurrences of an item in a listリスト中でのある要素の出現数を数えます to-report occurrences [x the-list] report reduce [ifelse-value (?2 = x) [?1 + 1] [?1]] (fput 0 the-list) end show occurrences 1 [1 2 1 3 1 2 3 1 1 4 5 1] => 6 ;; evaluate the polynomial, with given coefficients, at xxに係る指定の係数のもとでの多項式を計算します to-report evaluate-polynomial [coefficients x] report reduce [(x * ?1) + ?2] coefficients end ;; evaluate 3x^2 + 2x + 1 at x = 4x = 4 のときの 3x^2 + 2x + 1 を計算します show evaluate-polynomial [3 2 1] 4 => 57
Reports the remainder when number1 is divided by number2. This is equivalent to the following NetLogo code:
数値1を数値2で割った剰余を返します。これは以下のNetLogoコードと同等です:
number1 - (int (number1 / number2)) * number2
show remainder 62 5 => 2 show remainder -8 3 => -2
See also mod. mod and remainder behave the same for positive numbers, but differently for negative numbers.
modもご覧ください。modとremainderが返す値は、正数に対しては同じですが負数に対しては異なります。
For a list, reports a copy of list with all instances of item removed.
リストの場合、リストから要素と同じ値の要素をすべて取り除いたコピーを返します。
For strings, reports a copy of string2 with all the appearances of string1 as a substring removed.
文字列の場合、文字列2から文字列1と同じ文字列をすべて取り除いたコピーを返します。
set mylist [2 7 4 7 "Bob"] set mylist remove 7 mylist ;; mylist is now [2 4 "Bob"]mylistは [2 4 "Bob"] となった show remove "to" "phototonic" => "phonic"
Reports a copy of list with all duplicate items removed. The first of each item remains in place.
リストから重複する要素を取り除いたコピーを返します。重複する要素のうち最初に出てくる要素はその場に残されます。
set mylist [2 7 4 7 "Bob" 7] set mylist remove-duplicates mylist ;; mylist is now [2 7 4 "Bob"]mylistは [2 7 4 "Bob"] となった
For a list, reports a copy of list with the item at the given index removed.
リストの場合、リストから指定の番号の要素を取り除いたコピーを返します。
For strings, reports a copy of string2 with the character at the given index removed.
文字列の場合、文字列から指定の番号の文字を取り除いたコピーを返します。
Note that the indices begin from 0, not 1. (The first item is item 0, the second item is item 1, and so on.)
番号の数値は1からではなく0から始まります。(最初の要素が要素0、2番目の要素が要素1というようになります。)
set mylist [2 7 4 7 "Bob"] set mylist remove-item 2 mylist ;; mylist is now [2 7 7 "Bob"]mylistは [2 7 7 "Bob"] となった show remove-item 2 "string" => "sting"
Runs commands number times.
コマンドを数値回実行します。
pd repeat 36 [ fd 1 rt 10 ] ;; the turtle draws a circleタートルが円を描く
On a list, replaces an item in that list. index is the index of the item to be replaced, starting with 0. (The 6th item in a list would have an index of 5.) Note that "replace-item" is used in conjunction with "set" to change a list.
リストの場合、リストの中の要素を入れ替えます。番号は入れ替える要素の要素番号であり、0から始まります。(リストの6番目の要素は5番となります。)リストを変更するには"replace-item"と"set"を合わせて使います。
Likewise for a string, but the given character of string1 removed and the contents of string2 spliced in instead.
文字列でも同様に、文字列1の指定の文字が取り除かれ、文字列2の内容が代わりに入ります。
show replace-item 2 [2 7 4 5] 15 => [2 7 15 5] show replace-item 1 "cat" "are" => "caret"
Immediately exits from the current to-report procedure and reports value as the result of that procedure. report and to-report are always used in conjunction with each other. See to-report for a discussion of how to use them.
カレントのto-reportプロシージャから直ちに抜け出し、そのプロシージャの結果として値を返します。reportとto-reportは常に互いに組み合わせて使われます。これらをどう使うかの説明はto-reportをご覧ください。
The observer stops watching, following, or riding any turtles (or patches). (If it wasn't watching, following, or riding anybody, nothing happens.) In the 3D view, the observer also returns to its default position (above the origin, looking straight down).
オブザーバーがタートル(もしくはパッチ)にwatch, follow, もしくはrideするのを停止します。(もしwatch, follow, もしくはrideしていないときは何も起きません。)3Dビューでは、オブザーバーはデフォルトの位置に戻ります(原点の上で直下を見ている状態です)。
See also: follow, ride, watch もご覧ください。
Resets the tick counter to zero, sets up all plots, then updates all plots (so that the initial state of the world is plotted).
ティックカウンターをゼロに再設定し、すべてのプロットを設定し、すべてのプロットを(ワールドの初期状態がプロットされるように)更新します。
Normally reset-ticks goes at the end of a setup procedure.
通常はreset-ticksはセットアッププロシージャの最後に置かれます。
See also: clear-ticks, tick, ticks, tick-advance, setup-plots, update-plots もご覧ください。
Resets the timer to zero seconds. See also timer.
タイマーをリセットしてゼロ秒にします。timerもご覧ください。
Note that the timer is different from the tick counter. The timer measures elapsed real time in seconds; the tick counter measures elapsed model time in ticks.
タイマーとティックカウンターとは異なります。タイマーは経過した実時間を秒単位で計測し、ティックカウンターはモデル上の時間をティック単位で計測します。
Changes the size of the patch grid.
パッチグリッドの大きさを変更します。
As a side effect, all turtles and links die, and the existing patch grid is discarded and new patches created.
副作用として、すべてのタートルとリンクが死に、既存のパッチグリッドは放棄され新しいパッチが作成されます。
Retaining references to old patches or patch sets is inadvisable and may subsequently cause runtime errors or other unexpected behavior.
古いパッチやパッチ集合への参照を維持しようとすると、ランタイムエラーや他の予測不能な動作の原因になるおそれがあります。
See also: set-patch-size もご覧ください。
Reports a reversed copy of the given list or string.
指定のリストまたは文字列を逆にしたコピーを返します。
show mylist ;; mylist is は[2 7 4 "Bob"] set mylist reverse mylist ;; mylist now is は現在["Bob" 4 7 2] show reverse "live" => "evil"
Reports a RGB list when given three numbers describing an RGB color. The numbers are range checked to be between 0 and 255.
指定の3つの数字がRGB色を表すときにRGBリストを返します。数値は0から255の範囲であるかチェックされます。
See also: hsb もご覧ください。
Set the perspective to turtle.
タートルに視点を設定します。
Every time turtle moves the observer also moves. Thus, in the 2D View the turtle will stay at the center of the view. In the 3D view it is as if looking through the eyes of the turtle. If the turtle dies, the perspective resets to the default.
タートルが動いたときはオブザーバーもまた動きます。このため、2Dビューではタートルは視野の中心点にとどまります。3Dビューではあたかもタートルの目を通して見ているように見えます。タートルが死ねば視点はデフォルトに戻ります。
See also: reset-perspective, watch, follow, subject もご覧ください。
Asks the observer to ride this turtle.
オブザーバーに実行したエージェントへrideさせます。
See also: See also ride もご覧ください。
The turtle turns right by number degrees. (If number is negative, it turns left.)
タートルが数値度右に向きを変えます。(数値が負数のときは左に向きを変えます。)
Reports the integer nearest to number.
数値に最も近い整数を返します(四捨五入します)。
If the decimal portion of number is exactly .5, the number is rounded in the positive direction.
数値の小数部分が正確に0.5である場合は、数値は正の方向に丸められます。
Note that rounding in the positive direction is not always how rounding is done in other software programs. (In particular, it does not match the behavior of StarLogoT, which always rounded numbers ending in 0.5 to the nearest even integer.) The rationale for this behavior is that it matches how turtle coordinates relate to patch coordinates in NetLogo. For example, if a turtle's xcor is -4.5, then it is on the boundary between a patch whose pxcor is -4 and a patch whose pxcor is -5, but the turtle must be considered to be in one patch or the other, so the turtle is considered to be in the patch whose pxcor is -4, because we round towards the positive numbers.
正の方向への四捨五入は他のソフトウェアで行われる四捨五入とは必ずしも同じではありません。(特に、小数部分が0.5であるときは最も近い偶数に丸めるStarLogoTの結果とは合致しません。)NetLogoでこのように扱う理由はタートル座標とパッチ座標との関係にあります。たとえば、タートルのx座標が-4.5であるとき、タートルはpxcorが-4のパッチとpxcorが-5のパッチの境界上にありますが、どちらかのパッチ上にあるものとしなければなりません。数値は正の方向に丸められますので、タートルはpxcorが-4のパッチ上にあるものと判定されます。
show round 4.2 => 4 show round 4.5 => 5 show round -4.5 => -4
See also: precision, ceiling, floor もご覧ください。
The run form expects a command task or a string containing commands. This agent then runs them.
runの形のときは、コマンドタスクかコマンドを含む文字列を指定します。呼び出したエージェントがこれを実行します。
The runresult form expects a reporter task or a string containing a reporter. This agent runs it and reports the result.
runresultの形のときは、レポータータスクかレポーターを含む文字列を指定します。呼び出したエージェントがこれを実行し結果を返します。
Note that you can't use run to define or redefine procedures. If you care about performance, note that the code must be compiled first which takes time. However, compiled bits of code are cached by NetLogo and thus using run on the same string over and over is much faster than running different strings. The first run, though, will be many times slower than running the same code directly, or in a command task.
プロシージャを定義もしくは再定義する目的ではrunは使えません。パフォーマンスを向上させたいのであれば、時間がかかる部分を先にコンパイルする必要があります。しかし、コンパイルされたコードはNetLogoによってキャッシュされますので、同じ文字列に対して繰り返しrunを実行するのは異なる文字列に対して実行するよりも格段に速くなります。しかし最初の実行では、同じコードを直接、またはコマンドタスク内で実行するよりも何倍も遅くなります。
Tasks are recommended over strings whenever possible. (An example of when you must use strings is if you accept pieces of code from the user of your model.)
可能であれば文字列を指定するよりもタスクを指定するほうが推奨されます。(文字列を使わなければならないのは、モデルのユーザーからコードの一部を受け取るようなときです。)
Tasks may freely read and/or set local variables and procedure inputs. Trying to do the same with strings may or may not work and should not be relied on.
タスクを指定するときは、ローカル変数やプロシージャ入力を自由に読んだり設定したりすることができます。同じことを文字列を指定するときにやろうとすると、動作するかどうかは場合によります。
When using tasks, you can provide them with inputs, if you surround the entire call with parentheses. For example:
タスクを指定するときは、全体をかっこで囲めば入力値とともに用いることができます。例えば、
(run task [ crt ?1 [ fd ?2 ] ] 10 5) ;; creates 10 turtles and move them forward 5 stepsタートルを10個作成し前方に5ステップ進めます。 show (runresult task [ ?1 + ?2 ] 10 5) => 15 ;; adds 10 and 510と5を足します。
Reports a shade of color proportional to the value of number.
数値の値に比例した色の色調を返します。
If range1 is less than range2, then the larger the number, the lighter the shade of color. But if range2 is less than range1, the color scaling is inverted.
もし範囲1が範囲2よりも小さければ、数値が大きければ大きいほど、色の色調は明るくなります。しかし範囲2が範囲1よりも小さければ、色のスケールは逆になります。
If number is less than range1, then the darkest shade of color is chosen.
もし数値が範囲1よりも小さければ、色の色調でもっとも暗いものが選ばれます。
If number is greater than range2, then the lightest shade of color is chosen.
もし数値が範囲2よりも大きければ、色の色調でもっとも明るいものが選ばれます。
Note: for color shade is irrelevant, e.g. green and green + 2 are equivalent, and the same spectrum of colors will be used.
注意:色の色調が不適切であるときは、例えばgreenとgreen + 2は等しいので、同じ色が使われます。
ask turtles [ set color scale-color red age 0 50 ] ;; colors each turtle a shade of red proportional ;; to its value for the age variable ;; 各タートルの色をage変数の値に比例する赤の色調にする
Reports this turtle, patch or link.
実行しているタートルまたはパッチまたはリンクを返します。
"self" and "myself" are very different. "self" is simple; it means "me". "myself" means "the agent who asked me to do what I'm doing right now."
"self"と"myself"とはまったく違います。"self"は単純であり"自分自身"を意味します。"myself"は"私がいましていることを私にaskしたエージェント"を意味します。
Note that it is always redundant to write [foo] of self
. This is always equivalent to simply writing foo
.
[foo] of self
と書くことは常に冗長であることに注意してください。これは単にfoo
と書くことと等しくなります。
See also: myself もご覧ください。
After a semicolon, the rest of the line is ignored. This is useful for adding "comments" to your code -- text that explains the code to human readers. Extra semicolons can be added for visual effect.
セミコロンの後では、行の残りの部分は無視されます。この機能は人間の読者にコードについて説明するための"コメント"を追加するために使えます。視覚効果のために追加のセミコロンを記載することもできます。
NetLogo's Edit menu has items that let you comment or uncomment whole sections of code.
NetLogoのEditメニューにはコードの節全体に対してコメントするかしないかを設定する要素があります。
Makes a list out of the values. If any value is a list, its items are included in the result directly, rather than being included as a sublist. Examples make this clearer:
値の集合からリストを作成します。もし各値がリストであるときは、サブリストとしてではなく要素が直接にリストに含まれます。次の例を見ればよくわかります:
show sentence 1 2 => [1 2] show sentence [1 2] 3 => [1 2 3] show sentence 1 [2 3] => [1 2 3] show sentence [1 2] [3 4] => [1 2 3 4] show sentence [[1 2]] [[3 4]] => [[1 2] [3 4]] show (sentence [1 2] 3 [4 5] (3 + 3) 7) => [1 2 3 4 5 6 7]
Sets variable to the given value.
変数に指定の値を設定します。
Variable can be any of the following:
変数は下記のいずれかになります:
Sets the current directory that is used by the primitives file-delete, file-exists?, and file-open.
file-delete, file-exists?, file-openで使われるカレントディレクトリを設定します。
The current directory is not used if the above commands are given an absolute file path. This is defaulted to the user's home directory for new models, and is changed to the model's directory when a model is opened.
上記のコマンドでは絶対ファイルパスが与えられればカレントディレクトリは使われません。デフォルトのカレントディレクトリは、新しいモデルの場合はユーザーのホームディレクトリで、モデルがオープンされればモデルのディレクトリに変更されます。
Note that in Windows file paths the backslash needs to be escaped within a string by using another backslash "C:\\"
Windowsのファイルパスでは、文字列の中のバックスラッシュはもう一つのバックスラッシュを使って"C:\\"のようにエスケープする必要があります。
The change is temporary and is not saved with the model.
この変更は一時的なものでありモデルには保存されません。
Note: in applets, this command has no effect, since applets are only allowed to read files from the same directory on the server where the model is stored.
注意:アプレットはモデルが保存されているサーバー上の同じディレクトリのファイルしか読むことが許されていませんので、アプレットではこのコマンドは効果はありません。
set-current-directory "C:\\NetLogo" ;; Assume it is a Windows MachineWindowsマシンであると仮定 file-open "my-file.txt" ;; Opens file "C:\\NetLogo\\my-file.txt" ファイルを開く
Sets the current plot to the plot with the given name (a string). Subsequent plotting commands will affect the current plot.
カレントプロットを指定の名前(文字列)を持つプロットとして指定します。それに続くプロット関係のコマンドはカレントプロットに対して作用します。
The current plot's current pen is set to the pen named penname (a string). If no such pen exists in the current plot, a runtime error occurs.
カレントプロットのカレントペンをペン名(文字列)のペンとして設定します。もしカレントプロットにそのようなペンが存在しない場合はランタイムエラーが発生します。
Specifies a default initial shape for all turtles or links, or for a particular breed of turtles or links. When a turtle or link is created, or it changes breeds, its shape is set to the given shape.
すべてのタートルもしくはリンク、あるいは特定の品種のタートルもしくはリンクに対して、デフォルトの初期の形状を特定します。タートルもしくはリンクが作成されたとき、あるいは品種を変更したときは、その形状は指定の形状に設定されます。
This command doesn't affect existing agents, only agents you create afterwards.
このコマンドは既存のエージェントには影響しません。以後に作成されるエージェントにのみ影響します。
The given breed must be either turtles, links, or the name of a breed. The given string must be the name of a currently defined shape.
指定の品種はタートル、リンク、あるいは品種名でなければなりません。指定の文字列は定義済みの形状の名前でなければなりません。
In new models, the default shape for all turtles is "default".
新規に作成したモデルでは、すべてのタートルのデフォルトの形状は "default" になります。
Note that specifying a default shape does not prevent you from changing an agent's shape later. Agents don't have to be stuck with their breed's default shape.
デフォルトの形状を特定したとしても後からエージェントの形状を変更することができます。エージェントはその品種のデフォルトの形状のままでいる必要はありません。
create-turtles 1 ;; new turtle's shape is新しいタートルの形状は "default" create-cats 1;; new turtle's shape is新しいタートルの形状は "default" set-default-shape turtles "circle" create-turtles 1 ;; new turtle's shape is新しいタートルの形状は "circle" create-cats 1;; new turtle's shape is新しいタートルの形状は "circle" set-default-shape cats "cat" set-default-shape dogs "dog" create-cats 1 ;; new turtle's shape is新しいタートルの形状は "cat" ask cats [ set breed dogs ] ;; all cats become dogs, and automatically ;; change their shape to "dog"すべてのcatsはdogsになり、形状は自動的に "dog" に変わる
See also: shape もご覧ください。
Set the current plot pen's plot interval so that, given the current x range for the plot, there would be number number of bars drawn if the histogram command is called.
カレントプロットペンのプロット間隔を、プロットの現在のxの範囲のもとで、histogramコマンドが呼び出されたときに個数個の縦棒が描かれるように設定します。
See also: histogram もご覧ください。
Specifies the thickness of lines and outlined elements in the turtle's shape.
タートルの形状での線と囲まれた要素の太さを設定します。
The default value is 0. This always produces lines one pixel thick.
デフォルトの値は0です。この場合は常に太さ1ピクセルの線を描きます。
Non-zero values are interpreted as thickness in patches. A thickness of 1, for example, produces lines which appear one patch thick. (It's common to use a smaller value such as 0.5 or 0.2.)
0以上の値はパッチに対する太さとして解釈されます。例えば太さ1のときは1パッチの太さの線を描きます。(0.5や0.2のようなより小さな値を指定するのが普通です。
Lines are always at least one pixel thick.
線は常に最低でも1ピクセルの太さになります。
This command is experimental and may change in later releases.
このコマンドは実験的なものであり、今後のリリースでは変更になる場合があります。
Sets the size of the patches of the view in pixels. The size is typically an integer, but may also be a floating point number.
ビューの中でのパッチの大きさをピクセル単位で指定します。大きさは通常は正数になりますが、浮動小数点数で指定することもできます。
See also: patch-size, resize-world もご覧ください。
Sets the color of the current plot pen to number.
カレントプロットペンの色を数値に設定します。
Tells the current plot pen to move a distance of number in the x direction during each use of the plot command. (The plot pen interval also affects the behavior of the histogram command.)
カレントプロットペンに対して、プロットコマンドを使うごとにx方向に数値の距離だけ移動するよう指示します。(プロットペンの間隔はヒストグラムコマンドの動作にも影響します。)
Sets the mode the current plot pen draws in to number. The allowed plot pen modes are:
カレットプロットペンのモードを数値に設定します。プロットペンのモードは以下のいずれかになります。
The default mode for new pens is 0 (line mode).
新しいペンのデフォルトのモードは0(ラインモード)です。
For each plot, runs that plot's setup commands, including the setup code for any pens in the plot.
各プロットにおいて、プロットの中のすべてのペンに対するセットアップコードを含む、プロットのセットアップコマンドを実行します。
reset-ticks has the same effect, so in models that use the tick counter, this primitive is not normally used.
reset-ticksには同じ効果があります。ですのでティックカウンターを使っているモデルではこのプリミティブは通常は使われません。
See the Plotting section of the Programming Guide for more details.
詳細はプログラミングガイドの「プロッティング」節をご覧ください。
See also: update-plots もご覧ください。
Sets the minimum and maximum values of the x or y axis of the current plot.
カレントプロットのx軸とy軸の最小値と最大値を設定します。
The change is temporary and is not saved with the model. When the plot is cleared, the ranges will revert to their default values as set in the plot's Edit dialog.
この変更は一時的なものでありモデルには保存されません。プロットがクリアされたときはこの範囲はプロットのEditダイアログで設定されたデフォルト値に戻ります。
The turtle sets its x-coordinate to x and its y-coordinate to y.
タートルが自己のx座標をxに、y座標をyに設定します。
Equivalent to set xcor x set ycor y, except it happens in one time step instead of two.
set xcor x set ycor yと同等ですが、2ステップではなく1ステップで済みます。
If x or y is outside the world, NetLogo will throw a runtime error, unless wrapping is turned on in the relevant dimensions. For example, with wrapping turned on in both dimensions and the default world size where min-pxcor = -16, max-pxcor = 16, min-pycor = -16 and max-pycor = 16, asking a turtle to setxy 17 17 will move it to the center of patch (-16, -16).
xあるいはyがワールドの外側になるときは、循環が対応する軸で有効にならない限り、NetLogoはランタイムエラーを返します。例えば、循環が両方の軸で有効で、ワールドの大きさがmin-pxcor = -16, max-pxcor = 16, min-pycor = -16, max-pycor = 16のデフォルトであるとき、タートルにsetxy 17 17をaskすれば、タートルは(-16, -16)パッチの中心へ移動します。
setxy 0 0 ;; turtle moves to the middle of the center patchタートルは中央のパッチの中心点へ移動 setxy random-xcor random-ycor ;; turtle moves to a random pointタートルはランダムな位置へ移動 setxy random-pxcor random-pycor ;; turtle moves to the center of a random patchタートルはランダムなパッチの中心点へ移動
See also: move-to もご覧ください。
Reports true if both colors are shades of one another, false otherwise.
両方の色が同じ色調であればtrueを、そうでなければfalseを返します。
show shade-of? blue red => false show shade-of? blue (blue + 1) => true show shade-of? gray white => true
This is a built-in turtle and link variable. It holds a string that is the name of the turtle or link's current shape. You can set this variable to change the shape. New turtles and links have the shape "default" unless the a different shape has been specified using set-default-shape.
組み込みのタートル変数およびリンク変数です。タートルもしくはリンクの現在の形状名を表す文字列を保有します。変数値を設定することで形状を変更することができます。新しく作成されるタートルとリンクは、set-default-shapeを使って違う形状が指定されない限りは"default"という形状となります。
Example:
ask turtles [ set shape "wolf" ] ;; assumes you have made a "wolf" ;; shape in NetLogo's Turtle Shapes Editor ;; NetLogoのタートル形状エディターを使って"wolf"という形状を作っておいたと仮定 ask links [ set shape "link 1" ] ;; assumes you have made a "link 1" shape in ;; the Link Shapes Editor ;; リンク形状エディターを使って"link 1"という形状を作っておいたと仮定
See also: set-default-shape, shapes もご覧ください。
Reports a list of strings containing all of the turtle shapes in the model.
モデルに含まれるすべてのタートル形状を文字列のリストとして返します。
New shapes can be created, or imported from the shapes library or from other models, in the Shapes Editor.
新しい形状は、形状エディターを用いて、自分で作成したり、ライブラリや他のモデルからインポートすることができます。
show shapes => ["default" "airplane" "arrow" "box" "bug" ... ask turtles [ set shape one-of shapes ]
Prints value in the Command Center, preceded by this agent, and followed by a carriage return. (This agent is included to help you keep track of what agents are producing which lines of output.) Also, all strings have their quotes included similar to write.
コマンドセンターに、実行したエージェント、値、改行記号の順で出力します。(実行したエージェントは、どのエージェントが出力内容のどの行を出力したかをたどれるようにするために出力結果に含まれます。)また、writeと同様にすべての文字列は引用符で囲まれます。
See also: print, type, write, output-show もご覧ください。
The turtle becomes visible again.
タートルが再び可視になります。
Note: This command is equivalent to setting the turtle variable "hidden?" to false.
注意:このコマンドはタートル変数の"hidden?"をfalseに設定するのと同等です。
See also: hide-turtle もご覧ください。
The link becomes visible again.
リンクが再び可視になります。
Note: This command is equivalent to setting the link variable "hidden?" to false.
注意:このコマンドはリンク変数の"hidden?"をfalseに設定するのと同等です。
See also: hide-link もご覧ください。
Reports a new list containing the same items as the input list, but in randomized order.
入力リストと同じ要素をランダムな順序で保有する新しいリストを返します。
show shuffle [1 2 3 4 5] => [5 2 4 1 3] show shuffle [1 2 3 4 5] => [1 3 5 2 4]
Reports the sine of the given angle. Assumes angle is given in degrees.
指定の角度の正弦を返します。
show sin 270 => -1
This is a built-in turtle variable. It holds a number that is the turtle's apparent size. The default size is 1, which means that the turtle is the same size as a patch. You can set this variable to change a turtle's size.
組み込みのタートル変数です。タートルの外見上の大きさを保有します。デフォルトの大きさは1であり、タートルがパッチと同じ大きさであることを意味します。変数値を設定することでタートルの大きさを変更することができます。
Reports a sorted list of numbers, strings, or agents.
数値、文字列、もしくはエージェントのソート済みのリストを返します。
If the input contains no numbers, strings, or agents, the result is the empty list.
入力値が数値、文字列、もしくはエージェントを含まないときは、結果は空のリストとなります。
If the input contains at least one number, the numbers in the list are sorted in ascending order and a new list reported; non-numbers are ignored.
入力値が1つ以上の数値を含んでいる場合は、リスト中の数値は昇順でソートされ、新しいリストが返されます。数値でないものは無視されます。
Or, if the input contains at least one string, the strings in the list are sorted in ascending order and a new list reported; non-strings are ignored.
または、入力値が1つ以上の文字列を含んでいる場合は、リスト中の文字列は昇順でソートされ、新しいリストが返されます。文字列でないものは無視されます。
Or, if the input is an agentset or a list containing at least one agent, a sorted list of agents (never an agentset) is reported; non-agents are ignored. Agents are sorted in the same order the < operator uses.
または、入力値がエージェント集合もしくは1つ以上のエージェントを含むリストである場合は、エージェントのソートされたリスト(エージェント集合ではありません)を返します。エージェントでないものは無視されます。エージェントは < 演算子を使う場合と同じ順序でソートされます。
show sort [3 1 4 2] => [1 2 3 4] let n 0 foreach sort patches [ ask ? [ set plabel n set n n + 1 ] ] ;; patches are labeled with numbers in left-to-right, ;; top-to-bottom orderパッチに左から右、上から下の順序で数値をラベルする
See also: sort-by, sort-on. もご覧ください。
If the input is a list, reports a new list containing the same items as the input list, in a sorted order defined by the boolean reporter task.
入力値がリストの時は、booleanのレポータータスクで定義される順序でソートされた、入力リストと同じ要素を含む新しいリストを返します。
The two inputs to the reporter task are the values being compared. The task should report true if ?1 comes strictly before ?2 in the desired sort order, and false otherwise.
レポータータスクへの2つの入力値は比較されます。タスクは、もし指定したソート順において?1が?2のすぐ前に来る場合はtrue、そうでない場合はfalseを返します。
If the input is an agentset or a list of agents, reports a list (never an agentset) of agents.
入力がエージェント集合もしくはエージェントのリストであるときは、エージェントのリストを返します(エージェント集合にはなりません)。
If the input is a list, the sort is stable, that is, the order of items considered equal by the reporter is not disturbed. If the input is an agentset, ties are broken randomly.
入力がリストである場合は、ソート結果は安定的です。なぜならレポーターによってソート順が等しいと判定された場合は元の順序で並ぶためです。入力がエージェント集合である場合は、同じ値を取る要素があればランダムに並べ替えられます。
show sort-by < [3 1 4 2] => [1 2 3 4] show sort-by > [3 1 4 2] => [4 3 2 1] show sort-by [length ?1 < length ?2] ["Grumpy" "Doc" "Happy"] => ["Doc" "Happy" "Grumpy"]
See also: sort, sort-on もご覧ください。
Reports a list of agents, sorted according to each agent's value for reporter. Ties are broken randomly.
各エージェントのレポーターの値でソートされたエージェントのリストを返します。同じ値を取る要素があればランダムに並べ替えられます。
The values must be all numbers, all strings, or all agents of the same type.
この値は、すべて数値、すべて文字列、あるいはすべて同じ種類のエージェントである必要があります。
crt 3 show sort-on [who] turtles => [(turtle 0) (turtle 1) (turtle 2)] show sort-on [(- who)] turtles => [(turtle 2) (turtle 1) (turtle 0)] foreach sort-on [size] turtles [ ask ? [ do-something ] ] ;; turtles run "do-something" one at a time, in ;; ascending order by size ;; タートルが、大きさが小さい方から順番に"do-something"を実行する
See also: sort, sort-by もご覧ください。
Creates number new turtles on the current patch. The new turtles have random integer headings and the color is randomly selected from the 14 primary colors. The turtles immediately run commands. This is useful for giving the new turtles different colors, headings, or whatever. (The new turtles are created all at once then run one at a time, in random order.)
数値個の新しいタートルを実行中のパッチに作成します。新しいタートルの向きはランダムな整数となり、色は14の基本色からランダムに選ばれます。タートルは直ちにコマンドを実行します。この機能は新しいタートルに任意の色や向きなどを設定したい場合に有用です。(新しいタートルは一度にすべて作成され、ランダムな順序でコマンドを実行します。)
If the sprout-<breeds> form is used, the new turtles are created as members of the given breed.
sprout-<breeds> の書式を使うと、新しいタートルは指定の品種のメンバーとして作成されます。
sprout 5 sprout-wolves 10 sprout 1 [ set color red ] sprout-sheep 1 [ set color black ]
See also: create-turtles, hatch もご覧ください。
Reports the square root of number.
数値の平方根を返します。
This turtle or link leaves an image of its shape in the drawing at its current location.
実行したタートルもしくはリンクが、現在の位置のドローイングに自分自身と同じ形をしたイメージを残します。
Note: The shapes made by stamp may not be pixel-for-pixel identical from computer to computer.
注意:stampによって作られる形はコンピューターによって異なるため、ピクセル単位で同一ではありません。
This turtle or link removes any pixels below it in the drawing inside the bounds of its shape.
実行したタートルもしくはリンクが、自分自身の形の内側にあるドローイングのピクセルを消去します。
Note: The shapes made by stamp-erase may not be pixel-for-pixel identical from computer to computer.
注意:stamp-eraseによって作られる形はコンピューターによって異なるため、ピクセル単位で同一ではありません。
Reports the sample standard deviation of a list of numbers. Ignores other types of items.
数値のリストの標準偏差を返します。他のデータ型であれば無視します。
(Note that this estimates the standard deviation for a sample, rather than for a whole population, using Bessel's correction.)
(このコマンドは母集団全体ではなく、ベッセルの修正を用いて標本の標準偏差を計算します。)
show standard-deviation [1 2 3 4 5 6] => 1.8708286933869707 show standard-deviation [energy] of turtles ;; prints the standard deviation of the variable "energy" ;; from all the turtlesすべてのタートルの変数"energy"の標準偏差を表示
User-defined procedure which, if it exists, will be called when a model is first loaded in the NetLogo application.
NetLogoアプリケーションでモデルが最初にロードされたときに、もし存在するならば呼び出される、ユーザー定義のプロシージャです。
to startup setup end
startup does not run when a model is run headless from the command line, or by parallel BehaviorSpace.
startupはモデルがディスプレイ無しでコマンドラインから実行される場合、およびBehaviorSpaceでパラレルに実行される場合には実行されません。
This agent exits immediately from the enclosing procedure, ask, or ask-like construct (e.g. crt, hatch, sprout). Only the enclosing procedure or construct stops, not all execution for the agent.
実行したエージェントが、プロシージャ、ask、またはaskに似た構造(crt, hatch, sproutなど)の囲みから直ちに抜け出します。囲まれたプロシージャもしくは構造が停止するだけであり、エージェントのすべての実行が停止するわけではありません。
if not any? turtles [ stop ] ;; exits if there are no more turtlesタートルが残っていなければ囲みを抜ける
Note: stop
can also be used to stop a forever button. See Buttons in the Programming Guide for details.
注意:stop
はフォーエバーボタンを停止することにも使うことができます。プログラミングガイドの「ボタン」節をご覧ください。
Stop can also be used to stop a BehaviorSpace model run. If the go commands directly call a procedure, then when that procedure calls stop, the run ends.
StopはBehaviorSpaceモデルの実行を停止するために使うこともできます。goコマンドがプロシージャを直接に呼び出す場合は、プロシージャがstopを呼び出すときに実行も終了します。
Closes the agent monitor for the given agent (turtle or patch). In the case that no agent monitor is open, stop-inspecting does nothing.
指定のエージェント(タートルまたはパッチ)のエージェントモニターを閉じます。エージェントモニターが開かれていない場合はstop-inspectingは何もしません。
stop-inspecting patch 2 4 ;; the agent monitor for that patch closesパッチのエージェントモニターが閉じる ask sheep [ stop-inspecting self ] ;; close all agent monitors for sheepsheepのエージェントモニターをすべて閉じる
See also: inspect, stop-inspecting-dead-agents もご覧ください。
Closes all agent monitors for dead agents.
死んだエージェントのエージェントモニターをすべて閉じます。
See also: inspect, stop-inspecting もご覧ください。
Reports the turtle (or patch) that the observer is currently watching, following, or riding. Reports nobody if there is no such turtle (or patch).
オブザーバーが現在watch, follow, またはrideしているタートル(またはパッチ)を返します。そのようなタートル(またはパッチ)がない場合はnobodyを返します。
See also: watch, follow, ride もご覧ください。
Reports just a section of the given list or string, ranging between the first position (inclusive) and the second position (exclusive).
指定のリストまたは文字列のうち、位置1(その数自身を含む)と位置2(その数自身は含まない)の間の部分を返します。
Note: The positions are numbered beginning with 0, not with 1.
位置の数値は1からではなく0から始まります。
show sublist [99 88 77 66] 1 3 => [88 77] show substring "apartment" 1 5 => "part"
Computes the difference between the given headings, that is, the number of degrees in the smallest angle by which heading2 could be rotated to produce heading1. A positive answer means a clockwise rotation, a negative answer counterclockwise. The result is always in the range -180 to 180, but is never exactly -180.
指定の向きの間の差、すなわち、向き2を回転して向き1を作成するための最小の回転角度を計算します。答えが正数のときは時計回りの回転を意味し、負数のときは反時計回りの回転を意味します。計算結果は常に-180から180までの間となりますが、正確に-180にはなりません。
Note that simply subtracting the two headings using the - (minus) operator wouldn't work. Just subtracting corresponds to always rotating clockwise from heading2 to heading1; but sometimes the counterclockwise rotation is shorter. For example, the difference between 5 degrees and 355 degrees is 10 degrees, not -350 degrees.
2つの向きを単純に引いただけでは不適切です。単純に引くと向き2から向き1への時計回りの回転の意味になりますが、反時計回りの回転の方が短くなることもあります。例えば、5度と355度との差は10度であり、-350度ではありません。
show subtract-headings 80 60 => 20 show subtract-headings 60 80 => -20 show subtract-headings 5 355 => 10 show subtract-headings 355 5 => -10 show subtract-headings 180 0 => 180 show subtract-headings 0 180 => 180
Reports the sum of the items in the list.
リストの各要素の合計値を返します。
show sum [energy] of turtles ;; prints the total of the variable "energy" ;; from all the turtles ;; すべてのタートルの"energy"変数の合計値を表示
Reports the tangent of the given angle. Assumes the angle is given in degrees.
指定の角度の正接を返します。
Creates and reports a task, either a command task or a reporter task, depending on the input.
タスクを作成して返します。入力値応じてコマンドタスクかレポータータスクのいずれかになります。
See the Tasks section of the Programming Guide for details.
詳細はプログラミングガイドの「タスク」節をご覧ください。
This is a built-in link variable. It holds a number that is the link's apparent size as a fraction of the patch size. The default thickness is 0, which means that regardless of patch-size the links will always appear 1 pixel wide. You can set this variable to change a link's thickness.
組み込みのリンク変数です。リンクの外見上の太さをパッチの大きさとの比率として保有します。デフォルトのthicknessは0であり、これはパッチがどのような大きさであってもリンクの見た目の太さが1ピクセルであることを意味します。変数値を設定することでリンクの太さを変えることができます。
Advances the tick counter by one and updates all plots.
ティックカウンターを1進めてすべてのプロットを更新します。
If the tick counter has not been started yet with reset-ticks, an error results.
ティックカウンターがreset-ticksを使って開始されていないときはエラーになります。
Normally tick goes at the end of a go procedure.
通常はtickはgoプロシージャの最後に置かれます。
See also: ticks, tick-advance, reset-ticks, clear-ticks, update-plots もご覧ください。
Advances the tick counter by number. The input may be an integer or a floating point number. (Some models divide ticks more finely than by ones.) The input may not be negative.
ティックカウンターを数値だけ進めます。入力値は整数か浮動小数点数になります。(ティックを1よりも細かく分けるモデルもあります。)入力値を負数にすることはできません。
When using tick-based view updates, the view is normally updated every 1.0 ticks, so using tick-advance
with a number less then 1.0 may not always trigger an update. If you want to make sure that the view is updated, you can use the display
command.
ティックベースのビュー更新を使う場合は、ビューは通常1.0ティックごとに更新されますので、tick-advance
を1.0以下の数値で使用しても常にビューが更新されるとは限りません。ビューを確実に更新したい場合はdisplay
コマンドを使うことができます。
If the tick counter has not been started yet with reset-ticks, an error results.
ティックカウンターがreset-ticksを使って開始されていないときはエラーになります。
Does not update plots.
プロットは更新しません。
See also: tick, ticks, reset-ticks, clear-ticks もご覧ください。
Reports the current value of the tick counter. The result is always a number and never negative.
ティックカウンターの現在の値を返します。結果は常に数値であり負数にはなりません。
If the tick counter has not been started yet with reset-ticks, an error results.
ティックカウンターがreset-ticksを使って開始されていないときはエラーになります。
Most models use the tick command to advance the tick counter, in which case ticks will always report an integer. If the tick-advance command is used, then ticks may report a floating point number.
多くのモデルではtickコマンドでティックカウンターを進めます。そのときticksは常に整数を返します。tick-advanceコマンドを使う場合はticksは浮動小数点数を返すことがあります。
See also: tick, tick-advance, reset-ticks, clear-ticks もご覧ください。
Ties end1 and end2 of the link together. If the link is a directed link end1 is the root turtle and end2 is the leaf turtle. The movement of the root turtle affects the location and heading of the leaf turtle. If the link is undirected the tie is reciprocal so both turtles can be considered root turtles and leaf turtles. Movement or change in heading of either turtle affects the location and heading of the other turtle.
リンクの終端1と終端2をタイでつなぎます。リンクが有向リンクであるときは終端1がルートタートル、終端2がリーフタートルとなります。
When the root turtle moves, the leaf turtles moves the same distance, in the same direction. The heading of the leaf turtle is not affected. This works with forward, jump, and setting the xcor or ycor of the root turtle.
ルートタートルが移動したときはリーフタートルも同じ方向に同じ距離だけ移動します。リーフタートルの向きには影響はありません。forward, jump、ルートタートルのxcorやycorを設定したときにこの効果が生じます。
When the root turtle turns right or left, the leaf turtle is rotated around the root turtle the same amount. The heading of the leaf turtle is also changed by the same amount.
ルートタートルが左右に向きを変えたときは、リーフタートルはルートタートルの周囲を同じだけ回転します。リーフタートルの向きも同じだけ変化します。
If the link dies, the tie relation is removed.
リンクが死ねば、タイの関係も削除されます。
crt 2 [ fd 3 ] ;; creates a link and ties turtle 1 to turtle 0タートル0とタートル1の間にリンクとタイを作成 ask turtle 0 [ create-link-to turtle 1 [ tie ] ]
See also: untie もご覧ください。
This is a built-in link variable. It holds a string that is the name of the tie mode the link is currently in. Using the tie and untie commands changes the mode of the link. You can also set tie-mode to "free" to create a non-rigid joint between two turtles (see the Tie section of the Programming Guide for details). By default links are not tied.
組み込みのリンク変数です。リンクの現在のタイモードの名前を表す文字列を保有します。tieとuntieコマンドを用いることでリンクのモードを変更することができます。2つのタートルの間に固定的な結合を設定しないようにするためにタイモードを"free"に設定することもできます(詳細はプログラミングガイドの「タイ」節をご覧ください。)。デフォルトではリンクにはタイは設定されません。
Reports how many seconds have passed since the command reset-timer was last run (or since NetLogo started). The potential resolution of the clock is milliseconds. (Whether you get resolution that high in practice may vary from system to system, depending on the capabilities of the underlying Java Virtual Machine.)
reset-timerコマンドが最後に実行されたとき(またはNetLogoを開始したとき)から何秒経過しているかを返します。時計の最大の分解能はミリ秒です。(これほどの高い分解能が得られるかどうかは、依存するJava仮想マシンの性能によりますので、システムによって異なります。)
See also: reset-timer もご覧ください。
Note that the timer is different from the tick counter. The timer measures elapsed real time in seconds; the tick counter measures elapsed model time in ticks.
タイマーとティックカウンターとは異なります。タイマーは経過した実時間を秒単位で計測し、ティックカウンターはモデル上の時間をティック単位で計測します。
Used to begin a command procedure.
コマンドプロシージャの最初に使います。
to setup clear-all crt 500 end to circle [radius] crt 100 [ fd radius ] end
Used to begin a reporter procedure.
レポータープロシージャの最初に使います。
The body of the procedure should use report to report a value for the procedure. See report.
プロシージャの本体では値を返すためにreportを使う必要があります。reportをご覧ください。
to-report average [a b] report (a + b) / 2 end to-report absolute-value [number] ifelse number >= 0 [ report number ] [ report (- number) ] end to-report first-turtle? report who = 0 ;; reports true or falsetrueかfalseを返す end
Reports the heading from this agent to the given agent.
実行したエージェントから指定のエージェントに向いたときの向きを返します。
If wrapping is allowed by the topology and the wrapped distance (around the edges of the world) is shorter, towards will use the wrapped path.
もしワールドの位相に循環が適用されていて、循環した場合の距離(反対側の辺とつながっている辺を経由した距離)の方が近いのであれば、towardsは循環する経路を用います。
Note: asking for the heading from an agent to itself, or an agent on the same location, will cause a runtime error.
注意:エージェント自身への向きを聞いたり、同じ位置にあるエージェントへの向きを聞いた場合は、ランタイムエラーとなります。
set heading towards turtle 1 ;; same as "face turtle 1"と同じ
See also: face もご覧ください。
Reports the heading from the turtle or patch towards the point (x,y).
タートルもしくはパッチから点 (x,y) への向きを返します。
If wrapping is allowed by the topology and the wrapped distance (around the edges of the world) is shorter, towardsxy will use the wrapped path.
もしワールドの位相に循環が適用されていて、循環した場合の距離(反対側の辺とつながっている辺を経由した距離)の方が近いのであれば、towardsxyは循環する経路を用います。
Note: asking for the heading to the point the agent is already standing on will cause a runtime error.
注意:エージェントがすでに位置している点への向きを聞いた場合はランタイムエラーとなります。
See also: facexy もご覧ください。
Reports the turtle with the given who number, or nobody if there is no such turtle. For breeded turtles you may also use the single breed form to refer to them.
指定のwho番号のタートルを返します。そのようなタートルが存在しない場合はnobodyを返します。品種のあるタートルの場合は品種の単一メンバーの名称を使って参照することができます。
ask turtle 5 [ set color red ] ;; turtle with who number 5 turns redwho番号5番のタートルが赤に変わる
Reports an agentset containing all of the turtles anywhere in any of the inputs. The inputs may be individual turtles, turtle agentsets, nobody, or lists (or nested lists) containing any of the above.
入力値に含まれるあらゆるタートルのすべてからなるエージェント集合を返します。入力値は個々のタートル、タートル集合、nobody、もしくはこれらのいずれかを含むリスト(またはネストされたリスト)のいずれを取ることもできます。
turtle-set self (turtle-set self turtles-on neighbors) (turtle-set turtle 0 turtle 2 turtle 9) (turtle-set frogs mice)
See also: patch-set, link-set もご覧ください。
Reports the agentset consisting of all turtles.
すべてのタートルからなるエージェント集合を返します。
show count turtles ;; prints the number of turtlesタートルの数を表示
Reports an agentset containing the turtles on the patch (dx, dy) from the caller. (The result may include the caller itself if the caller is a turtle.)
実行したエージェントから (dx, dy) の相対位置にあるパッチ上にいるタートルを含むエージェント集合を返します。(実行したエージェントがタートルである場合は自分自身を含むことがあります。)
create-turtles 5 [ setxy 2 3 ] show count [turtles-at 1 1] of patch 1 2 => 5
If the name of a breed is substituted for "turtles", then only turtles of that breed are included.
"turtles"ではなく品種名を用いた場合は、その品種のタートルだけが含まれます。
Reports an agentset containing all the turtles on the caller's patch (including the caller itself if it's a turtle).
実行したエージェントと同じパッチ上にいるすべてのタートルを含むエージェント集合を返します。(実行したエージェントがタートルである場合は自分自身を含みまます。)
crt 10 ask turtle 0 [ show count turtles-here ] => 10
If the name of a breed is substituted for "turtles", then only turtles of that breed are included.
"turtles"ではなく品種名を用いた場合は、その品種のタートルだけが含まれます。
breed [cats cat] breed [dogs dog] create-cats 5 create-dogs 1 ask dogs [ show count cats-here ] => 5
Reports an agentset containing all the turtles that are on the given patch or patches, or standing on the same patch as the given turtle or turtles.
指定したパッチまたはパッチ集合上、もしくは実行したタートルもしくはタートル集合と同じパッチ上にいるすべてのタートルを含むエージェント集合を返します。
ask turtles [ if not any? turtles-on patch-ahead 1 [ fd 1 ] ] ask turtles [ if not any? turtles-on neighbors [ die-of-loneliness ] ]
If the name of a breed is substituted for "turtles", then only turtles of that breed are included.
"turtles"ではなく品種名を用いた場合は、その品種のタートルだけが含まれます。
The turtles-own keyword, like the globals, breed, <breeds>-own, and patches-own keywords, can only be used at the beginning of a program, before any function definitions. It defines the variables belonging to each turtle.
globals, breed, directed-link-breed, undirected-link-breed, patches-own, turtles-own, links-own, <品種集合>-ownの各予約語は、プロシージャ定義よりも前のコードタブの先頭においてのみ使用することができます。turtles-ownは各タートルが保有する変数を定義します。
If you specify a breed instead of "turtles", only turtles of that breed have the listed variables. (More than one turtle breed may list the same variable.)
"turtles"ではなく品種を指定した場合は、その品種のタートルだけが列挙された変数を保有します。(2つ以上のタートル品種が同じ変数を保有することもできます。)
breed [cats cat ] breed [dogs dog] breed [hamsters hamster] turtles-own [eyes legs] ;; applies to all breedsすべての品種に適用される cats-own [fur kittens] hamsters-own [fur cage] dogs-own [hair puppies]
See also: globals, patches-own, breed, <breeds>-own もご覧ください。
Prints value in the Command Center, not followed by a carriage return (unlike print and show). The lack of a carriage return allows you to print several values on the same line.
コマンドセンターに値を、改行記号を伴わずに出力します(printやshowとは異なります)。改行記号がないので、同じ行に他の値を続けて表示することができます。
This agent is not printed before the value. unlike show.
showとは異なり、実行したエージェントは値の前には表示されません。
type 3 type " " print 4 => 3 4
See also: print, show, write, output-type もご覧ください。
This keyword, like the globals and breeds keywords, can only be used at the beginning of the Code tab, before any procedure definitions. It defines an undirected link breed. Links of a particular breed are always either all directed or all undirected. The first input defines the name of the agentset associated with the link breed. The second input defines the name of a single member of the breed.
globals, breed, directed-link-breed, undirected-link-breed, patches-own, turtles-own, links-own, <品種集合>-ownの各予約語は、プロシージャ定義よりも前のコードタブの先頭においてのみ使用することができます。undirected-link-breedは有向リンク品種を定義します。ある品種のリンクはすべて有向かすべて無向かのいずれかになります。第1入力値はリンク品種に関連するエージェント集合の名称を定義します。第2入力値は品種の単一のメンバーの名称を定義します。
Any link of the given link breed:
指定のリンク品種のリンクは:
Most often, the agentset is used in conjunction with ask to give commands to only the links of a particular breed.
多くの場合、このエージェント集合は特定の品種のリンクに対してのみコマンドを実行させるために、askと組み合わせて用いられます。
undirected-link-breed [streets street] undirected-link-breed [highways highway] to setup clear-all crt 2 ask turtle 0 [ create-street-with turtle 1 ] ask turtle 0 [ create-highway-with turtle 1 ] end ask turtle 0 [ show sort my-links ] ;; prints [(street 0 1) (highway 0 1)]を表示
See also: breed, directed-link-breed もご覧ください。
Unties end2 from end1 (sets tie-mode to "none") if they were previously tied together. If the link is an undirected link, then it will untie end1 from end2 as well. It does not remove the link between the two turtles.
終端1と終端2の間にタイがあれば、そのタイを解除します(を "none" に設定します)。リンクが無向リンクであれば、同様に終端1と終端2の間のタイを解除します。2つのタートルの間のリンクは除去しません。
See also: tie もご覧ください。
See the Tie section of the Programming Guide for more details.
詳細はプログラミングガイドの「タイ」節をご覧ください。
For each plot, runs that plot's update commands, including the update code for any pens in the plot.
各プロットに対して、プロット中の各ペンの更新コードを含む、プロットの更新コマンドを実行します。
tick has the same effect, so in models that use the tick counter, this primitive is not normally used. Models that use fractional ticks may need update-plots
, since tick-advance does not update the plots.
tickは同じ効果を持ちますので、ティックカウンターを使っているモデルでは、このプリミティブは通常は使われません。小数のティックを使っているモデルでは、tick-advanceはプロットを更新しませんので、update-plots
が必要です。
See the Plotting section of the Programming Guide for more details.
詳細はプログラミングガイドの「プロッティング」節をご覧ください。
See also: setup-plots もご覧ください。
Moves the turtle to the neighboring patch with the highest value for patch-variable. If no neighboring patch has a higher value than the current patch, the turtle stays put. If there are multiple patches with the same highest value, the turtle picks one randomly. Non-numeric values are ignored.
隣接するパッチのうちパッチ変数の値が最も大きいパッチへタートルが移動します。現在いるパッチよりも値が大きい隣接パッチが存在しない場合はタートルはその場にとどまります。複数のパッチが同じ最大値であるときは、タートルはその中から1個をランダムに選びます。数値でない値は無視されます。
uphill considers the eight neighboring patches; uphill4 only considers the four neighbors.
uphillでは8個の隣接パッチを考慮しますが、uphill4では4個の隣接パッチのみを考慮します。
Equivalent to the following code (assumes variable values are numeric):
以下のコードと同等です(変数値は数値であると仮定します):
move-to patch-here ;; go to patch centerパッチの中心へ移動 let p max-one-of neighbors [patch-variable] ;; or またはneighbors4 if [patch-variable] of p > patch-variable [ face p move-to p ]
Note that the turtle always ends up on a patch center and has a heading that is a multiple of 45 (uphill) or 90 (uphill4).
タートルは常にパッチの中心で動作を終了し、そのときの向きは45の倍数(uphill)もしくは90の倍数(uphill4)になります。
See also: downhill, downhill4 もご覧ください。
Opens a dialog that allows the user to choose an existing directory on the system.
ユーザーにシステム上の既存のディレクトリの選択を許可するダイアログを開きます。
It reports a string with the absolute path or false if the user cancels.
絶対パスの文字列、またはユーザーがキャンセルした場合はfalseを返します。
set-current-directory user-directory ;; Assumes the user will choose a directoryユーザーがディレクトリを選ぶと仮定
Opens a dialog that allows the user to choose an existing file on the system.
ユーザーにシステム上の既存のファイルの選択を許可するダイアログを開きます。
It reports a string with the absolute file path or false if the user cancels.
絶対パスの文字列、またはユーザーがキャンセルした場合はfalseを返します。
file-open user-file ;; Assumes the user will choose a fileユーザーがファイルを選ぶと仮定
Opens a dialog that allows the user to choose a location and name of a new file to be created. It reports a string with the absolute file path or false if the user cancels.
ユーザーに新規作成するファイルの場所と名前の選択を許可するダイアログを開きます。
file-open user-new-file ;; Assumes the user will choose a fileユーザーがファイルを選ぶと仮定
Note that this reporter doesn't actually create the file; normally you would create the file using file-open, as in the example.
このレポーターは実際にはファイルを作成しません。上記の例のように、ファイルを作成するには通常はfile-openを使います。
If the user chooses an existing file, they will be asked if they wish to replace it or not, but the reporter itself doesn't cause the file to be replaced. To do that you would use file-delete.
ユーザーが既存のファイルを選択した場合は、ファイルを置き換えて良いかを聞かれますが、レポーター自身はファイルを置き換えません。これを行うにはfile-deleteを使います。
Reports the string that a user types into an entry field in a dialog with title value.
値をタイトルとするダイアログの中のエントリフィールドの中にユーザーがタイプする文字列を返します。
value may be of any type, but is typically a string.
値はどのような種類でも可能ですが通常は文字列となります。
show user-input "What is your name?"
Opens a dialog with value displayed as the message.
メッセージとして表示される値とともにダイアログを開きます。
value may be of any type, but is typically a string.
値はどのような種類でも可能ですが通常は文字列となります。
user-message (word "There are " count turtles " turtles.")
Opens a dialog with value displayed as the message and list-of-choices displayed as a popup menu for the user to select from.
メッセージとして表示される値と、ユーザーがそこから選択できるポップアップメニューとして表示される選択肢のリストともにダイアログを開きます。
Reports the item in list-of-choices selected by the user.
選択肢のリストからユーザーが選択した要素を返します。
value may be of any type, but is typically a string.
値はどのような種類でも可能ですが通常は文字列となります。
if "yes" = user-one-of "Set up the model?" ["yes" "no"] [ setup ]
Reports true or false based on the user's response to value.
valueに対するユーザーの反応に基づいてtrueかfalseを返します。
value may be of any type, but is typically a string.
値はどのような種類でも可能ですが通常は文字列となります。
if user-yes-or-no? "Set up the model?" [ setup ]
Reports the sample variance of a list of numbers. Ignores other types of items.
数値のリストの不偏分散を返します。他のデータ型であれば無視します。
(Note that this computes an unbiased estimate of the variance for a sample, rather than for a whole population, using Bessel's correction.)
(このコマンドは母集団全体の分散ではなく、ベッセルの修正を用いて標本の不偏分散を計算します。)
The sample variance is the sum of the squares of the deviations of the numbers from their mean, divided by one less than the number of numbers in the list.
不偏分散は、平均値からの偏差の二乗和をリストの要素数引く1で割ることによって求められます。
show variance [2 7 4 3 5] => 3.7
Wait the given number of seconds. (This needn't be an integer; you can specify fractions of seconds.) Note that you can't expect complete precision; the agent will never wait less than the given amount, but might wait slightly more.
指定の数値の秒数だけ処理を待ちます。(整数である必要はありません。小数の秒数でも指定可能です。)完全に正確な秒数にはなりません。エージェントの待ち時間が指定の秒数よりも短くなることはありませんが、若干長くなることはありえます。
repeat 10 [ fd 1 wait 0.5 ]
While the agent is waiting, no other agents can do anything. Everything stops until the agent is done.
エージェントがwaitの状態にある間は他のエージェントは何もすることができません。エージェントが再実行するまではすべてが停止します。
See also: every もご覧ください。
Puts a spotlight on agent. In the 3D view the observer will also turn to face the subject.
エージェントにスポットライトをあてます。3Dビューではオブザーバーもまた対象を向くようになります。
See also: follow, subject, reset-perspective, watch-me もご覧ください。
Asks the observer to watch this agent.
オブザーバーに実行したタートルをwatchさせます。
See also: watch もご覧ください。
If reporter reports false, exit the loop. Otherwise run commands and repeat.
レポーターがfalseを返すときはループを抜けます。そうでなければコマンドを実行して繰り返します。
The reporter may have different values for different agents, so some agents may run commands a different number of times than other agents.
レポーターが異なるエージェントに対して異なる値を持つものであれば、いくつかのエージェントではコマンドを他のエージェントとは異なる回数だけ実行します。
while [any? other turtles-here] [ fd 1 ] ;; turtle moves until it finds a patch that has ;; no other turtles on itタートルが、他のタートルが乗っていないパッチを見つけるまで動き続けます
This is a built-in turtle variable. It holds the turtle's "who number" or ID number, an integer greater than or equal to zero. You cannot set this variable; a turtle's who number never changes.
組み込みのタートル変数です。タートルの"who番号"すなわちID番号を保有します。who番号は不変であり、外部から設定することはできません。
Who numbers start at 0. A dead turtle's number will not be reassigned to a new turtle until you use the clear-turtles or clear-all commands, at which time who numbering starts over again at 0.
who番号は0から始まる整数です。死んだタートルの番号はclear-turtlesかclear-allコマンドを使わない限り新しいタートルに再利用はされません。これらの番号を使うとwho番号はふたたび0から開始されます。
Example:
show [who] of turtles with [color = red] ;; prints a list of the who numbers of all red turtles ;; in the Command Center, in random orderすべての赤いタートルのwho番号のリストをコマンドセンターにランダムな順序で表示 crt 100 [ ifelse who < 50 [ set color red ] [ set color blue ] ] ;; turtles 0 through 49 are red, turtles 50 ;; through 99 are blueタートル0から49は赤、タートル50から99は青
You can use the turtle reporter to retrieve a turtle with a given who number. See also turtle.
指定のwho番号のタートルを得るにはturtleレポーターを使うことができます。turtleもご覧ください。
Note that who numbers aren't breed-specific. No two turtles can have the same who number, even if they are different breeds:
who番号は品種ごとについているわけではありません。品種が違っていたとしても2つのタートルが同じwho番号を持つことはありません。
clear-turtles create-frogs 1 create-mice 1 ask turtles [ print who ] ;; prints (in some random order):ランダムな順序で表示: ;; (frog 0): 0 ;; (mouse 1): 1
Even though we only have one mouse, it is mouse 1 not mouse 0, because the who number 0 was already taken by the frog.
Takes two inputs: on the left, an agentset (usually "turtles" or "patches"). On the right, a boolean reporter. Reports a new agentset containing only those agents that reported true -- in other words, the agents satisfying the given condition.
2つの入力値を取ります。左側はエージェント集合(通常はタートルかパッチ)です。右側は論理値を返すレポーターです。レポーターがtrueを返すエージェント、言い換えれば指定の条件を満たすエージェントのみを含む新たなエージェント集合を返します。
show count patches with [pcolor = red] ;; prints the number of red patches赤いパッチの数を表示します
Report the undirected link between turtle and the caller. If no link exists then it reports nobody.
タートルと実行したエージェントとの間の無向リンクを返します。もしリンクが存在しない場合はnobodyを返します。
crt 2 ask turtle 0 [ create-link-with turtle 1 show link-with turtle 1 ;; prints link 0 1リンク 0 1 を表示 ]
See also: in-link-from, out-link-to もご覧ください。
Takes two inputs: on the left, an agentset (usually "turtles" or "patches"). On the right, a reporter. Reports a new agentset containing all agents reporting the maximum value of the given reporter.
2つの入力値を取ります。左側はエージェント集合(通常はタートルかパッチ)です。右側はレポーターです。指定のレポーターで最大値を返すすべてのエージェントのみを含む新たなエージェント集合を返します。
show count patches with-max [pxcor] ;; prints the number of patches on the right edge右端のパッチの数を表示します
See also: max-one-of, max-n-of もご覧ください。
Takes two inputs: on the left, an agentset (usually "turtles" or "patches"). On the right, a reporter. Reports a new agentset containing only those agents that have the minimum value of the given reporter.
2つの入力値を取ります。左側はエージェント集合(通常はタートルかパッチ)です。右側はレポーターです。指定のレポーターで最小値を返すすべてのエージェントのみを含む新たなエージェント集合を返します。
show count patches with-min [pycor] ;; prints the number of patches on the bottom edge下端のパッチの数を表示します
See also: min-one-of, min-n-of もご覧ください。
The commands are run without affecting subsequent random events. This is useful for performing extra operations (such as output) without changing the outcome of a model.
実行中の他の乱数イベントに影響することなしにコマンドが実行されます。このコマンドはモデルの結果を変化させることなしに追加的な動作(たとえば出力)を実行したい場合に有用です。
Example:
;; Run #1:#1を実行: random-seed 50 setup repeat 10 [ go ] ;; Run #2:#2を実行: random-seed 50 setup with-local-randomness [ watch one-of turtles ] repeat 10 [ go ]
Since one-of is used inside with-local-randomness, both runs will be identical.
この例ではone-ofがwith-local-randomnessの内側で使われていますので、両方は独立に動作します。
Specifically how it works is, the state of the random number generator is remembered before the commands run, then restored afterwards. (If you want to run the commands with a fresh random state instead of the same random state that will be restored later, you can begin the commands with random-seed new-seed.)
これがどのように動作するかというと、乱数生成器の状態がコマンドを実行する前に記憶され、後で復元されます。(復元される乱数の状態の代わりにフレッシュな乱数の状態を使ってコマンドを実行したいときは、random-seed new-seedでコマンドを始めます。)
The following example demonstrates that the random number generator state is the same both before the commands run and afterwards.
次の例は乱数生成器の状態がコマンドの実行の前後で同じであることを表しています。
random-seed 10 with-local-randomness [ print n-values 10 [random 10] ] ;; prints [8 9 8 4 2 4 5 4 7 9] を表示 print n-values 10 [random 10] ;; prints [8 9 8 4 2 4 5 4 7 9] を表示
This primitive exists only for backwards compatibility. We don't recommend using it in new models.
このプリミティブは後方互換性の確保のために存在しています。新しいモデルでの使用は推奨しません。
The agent runs all the commands in the block without allowing other agents using ask-concurrent to "interrupt". That is, other agents are put "on hold" and do not run any commands until the commands in the block are finished.
エージェントが、他のエージェントがask-concurrentを使って中断することを許さずに、ブロック中のコマンドを実行します。つまり、他のエージェントは「待ち」の状態となり、ブロックのコマンドが完了するまでは何のコマンドも実行しません。
Note: This command is only useful in conjunction with ask-concurrent.
注意:このコマンドはask-concurrentと組み合わせたときのみ有用です。
See also: ask-concurrent もご覧ください。
Concatenates the inputs together and reports the result as a string.
入力値を結合して結果を文字列として返します。
show word "tur" "tle" => "turtle" word "a" 6 => "a6" set directory "c:\\foo\\fish\\" show word directory "bar.txt" => "c:\foo\fish\bar.txt" show word [1 54 8] "fishy" => "[1 54 8]fishy" show (word 3) => "3" show (word "a" "b" "c" 1 23) => "abc123"
These reporters give the total width and height of the NetLogo world.
これらのレポーターはNetLogoワールドの幅と高さを返します。
The width equals max-pxcor - min-pxcor + 1 and the height equals max-pycor - min-pycor + 1.
幅は max-pxcor - min-pxcor + 1 と等しくなり、高さは max-pycor - min-pycor + 1 と等しくなります。
See also: max-pxcor, max-pycor, min-pxcor, min-pycor もご覧ください。
wrap-color checks whether number is in the NetLogo color range of 0 to 140 (not including 140 itself). If it is not, wrap-color "wraps" the numeric input to the 0 to 140 range.
wrap-colorは数値が0から140のNetLogo色に含まれるかをチェックします(140自身は含みません)。含まれない場合は、wrap-colorは数値の入力値を0から140の範囲に"丸めます"。
The wrapping is done by repeatedly adding or subtracting 140 from the given number until it is in the 0 to 140 range. (This is the same wrapping that is done automatically if you assign an out-of-range number to the color turtle variable or pcolor patch variable.)
丸める計算は、指定の数値に140を足すか引くかを0から140の範囲に収まるまで繰り返します。(この計算は、タートル変数のcolorやパッチ変数のpcolorの範囲外の数値を設定したときに自動的に行われる計算と同じです。)
show wrap-color 150 => 10 show wrap-color -10 => 130
This command will output value, which can be a number, string, list, boolean, or nobody to the Command Center, not followed by a carriage return (unlike print and show).
コマンドセンターに、空白、値の順で出力します。値は数値、文字列、リスト、boolean、nobodyのいずれかとなります。(printやshowとは異なり、改行記号は伴いません。)
This agent is not printed before the value, unlike show. Its output also includes quotes around strings and is prepended with a space.
showとは異なり、実行したエージェントは値の前には表示されません。出力が文字列の場合は引用符で囲まれます。
write "hello world" => "hello world"
See also: print, show, type, output-write もご覧ください。
This is a built-in turtle variable. It holds the current x coordinate of the turtle. You can set this variable to change the turtle's location.
組み込みのタートル変数です。タートルの現在のx座標を保有します。値を設定すればタートルの位置を変えられます。
This variable is always greater than or equal to (min-pxcor - 0.5) and strictly less than (max-pxcor + 0.5).
この変数は常に、(min-pxcor - 0.5) と等しいかより大きく、(max-pxcor + 0.5) より小さくなります。
See also: setxy, ycor, pxcor, pycor もご覧ください。
Reports true if either boolean1 or boolean2 is true, but not when both are true.
条件1か条件2のいずれか一方がtrueであればtrueを返します。両方ともtrueである場合はfalseを返します。
if (pxcor > 0) xor (pycor > 0) [ set pcolor blue ] ;; upper-left and lower-right quadrants turn blue左上と右下の象限が青に変わる
This is a built-in turtle variable. It holds the current y coordinate of the turtle. You can set this variable to change the turtle's location.
組み込みのタートル変数です。タートルの現在のy座標を保有します。値を設定すればタートルの位置を変えられます。
This variable is always greater than or equal to (min-pycor - 0.5) and strictly less than (max-pycor + 0.5).
この変数は常に、(min-pycor - 0.5) と等しいかより大きく、(max-pycor + 0.5) より小さくなります。
See also: setxy, xcor, pxcor, pycor もご覧ください。
These special variable names refer to the inputs to a task, in order by number.
これらの特殊な変数名はタスクへの入力値を数値の順に参照します。
? is always equivalent to ?1.
?は常に?1と等しくなります。
You may not set these variables, and you may not use them except in the context of a task.
これらの変数をsetすることはなく、またタスクのコンテキスト以外で使用することはありません。
Tasks are commonly used with the primitives foreach, map, reduce, filter, sort-by, and n-values. See those entries for example usage.
タスクはforeach, map, reduce, filter, sort-by, n-valuesの各プリミティブと共に使われます。使用法は各項目をご覧ください。
See the Tasks section of the Programming Guide for more details.
詳細はプログラミングガイドの「タスク」節をご覧ください。