From 22cdb9ee90965a6cad96b4914be0d751a3632e84 Mon Sep 17 00:00:00 2001 From: Leushenko Date: Thu, 9 May 2013 14:58:41 +0100 Subject: [PATCH 01/24] Added BlitzBasic --- lib/linguist/languages.yml | 9 + samples/BlitzBasic/HalfAndDouble.bb | 147 +++++++++++ samples/BlitzBasic/LList.bb | 369 ++++++++++++++++++++++++++++ samples/BlitzBasic/PObj.bb | 66 +++++ 4 files changed, 591 insertions(+) create mode 100644 samples/BlitzBasic/HalfAndDouble.bb create mode 100644 samples/BlitzBasic/LList.bb create mode 100644 samples/BlitzBasic/PObj.bb diff --git a/lib/linguist/languages.yml b/lib/linguist/languages.yml index 6b52b301..6b206b98 100644 --- a/lib/linguist/languages.yml +++ b/lib/linguist/languages.yml @@ -134,6 +134,15 @@ Batchfile: Befunge: primary_extension: .befunge +BlitzBasic: + type: programming + aliases: + - blitzplus + - blitz3d + primary_extension: .bb + extensions: + - .decls + BlitzMax: primary_extension: .bmx diff --git a/samples/BlitzBasic/HalfAndDouble.bb b/samples/BlitzBasic/HalfAndDouble.bb new file mode 100644 index 00000000..6b8aa0d3 --- /dev/null +++ b/samples/BlitzBasic/HalfAndDouble.bb @@ -0,0 +1,147 @@ + +Local bk = CreateBank(8) +PokeFloat bk, 0, -1 +Print Bin(PeekInt(bk, 0)) +Print %1000000000000000 +Print Bin(1 Shl 31) +Print $1f +Print $ff +Print $1f + (127 - 15) +Print Hex(%01111111100000000000000000000000) +Print Hex(~%11111111100000000000000000000000) + +Print Bin(FloatToHalf(-2.5)) +Print HalfToFloat(FloatToHalf(-200000000000.0)) + +Print Bin(FToI(-2.5)) + +WaitKey +End + + +; Half-precision (16-bit) arithmetic library +;============================================ + +Global Half_CBank_ + +Function FToI(f#) + If Half_CBank_ = 0 Then Half_CBank_ = CreateBank(4) + PokeFloat Half_CBank_, 0, f + Return PeekInt(Half_CBank_, 0) +End Function + +Function HalfToFloat#(h) + Local signBit, exponent, fraction, fBits + + signBit = (h And 32768) <> 0 + exponent = (h And %0111110000000000) Shr 10 + fraction = (h And %0000001111111111) + + If exponent = $1F Then exponent = $FF : ElseIf exponent Then exponent = (exponent - 15) + 127 + fBits = (signBit Shl 31) Or (exponent Shl 23) Or (fraction Shl 13) + + If Half_CBank_ = 0 Then Half_CBank_ = CreateBank(4) + PokeInt Half_CBank_, 0, fBits + Return PeekFloat(Half_CBank_, 0) +End Function + +Function FloatToHalf(f#) + Local signBit, exponent, fraction, fBits + + If Half_CBank_ = 0 Then Half_CBank_ = CreateBank(4) + PokeFloat Half_CBank_, 0, f + fBits = PeekInt(Half_CBank_, 0) + + signBit = (fBits And (1 Shl 31)) <> 0 + exponent = (fBits And $7F800000) Shr 23 + fraction = fBits And $007FFFFF + + If exponent + exponent = exponent - 127 + If Abs(exponent) > $1F + If exponent <> ($FF - 127) Then fraction = 0 + exponent = $1F * Sgn(exponent) + Else + exponent = exponent + 15 + EndIf + exponent = exponent And %11111 + EndIf + fraction = fraction Shr 13 + + Return (signBit Shl 15) Or (exponent Shl 10) Or fraction +End Function + +Function HalfAdd(l, r) + +End Function + +Function HalfSub(l, r) + +End Function + +Function HalfMul(l, r) + +End Function + +Function HalfDiv(l, r) + +End Function + +Function HalfLT(l, r) + +End Function + +Function HalfGT(l, r) + +End Function + + +; Double-precision (64-bit) arithmetic library) +;=============================================== + +Global DoubleOut[1], Double_CBank_ + +Function DoubleToFloat#(d[1]) + +End Function + +Function FloatToDouble(f#) + +End Function + +Function IntToDouble(i) + +End Function + +Function SefToDouble(s, e, f) + +End Function + +Function DoubleAdd(l, r) + +End Function + +Function DoubleSub(l, r) + +End Function + +Function DoubleMul(l, r) + +End Function + +Function DoubleDiv(l, r) + +End Function + +Function DoubleLT(l, r) + +End Function + +Function DoubleGT(l, r) + +End Function + + +;~IDEal Editor Parameters: +;~F#1A#20#2F +;~C#Blitz3D \ No newline at end of file diff --git a/samples/BlitzBasic/LList.bb b/samples/BlitzBasic/LList.bb new file mode 100644 index 00000000..49bf4eaa --- /dev/null +++ b/samples/BlitzBasic/LList.bb @@ -0,0 +1,369 @@ + +; Double-linked list container class +;==================================== + +; with thanks to MusicianKool, for concept and issue fixes + + +Type LList + Field head_.ListNode + Field tail_.ListNode +End Type + +Type ListNode + Field pv_.ListNode + Field nx_.ListNode + Field Value +End Type + +Type Iterator + Field Value + Field l_.LList + Field cn_.ListNode, cni_ +End Type + + +;Create a new LList object +Function CreateList.LList() + Local l.LList = New LList + + l\head_ = New ListNode + l\tail_ = New ListNode + + l\head_\nx_ = l\tail_ ;End caps + l\head_\pv_ = l\head_ ;These make it more or less safe to iterate freely + l\head_\Value = 0 + + l\tail_\nx_ = l\tail_ + l\tail_\pv_ = l\head_ + l\tail_\Value = 0 + + Return l +End Function + +;Free a list and all elements (not any values) +Function FreeList(l.LList) + ClearList l + Delete l\head_ + Delete l\tail_ + Delete l +End Function + +;Remove all the elements from a list (does not free values) +Function ClearList(l.LList) + Local n.ListNode = l\head_\nx_ + While n <> l\tail_ + Local nx.ListNode = n\nx_ + Delete n + n = nx + Wend + l\head_\nx_ = l\tail_ + l\tail_\pv_ = l\head_ +End Function + +;Count the number of elements in a list (slow) +Function ListLength(l.LList) + Local i.Iterator = GetIterator(l), elems + While EachIn(i) + elems = elems + 1 + Wend + Return elems +End Function + +;Return True if a list contains a given value +Function ListContains(l.LList, Value) + Return (ListFindNode(l, Value) <> Null) +End Function + +;Create a linked list from the intvalues in a bank (slow) +Function ListFromBank.LList(bank) + Local l.LList = CreateList() + Local size = BankSize(bank), p + + For p = 0 To size - 4 Step 4 + ListAddLast l, PeekInt(bank, p) + Next + + Return l +End Function + +;Create a bank containing all the values in a list (slow) +Function ListToBank(l.LList) + Local size = ListLength(l) * 4 + Local bank = CreateBank(size) + + Local i.Iterator = GetIterator(l), p = 0 + While EachIn(i) + PokeInt bank, p, i\Value + p = p + 4 + Wend + + Return bank +End Function + +;Swap the contents of two list objects +Function SwapLists(l1.LList, l2.LList) + Local tempH.ListNode = l1\head_, tempT.ListNode = l1\tail_ + l1\head_ = l2\head_ + l1\tail_ = l2\tail_ + l2\head_ = tempH + l2\tail_ = tempT +End Function + +;Create a new list containing the same values as the first +Function CopyList.LList(lo.LList) + Local ln.LList = CreateList() + Local i.Iterator = GetIterator(lo) : While EachIn(i) + ListAddLast ln, i\Value + Wend + Return ln +End Function + +;Reverse the order of elements of a list +Function ReverseList(l.LList) + Local n1.ListNode, n2.ListNode, tmp.ListNode + + n1 = l\head_ + n2 = l\head_\nx_ + + While n1 <> l\tail_ + n1\pv_ = n2 + tmp = n2\nx_ + n2\nx_ = n1 + n1 = n2 + n2 = tmp + Wend + + tmp = l\head_ + l\head_ = l\tail_ + l\tail_ = tmp + + l\head_\pv_ = l\head_ + l\tail_\nx_ = l\tail_ +End Function + +;Search a list to retrieve the first node with the given value +Function ListFindNode.ListNode(l.LList, Value) + Local n.ListNode = l\head_\nx_ + + While n <> l\tail_ + If n\Value = Value Then Return n + n = n\nx_ + Wend + + Return Null +End Function + +;Append a value to the end of a list (fast) and return the node +Function ListAddLast.ListNode(l.LList, Value) + Local n.ListNode = New ListNode + + n\pv_ = l\tail_\pv_ + n\nx_ = l\tail_ + n\Value = Value + + l\tail_\pv_ = n + n\pv_\nx_ = n + + Return n +End Function + +;Attach a value to the start of a list (fast) and return the node +Function ListAddFirst.ListNode(l.LList, Value) + Local n.ListNode = New ListNode + + n\pv_ = l\head_ + n\nx_ = l\head_\nx_ + n\Value = Value + + l\head_\nx_ = n + n\nx_\pv_ = n + + Return n +End Function + +;Remove the first occurence of the given value from a list +Function ListRemove(l.LList, Value) + Local n.ListNode = ListFindNode(l, Value) + If n <> Null Then RemoveListNode n +End Function + +;Remove a node from a list +Function RemoveListNode(n.ListNode) + n\pv_\nx_ = n\nx_ + n\nx_\pv_ = n\pv_ + Delete n +End Function + +;Return the value of the element at the given position from the start of the list, +;or backwards from the end of the list for a negative index +Function ValueAtIndex(l.LList, index) + Local n.ListNode = ListNodeAtIndex(l, index) + If n <> Null Then Return n\Value : Else Return 0 +End Function + +;Return the ListNode at the given position from the start of the list, or backwards +;from the end of the list for a negative index, or Null if invalid +Function ListNodeAtIndex.ListNode(l.LList, index) + Local e, n.ListNode + + If index >= 0 + n = l\head_ + For e = 0 To index + n = n\nx_ + Next + If n = l\tail_ Then n = Null ;Beyond the end of the list - not valid + + Else ;Negative index - count backward + n = l\tail_ + For e = 0 To index Step -1 + n = n\pv_ + Next + If n = l\head_ Then n = Null ;Before the start of the list - not valid + + EndIf + + Return n +End Function + +;Replace a value at the given position (added by MusicianKool) +Function ReplaceValueAtIndex(l.LList,index,value) + Local n.ListNode = ListNodeAtIndex(l,index) + If n <> Null Then n\Value = value:Else Return 0 +End Function + +;Remove and return a value at the given position (added by MusicianKool) +Function RemoveNodeAtIndex(l.LList,index) + Local n.ListNode = ListNodeAtIndex(l,index),tval + If n <> Null Then tval = n\Value:RemoveListNode(n):Return tval:Else Return 0 +End Function + +;Retrieve the first value from a list +Function ListFirst(l.LList) + If l\head_\nx_ <> l\tail_ Then Return l\head_\nx_\Value +End Function + +;Retrieve the last value from a list +Function ListLast(l.LList) + If l\tail_\pv_ <> l\head_ Then Return l\tail_\pv_\Value +End Function + +;Remove the first element from a list, and return its value +Function ListRemoveFirst(l.LList) + Local val + If l\head_\nx_ <> l\tail_ + val = l\head_\nx_\Value + RemoveListNode l\head_\nx_ + EndIf + Return val +End Function + +;Remove the last element from a list, and return its value +Function ListRemoveLast(l.LList) + Local val + If l\tail_\pv_ <> l\head_ + val = l\tail_\pv_\Value + RemoveListNode l\tail_\pv_ + EndIf + Return val +End Function + +;Insert a value into a list before the specified node, and return the new node +Function InsertBeforeNode.ListNode(Value, n.ListNode) + Local bef.ListNode = New ListNode + + bef\pv_ = n\pv_ + bef\nx_ = n + bef\Value = Value + + n\pv_ = bef + bef\pv_\nx_ = bef + + Return bef +End Function + +;Insert a value into a list after the specified node, and return then new node +Function InsertAfterNode.ListNode(Value, n.ListNode) + Local aft.ListNode = New ListNode + + aft\nx_ = n\nx_ + aft\pv_ = n + aft\Value = Value + + n\nx_ = aft + aft\nx_\pv_ = aft + + Return aft +End Function + +;Get an iterator object to use with a loop +;This function means that most programs won't have to think about deleting iterators manually +;(in general only a small, constant number will be created) +Function GetIterator.Iterator(l.LList) + Local i.Iterator + + If l = Null Then RuntimeError "Cannot create Iterator for Null" + + For i = Each Iterator ;See if there's an available iterator at the moment + If i\l_ = Null Then Exit + Next + + If i = Null Then i = New Iterator ;If there wasn't, create one + + i\l_ = l + i\cn_ = l\head_ + i\cni_ = -1 + i\Value = 0 ;No especial reason why this has to be anything, but meh + + Return i +End Function + +;Use as the argument to While to iterate over the members of a list +Function EachIn(i.Iterator) + + i\cn_ = i\cn_\nx_ + + If i\cn_ <> i\l_\tail_ ;Still items in the list + i\Value = i\cn_\Value + i\cni_ = i\cni_ + 1 + Return True + + Else + i\l_ = Null ;Disconnect from the list, having reached the end + i\cn_ = Null + i\cni_ = -1 + Return False + + EndIf +End Function + +;Remove from the containing list the element currently pointed to by an iterator +Function IteratorRemove(i.Iterator) + If (i\cn_ <> i\l_\head_) And (i\cn_ <> i\l_\tail_) + Local temp.ListNode = i\cn_ + + i\cn_ = i\cn_\pv_ + i\cni_ = i\cni_ - 1 + i\Value = 0 + + RemoveListNode temp + + Return True + Else + Return False + EndIf +End Function + +;Call this before breaking out of an EachIn loop, to disconnect the iterator from the list +Function IteratorBreak(i.Iterator) + i\l_ = Null + i\cn_ = Null + i\cni_ = -1 + i\Value = 0 +End Function + + +;~IDEal Editor Parameters: +;~F#5#A#10#18#2A#32#3E#47#4C#58#66#6F#78#8F#9B#A9#B7#BD#C5#CC +;~F#E3#E9#EF#F4#F9#103#10D#11B#12B#13F#152#163 +;~C#Blitz3D \ No newline at end of file diff --git a/samples/BlitzBasic/PObj.bb b/samples/BlitzBasic/PObj.bb new file mode 100644 index 00000000..2989f98e --- /dev/null +++ b/samples/BlitzBasic/PObj.bb @@ -0,0 +1,66 @@ + +Local i, start, result + +Local s.Sum3Obj = New Sum3Obj + +For i = 1 To 100000 + s = New Sum3Obj + result = Handle Before s + Delete s +Next + +start = MilliSecs() +For i = 1 To 1000000 + result = Sum3_(MakeSum3Obj(i, i, i)) +Next +start = MilliSecs() - start +Print start + +start = MilliSecs() +For i = 1 To 1000000 + result = Sum3(i, i, i) +Next +start = MilliSecs() - start +Print start + +WaitKey +End + + +Function Sum3(a, b, c) + Return a + b + c +End Function + + +Type Sum3Obj + Field isActive + Field a, b, c +End Type + +Function MakeSum3Obj(a, b, c) + Local s.Sum3Obj = Last Sum3Obj + If s\isActive Then s = New Sum3Obj + s\isActive = True + s\a = a + s\b = b + s\c = c + + Restore label + Read foo + + Return Handle(s) +End Function + +.label +Data (10 + 2), 12, 14 +: +Function Sum3_(a_) + Local a.Sum3Obj = Object.Sum3Obj a_ + Local return_ = a\a + a\b + a\c + Insert a Before First Sum3Obj :: a\isActive = False + Return return_ +End Function + + +;~IDEal Editor Parameters: +;~C#Blitz3D \ No newline at end of file From 562ec136969f4db405a4b3d5c3b80d4a5d02fabd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frans=20Krojega=CC=8Ard?= Date: Tue, 5 Nov 2013 09:00:58 +0100 Subject: [PATCH 02/24] Added node_modules/ to generated files. --- lib/linguist/generated.rb | 11 ++++++++++- test/test_blob.rb | 2 ++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/linguist/generated.rb b/lib/linguist/generated.rb index db591ae0..ea0a40ad 100644 --- a/lib/linguist/generated.rb +++ b/lib/linguist/generated.rb @@ -59,7 +59,8 @@ module Linguist generated_net_docfile? || generated_net_designer_file? || generated_protocol_buffer? || - generated_jni_header? + generated_jni_header? || + node_modules? end # Internal: Is the blob an XCode project file? @@ -193,5 +194,13 @@ module Linguist return lines[0].include?("/* DO NOT EDIT THIS FILE - it is machine generated */") return lines[1].include?("#include ") end + + # node_modules/ can contain large amounts of files, in general not meant + # for humans in pull requests. + # + # Returns true or false. + def node_modules? + !!name.match(/node_modules\//) + end end end diff --git a/test/test_blob.rb b/test/test_blob.rb index 7a1821d8..252de56d 100644 --- a/test/test_blob.rb +++ b/test/test_blob.rb @@ -204,6 +204,8 @@ class TestBlob < Test::Unit::TestCase # Minified CSS assert !blob("CSS/bootstrap.css").generated? assert blob("CSS/bootstrap.min.css").generated? + + assert Linguist::Generated.generated?("node_modules/grunt/lib/grunt.js", nil) end def test_vendored From 8c5f1e201e95893b21f78ea865d6f8a490698595 Mon Sep 17 00:00:00 2001 From: Lukas Elmer Date: Wed, 6 Nov 2013 02:44:07 +0100 Subject: [PATCH 03/24] Describe how to update samples.json Describe how to update samples.json after adding new samples. --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 8a084513..f17de17b 100644 --- a/README.md +++ b/README.md @@ -88,6 +88,10 @@ We try to only add languages once they have some usage on GitHub, so please note Almost all bug fixes or new language additions should come with some additional code samples. Just drop them under [`samples/`](https://github.com/github/linguist/tree/master/samples) in the correct subdirectory and our test suite will automatically test them. In most cases you shouldn't need to add any new assertions. +To update the samples.json after adding new files to [`samples/`](https://github.com/github/linguist/tree/master/samples): + + bundle exec rake samples + ### Testing Sometimes getting the tests running can be too much work, especially if you don't have much Ruby experience. It's okay, be lazy and let our build bot [Travis](http://travis-ci.org/#!/github/linguist) run the tests for you. Just open a pull request and the bot will start cranking away. From 92282e36775205c5a7f037e870fb4f49fd73e104 Mon Sep 17 00:00:00 2001 From: Bryan Ricker Date: Tue, 5 Nov 2013 18:28:01 -0800 Subject: [PATCH 04/24] Add Appraisals to Ruby filenames --- lib/linguist/languages.yml | 1 + lib/linguist/samples.json | 1 + samples/Ruby/filenames/Appraisals | 7 +++++++ 3 files changed, 9 insertions(+) create mode 100644 samples/Ruby/filenames/Appraisals diff --git a/lib/linguist/languages.yml b/lib/linguist/languages.yml index 983ea467..bc854a52 100644 --- a/lib/linguist/languages.yml +++ b/lib/linguist/languages.yml @@ -1311,6 +1311,7 @@ Ruby: - .thor - .watchr filenames: + - Appraisals - Berksfile - Gemfile - Guardfile diff --git a/lib/linguist/samples.json b/lib/linguist/samples.json index 8289db2a..3d5135f5 100644 --- a/lib/linguist/samples.json +++ b/lib/linguist/samples.json @@ -430,6 +430,7 @@ "ack" ], "Ruby": [ + "Appraisals", "Capfile", "Rakefile" ], diff --git a/samples/Ruby/filenames/Appraisals b/samples/Ruby/filenames/Appraisals new file mode 100644 index 00000000..dea46a60 --- /dev/null +++ b/samples/Ruby/filenames/Appraisals @@ -0,0 +1,7 @@ +appraise "rails32" do + gem 'rails', '~> 3.2.0' +end + +appraise "rails40" do + gem 'rails', '~> 4.0.0' +end From 72b8e1c76f0bd0b9879f9f3dc5a375b1593bc619 Mon Sep 17 00:00:00 2001 From: Gordon Smith Date: Mon, 19 Aug 2013 09:18:25 +0100 Subject: [PATCH 05/24] Uppercase "Ecl" language to "ECL" Signed-off-by: Gordon Smith --- lib/linguist/languages.yml | 2 +- lib/linguist/samples.json | 8 ++++---- samples/{Ecl => ECL2}/sample.ecl | 0 3 files changed, 5 insertions(+), 5 deletions(-) rename samples/{Ecl => ECL2}/sample.ecl (100%) diff --git a/lib/linguist/languages.yml b/lib/linguist/languages.yml index 983ea467..f3d81bb0 100644 --- a/lib/linguist/languages.yml +++ b/lib/linguist/languages.yml @@ -408,7 +408,7 @@ Ecere Projects: lexer: JSON primary_extension: .epj -Ecl: +ECL: type: programming color: "#8a1267" primary_extension: .ecl diff --git a/lib/linguist/samples.json b/lib/linguist/samples.json index 8289db2a..0d923f22 100644 --- a/lib/linguist/samples.json +++ b/lib/linguist/samples.json @@ -77,7 +77,7 @@ "DM": [ ".dm" ], - "Ecl": [ + "ECL": [ ".ecl" ], "edn": [ @@ -13359,7 +13359,7 @@ "#undef": 1, "Undefine": 1 }, - "Ecl": { + "ECL": { "#option": 1, "(": 32, "true": 1, @@ -42479,7 +42479,7 @@ "Dart": 68, "Diff": 16, "DM": 169, - "Ecl": 281, + "ECL": 281, "edn": 227, "Elm": 628, "Emacs Lisp": 1756, @@ -42602,7 +42602,7 @@ "Dart": 1, "Diff": 1, "DM": 1, - "Ecl": 1, + "ECL": 1, "edn": 1, "Elm": 3, "Emacs Lisp": 2, diff --git a/samples/Ecl/sample.ecl b/samples/ECL2/sample.ecl similarity index 100% rename from samples/Ecl/sample.ecl rename to samples/ECL2/sample.ecl From 940df300e89accb534acaf625fffc22e7aba14c7 Mon Sep 17 00:00:00 2001 From: Gordon Smith Date: Wed, 6 Nov 2013 09:17:21 +0000 Subject: [PATCH 06/24] Uppercase "ECL" Sample folder Signed-off-by: Gordon Smith --- samples/{ECL2 => ECL}/sample.ecl | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename samples/{ECL2 => ECL}/sample.ecl (100%) diff --git a/samples/ECL2/sample.ecl b/samples/ECL/sample.ecl similarity index 100% rename from samples/ECL2/sample.ecl rename to samples/ECL/sample.ecl From 8b8123a3c1251fdae7e6c2d704bcd77bdfdbeadd Mon Sep 17 00:00:00 2001 From: Ted Nyman Date: Wed, 6 Nov 2013 20:17:47 -0800 Subject: [PATCH 07/24] Add TeX as detectable markup --- lib/linguist/language.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/linguist/language.rb b/lib/linguist/language.rb index e043be78..a8dc8f9f 100644 --- a/lib/linguist/language.rb +++ b/lib/linguist/language.rb @@ -27,7 +27,7 @@ module Linguist # # Returns an array def self.detectable_markup - ["CSS", "Less", "Sass"] + ["CSS", "Less", "Sass", "TeX"] end # Internal: Create a new Language object From 4f547d79a9502d81fb54cc5554e054dfcf1fa5a0 Mon Sep 17 00:00:00 2001 From: Ted Nyman Date: Thu, 7 Nov 2013 17:25:05 -0800 Subject: [PATCH 08/24] 2.0.0 Ruby builds --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index b24209c5..7277f2f7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,7 @@ rvm: - 1.8.7 - 1.9.2 - 1.9.3 + - 2.0.0 - ree notifications: disabled: true From 77c7ee6d2e0643b1ba1b6fc136e12f751b3a87c7 Mon Sep 17 00:00:00 2001 From: Ted Nyman Date: Thu, 7 Nov 2013 17:26:20 -0800 Subject: [PATCH 09/24] Update samples --- lib/linguist/samples.json | 375 +++++++++++++++++++++++++++++++++++++- 1 file changed, 367 insertions(+), 8 deletions(-) diff --git a/lib/linguist/samples.json b/lib/linguist/samples.json index a1685bc1..f7b0d2e1 100644 --- a/lib/linguist/samples.json +++ b/lib/linguist/samples.json @@ -21,6 +21,9 @@ "Awk": [ ".awk" ], + "BlitzBasic": [ + ".bb" + ], "Bluespec": [ ".bsv" ], @@ -468,8 +471,8 @@ ".gemrc" ] }, - "tokens_total": 418245, - "languages_total": 479, + "tokens_total": 420318, + "languages_total": 483, "tokens": { "ABAP": { "*/**": 1, @@ -2016,6 +2019,359 @@ "fragments": 1, "END": 1 }, + "BlitzBasic": { + "Local": 34, + "bk": 3, + "CreateBank": 5, + "(": 125, + ")": 126, + "PokeFloat": 3, + "-": 24, + "Print": 13, + "Bin": 4, + "PeekInt": 4, + "%": 6, + "Shl": 7, + "f": 5, + "ff": 1, + "+": 11, + "Hex": 2, + "FloatToHalf": 3, + "HalfToFloat": 1, + "FToI": 2, + "WaitKey": 2, + "End": 58, + ";": 57, + "Half": 1, + "precision": 2, + "bit": 2, + "arithmetic": 2, + "library": 2, + "Global": 2, + "Half_CBank_": 13, + "Function": 101, + "f#": 3, + "If": 25, + "Then": 18, + "Return": 36, + "HalfToFloat#": 1, + "h": 4, + "signBit": 6, + "exponent": 22, + "fraction": 9, + "fBits": 8, + "And": 8, + "<": 18, + "Shr": 3, + "F": 3, + "FF": 2, + "ElseIf": 1, + "Or": 4, + "PokeInt": 2, + "PeekFloat": 1, + "F800000": 1, + "FFFFF": 1, + "Abs": 1, + "*": 2, + "Sgn": 1, + "Else": 7, + "EndIf": 7, + "HalfAdd": 1, + "l": 84, + "r": 12, + "HalfSub": 1, + "HalfMul": 1, + "HalfDiv": 1, + "HalfLT": 1, + "HalfGT": 1, + "Double": 2, + "DoubleOut": 1, + "[": 2, + "]": 2, + "Double_CBank_": 1, + "DoubleToFloat#": 1, + "d": 1, + "FloatToDouble": 1, + "IntToDouble": 1, + "i": 49, + "SefToDouble": 1, + "s": 12, + "e": 4, + "DoubleAdd": 1, + "DoubleSub": 1, + "DoubleMul": 1, + "DoubleDiv": 1, + "DoubleLT": 1, + "DoubleGT": 1, + "IDEal": 3, + "Editor": 3, + "Parameters": 3, + "F#1A#20#2F": 1, + "C#Blitz3D": 3, + "linked": 2, + "list": 32, + "container": 1, + "class": 1, + "with": 3, + "thanks": 1, + "to": 11, + "MusicianKool": 3, + "for": 3, + "concept": 1, + "and": 9, + "issue": 1, + "fixes": 1, + "Type": 8, + "LList": 3, + "Field": 10, + "head_.ListNode": 1, + "tail_.ListNode": 1, + "ListNode": 8, + "pv_.ListNode": 1, + "nx_.ListNode": 1, + "Value": 37, + "Iterator": 2, + "l_.LList": 1, + "cn_.ListNode": 1, + "cni_": 8, + "Create": 4, + "a": 46, + "new": 4, + "object": 2, + "CreateList.LList": 1, + "l.LList": 20, + "New": 11, + "head_": 35, + "tail_": 34, + "nx_": 33, + "caps": 1, + "pv_": 27, + "These": 1, + "make": 1, + "it": 1, + "more": 1, + "or": 4, + "less": 1, + "safe": 1, + "iterate": 2, + "freely": 1, + "Free": 1, + "all": 3, + "elements": 4, + "not": 4, + "any": 1, + "values": 4, + "FreeList": 1, + "ClearList": 2, + "Delete": 6, + "Remove": 7, + "the": 52, + "from": 15, + "does": 1, + "free": 1, + "n.ListNode": 12, + "While": 7, + "n": 54, + "nx.ListNode": 1, + "nx": 1, + "Wend": 6, + "Count": 1, + "number": 1, + "of": 16, + "in": 4, + "slow": 3, + "ListLength": 2, + "i.Iterator": 6, + "GetIterator": 3, + "elems": 4, + "EachIn": 5, + "True": 4, + "if": 2, + "contains": 1, + "given": 7, + "value": 16, + "ListContains": 1, + "ListFindNode": 2, + "Null": 15, + "intvalues": 1, + "bank": 8, + "ListFromBank.LList": 1, + "CreateList": 2, + "size": 4, + "BankSize": 1, + "p": 7, + "For": 6, + "To": 6, + "Step": 2, + "ListAddLast": 2, + "Next": 7, + "containing": 3, + "ListToBank": 1, + "Swap": 1, + "contents": 1, + "two": 1, + "objects": 1, + "SwapLists": 1, + "l1.LList": 1, + "l2.LList": 1, + "tempH.ListNode": 1, + "l1": 4, + "tempT.ListNode": 1, + "l2": 4, + "tempH": 1, + "tempT": 1, + "same": 1, + "as": 2, + "first": 5, + "CopyList.LList": 1, + "lo.LList": 1, + "ln.LList": 1, + "lo": 1, + "ln": 2, + "Reverse": 1, + "order": 1, + "ReverseList": 1, + "n1.ListNode": 1, + "n2.ListNode": 1, + "tmp.ListNode": 1, + "n1": 5, + "n2": 6, + "tmp": 4, + "Search": 1, + "retrieve": 1, + "node": 8, + "ListFindNode.ListNode": 1, + "Append": 1, + "end": 5, + "fast": 2, + "return": 7, + "ListAddLast.ListNode": 1, + "Attach": 1, + "start": 13, + "ListAddFirst.ListNode": 1, + "occurence": 1, + "ListRemove": 1, + "RemoveListNode": 6, + "element": 4, + "at": 5, + "position": 4, + "backwards": 2, + "negative": 2, + "index": 13, + "ValueAtIndex": 1, + "ListNodeAtIndex": 3, + "invalid": 1, + "ListNodeAtIndex.ListNode": 1, + "Beyond": 1, + "valid": 2, + "Negative": 1, + "count": 1, + "backward": 1, + "Before": 3, + "Replace": 1, + "added": 2, + "by": 3, + "ReplaceValueAtIndex": 1, + "RemoveNodeAtIndex": 1, + "tval": 3, + "Retrieve": 2, + "ListFirst": 1, + "last": 2, + "ListLast": 1, + "its": 2, + "ListRemoveFirst": 1, + "val": 6, + "ListRemoveLast": 1, + "Insert": 3, + "into": 2, + "before": 2, + "specified": 2, + "InsertBeforeNode.ListNode": 1, + "bef.ListNode": 1, + "bef": 7, + "after": 1, + "then": 1, + "InsertAfterNode.ListNode": 1, + "aft.ListNode": 1, + "aft": 7, + "Get": 1, + "an": 4, + "iterator": 4, + "use": 1, + "loop": 2, + "This": 1, + "function": 1, + "means": 1, + "that": 1, + "most": 1, + "programs": 1, + "won": 1, + "available": 1, + "moment": 1, + "l_": 7, + "Exit": 1, + "there": 1, + "wasn": 1, + "t": 1, + "create": 1, + "one": 1, + "cn_": 12, + "No": 1, + "especial": 1, + "reason": 1, + "why": 1, + "this": 2, + "has": 1, + "be": 1, + "anything": 1, + "but": 1, + "meh": 1, + "Use": 1, + "argument": 1, + "over": 1, + "members": 1, + "Still": 1, + "items": 1, + "Disconnect": 1, + "having": 1, + "reached": 1, + "False": 3, + "currently": 1, + "pointed": 1, + "IteratorRemove": 1, + "temp.ListNode": 1, + "temp": 1, + "Call": 1, + "breaking": 1, + "out": 1, + "disconnect": 1, + "IteratorBreak": 1, + "F#5#A#10#18#2A#32#3E#47#4C#58#66#6F#78#8F#9B#A9#B7#BD#C5#CC": 1, + "F#E3#E9#EF#F4#F9#103#10D#11B#12B#13F#152#163": 1, + "result": 4, + "s.Sum3Obj": 2, + "Sum3Obj": 6, + "Handle": 2, + "MilliSecs": 4, + "Sum3_": 2, + "MakeSum3Obj": 2, + "Sum3": 2, + "b": 7, + "c": 7, + "isActive": 4, + "Last": 1, + "Restore": 1, + "label": 1, + "Read": 1, + "foo": 1, + ".label": 1, + "Data": 1, + "a_": 2, + "a.Sum3Obj": 1, + "Object.Sum3Obj": 1, + "return_": 2, + "First": 1 + }, "Bluespec": { "package": 2, "TbTL": 1, @@ -36905,6 +37261,10 @@ "variable": 1 }, "Ruby": { + "appraise": 2, + "do": 37, + "gem": 3, + "end": 238, "load": 3, "Dir": 4, "[": 56, @@ -36918,9 +37278,7 @@ "}": 68, "task": 2, "default": 2, - "do": 35, "puts": 12, - "end": 236, "module": 8, "Foo": 1, "require": 58, @@ -37518,7 +37876,6 @@ "For": 1, "use/testing": 1, "no": 1, - "gem": 1, "require_all": 4, "glob": 2, "File.join": 6, @@ -42466,6 +42823,7 @@ "Arduino": 20, "AutoHotkey": 3, "Awk": 544, + "BlitzBasic": 2065, "Bluespec": 1298, "C": 58858, "C++": 21308, @@ -42548,7 +42906,7 @@ "Ragel in Ruby Host": 593, "Rebol": 11, "RobotFramework": 483, - "Ruby": 3854, + "Ruby": 3862, "Rust": 3566, "Sass": 56, "Scala": 420, @@ -42589,6 +42947,7 @@ "Arduino": 1, "AutoHotkey": 1, "Awk": 1, + "BlitzBasic": 3, "Bluespec": 2, "C": 26, "C++": 19, @@ -42671,7 +43030,7 @@ "Ragel in Ruby Host": 3, "Rebol": 1, "RobotFramework": 3, - "Ruby": 16, + "Ruby": 17, "Rust": 1, "Sass": 2, "Scala": 3, @@ -42703,5 +43062,5 @@ "Xtend": 2, "YAML": 1 }, - "md5": "0d841b2f18a555f522c8e9c58b829230" + "md5": "f407022fe8de91114d556ad933c9acc2" } \ No newline at end of file From eb5f1468d2b7403bfd2b7f38768f47199912634e Mon Sep 17 00:00:00 2001 From: Ted Nyman Date: Fri, 8 Nov 2013 14:13:45 -0800 Subject: [PATCH 10/24] .pluginspec for XML --- lib/linguist/languages.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/linguist/languages.yml b/lib/linguist/languages.yml index b5fdfe98..16780097 100644 --- a/lib/linguist/languages.yml +++ b/lib/linguist/languages.yml @@ -1591,6 +1591,7 @@ XML: - .kml - .mxml - .plist + - .pluginspec - .ps1xml - .psc1 - .pt From e47b312866d059bed72c47cde0a0173c054054d0 Mon Sep 17 00:00:00 2001 From: Haralan Dobrev Date: Sat, 9 Nov 2013 12:53:15 +0200 Subject: [PATCH 11/24] Add phpunit.xml.dist to XML filenames PHPUnit (a popular unit testing tool for PHP) uses `phpunit.xml` for its configuration. However it would use `phpunit.xml.dist` as well if `phpunit.xml` is not available. The reason is to track `phpunit.xml.dist` in your repo. And to ignore `phpunit.xml`. By default everyone (including a CI) would use `phpunit.xml.dist` except you add `phpunit.xml` locally. `phpunit.xml.dist` has the same XML structure as `phpunit.xml`. So it should be detected as XML by linguist. Example: https://github.com/erusev/parsedown/blob/master/phpunit.xml.dist I don't know why linguist is not detecting this file as XML since it starts with ` Date: Sat, 9 Nov 2013 15:29:59 +0200 Subject: [PATCH 12/24] Add initial UnrealScript support The two samples are for two different UnrealScript generations: MutU2Weapons is UnrealScript 2, US3HelloWorld is UnrealScript 3. Signed-off-by: GreatEmerald --- lib/linguist/languages.yml | 6 + samples/UnrealScript/MutU2Weapons.uc | 644 ++++++++++++++++++++++++++ samples/UnrealScript/US3HelloWorld.uc | 10 + 3 files changed, 660 insertions(+) create mode 100755 samples/UnrealScript/MutU2Weapons.uc create mode 100644 samples/UnrealScript/US3HelloWorld.uc diff --git a/lib/linguist/languages.yml b/lib/linguist/languages.yml index 16780097..20db5426 100644 --- a/lib/linguist/languages.yml +++ b/lib/linguist/languages.yml @@ -1513,6 +1513,12 @@ Unified Parallel C: color: "#755223" primary_extension: .upc +UnrealScript: + type: programming + color: "#a54c4d" + lexer: JavaScript + primary_extension: .uc + VHDL: type: programming lexer: vhdl diff --git a/samples/UnrealScript/MutU2Weapons.uc b/samples/UnrealScript/MutU2Weapons.uc new file mode 100755 index 00000000..9c27aaf9 --- /dev/null +++ b/samples/UnrealScript/MutU2Weapons.uc @@ -0,0 +1,644 @@ +/* + * Copyright (c) 2008, 2013 Dainius "GreatEmerald" Masiliƫnas + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +//----------------------------------------------------------------------------- +// MutU2Weapons.uc +// Mutator class for replacing weapons +// GreatEmerald, 2008 +//----------------------------------------------------------------------------- + +class MutU2Weapons extends Mutator + config(U2Weapons); + +var() config string ReplacedWeaponClassNames0; +var() config string ReplacedWeaponClassNames1, ReplacedWeaponClassNames2, ReplacedWeaponClassNames3; +var() config string ReplacedWeaponClassNames4, ReplacedWeaponClassNames5, ReplacedWeaponClassNames6; +var() config string ReplacedWeaponClassNames7, ReplacedWeaponClassNames8, ReplacedWeaponClassNames9; +var() config string ReplacedWeaponClassNames10, ReplacedWeaponClassNames11, ReplacedWeaponClassNames12; +var() config bool bConfigUseU2Weapon0, bConfigUseU2Weapon1, bConfigUseU2Weapon2, bConfigUseU2Weapon3; +var() config bool bConfigUseU2Weapon4, bConfigUseU2Weapon5, bConfigUseU2Weapon6, bConfigUseU2Weapon7; +var() config bool bConfigUseU2Weapon8, bConfigUseU2Weapon9, bConfigUseU2Weapon10, bConfigUseU2Weapon11; +var() config bool bConfigUseU2Weapon12; +//var byte bUseU2Weapon[13]; +//var class ReplacedWeaponClasses[13]; +//var class ReplacedWeaponPickupClasses[13]; +//var class ReplacedAmmoPickupClasses[13]; +var class U2WeaponClasses[13]; //GE: For default properties ONLY! +//var string U2WeaponPickupClassNames[13]; +var string U2AmmoPickupClassNames[13]; //GE: For default properties ONLY! +var byte bIsVehicle[13], bNotVehicle[13]; //GE: For default properties ONLY! +var localized string U2WeaponDisplayText[33], U2WeaponDescText[33]; +//var localized string GUISelectOptions[4]; +//var config int FirePowerMode; +var config bool bExperimental; +var config bool bUseFieldGenerator; +var config bool bUseProximitySensor; +var config bool bIntegrateShieldReward; +var int IterationNum; //GE: Weapons.Length +const DamageMultiplier=1.818182; +var config int DamagePercentage; +var config bool bUseXMPFeel; +var config string FlashbangModeString; +struct WeaponInfo +{ + var class ReplacedWeaponClass; //GE: Generated from ReplacedWeaponClassName. This is what we replace. + //var class ReplacedWeaponPickupClass; //GE: UNUSED?! + var class ReplacedAmmoPickupClass; //GE: Generated from ReplacedWeaponClassName. + + var class WeaponClass; //GE: This is the weapon we are going to put inside the world. + var string WeaponPickupClassName; //GE: Generated from WeponClass. + var string AmmoPickupClassName; //GE: Generated from WeaponClass. + var bool bEnabled; //GE: Structs can't be defaultproperty'd, thus we still require bConfigUseU2WeaponX + var bool bIsVehicle; //GE: This indicates that the weapon spawns a vehicle (deployable turrets). These only work in vehicle gametypes, duh. + var bool bNotVehicle; //GE: Opposite of bIsVehicle, that is, only works in non-vehicle gametypes. Think shotgun. +}; +var WeaponInfo Weapons[13]; + +/* + * GE: Here we initialise the mutator. First of all, structs can't use defaultproperties (until UE3) and thus config, so here we need to initialise the structs. + */ +function PostBeginPlay() +{ + local int FireMode, x; + //local string ReplacedWeaponPickupClassName; + + //IterationNum = ArrayCount(ReplacedWeaponClasses) - int(Level.Game.bAllowVehicles); //GE: He he, neat way to get the required number. + IterationNum = ArrayCount(Weapons); + + for (x = 0; x < IterationNum; x++) + { + Weapons[x].bEnabled = bool(GetPropertyText("bConfigUseU2Weapon"$x)); //GE: GetPropertyText() is needed to use variables in an array-like fashion. + //bUseU2Weapon[x] = byte(bool(GetPropertyText("bConfigUseU2Weapon"$x))); + Weapons[x].ReplacedWeaponClass = class(DynamicLoadObject(GetPropertyText("ReplacedWeaponClassNames"$x),class'Class')); + //ReplacedWeaponClasses[x] = class(DynamicLoadObject(GetPropertyText("ReplacedWeaponClassNames"$x),class'Class')); + //ReplacedWeaponPickupClassName = string(ReplacedWeaponClasses[x].default.PickupClass); + for(FireMode = 0; FireMode<2; FireMode++) + { + if( (Weapons[x].ReplacedWeaponClass.default.FireModeClass[FireMode] != None) + && (Weapons[x].ReplacedWeaponClass.default.FireModeClass[FireMode].default.AmmoClass != None) + && (Weapons[x].ReplacedWeaponClass.default.FireModeClass[FireMode].default.AmmoClass.default.PickupClass != None) ) + { + Weapons[x].ReplacedAmmoPickupClass = class(Weapons[x].ReplacedWeaponClass.default.FireModeClass[FireMode].default.AmmoClass.default.PickupClass); + break; + } + } + Weapons[x].WeaponClass = U2WeaponClasses[x]; + Weapons[x].WeaponPickupClassName = string(Weapons[x].WeaponClass.default.PickupClass); + Weapons[x].AmmoPickupClassName = U2AmmoPickupClassNames[x]; + Weapons[x].bIsVehicle = bool(bIsVehicle[x]); + Weapons[x].bNotVehicle = bool(bNotVehicle[x]); + } + Super.PostBeginPlay(); +} + +/* + * GE: Utility function for checking if we can replace the item with the weapon/ammo of choice. + */ +function bool ValidReplacement(int x) +{ + if (Level.Game.bAllowVehicles) + return (Weapons[x].bEnabled && !Weapons[x].bNotVehicle ); + return (Weapons[x].bEnabled && !Weapons[x].bIsVehicle); +} + +/* + * GE: Here we replace things. + */ +function bool CheckReplacement( Actor Other, out byte bSuperRelevant ) +{ + local int x, i; + local WeaponLocker L; + + bSuperRelevant = 0; + if (xWeaponBase(Other) != None) + { + for (x = 0; x < IterationNum; x++) + { + if (ValidReplacement(x) && xWeaponBase(Other).WeaponType == Weapons[x].ReplacedWeaponClass) + { + xWeaponBase(Other).WeaponType = Weapons[x].WeaponClass; + return false; + } + } + return true; + } + if (Weapon(Other) != None) + { + if ( Other.IsA('BallLauncher') ) + return true; + for (x = 0; x < IterationNum; x++) + if (ValidReplacement(x) && Other.Class == Weapons[x].ReplacedWeaponClass) + return false; + return true; + } + /*if (WeaponPickup(Other) != None) //GE: This should never happen. + { + for (x = 0; x < IterationNum; x++) + { + if (Weapons[x].bEnabled && Other.Class == Weapons[x].ReplacedWeaponPickupClass) + { + ReplaceWith(Other, U2WeaponPickupClassNames[x]); + return false; + } + } + } */ + if (Ammo(Other) != None) + { + for (x = 0; x < IterationNum; x++) + { + if (ValidReplacement(x) && Other.Class == Weapons[x].ReplacedAmmoPickupClass) + { + ReplaceWith(Other, Weapons[x].AmmoPickupClassName); + return false; + } + } + return true; + } + if (WeaponLocker(Other) != None) + { + L = WeaponLocker(Other); + for (x = 0; x < IterationNum; x++) + if (ValidReplacement(x)) + for (i = 0; i < L.Weapons.Length; i++) + if (L.Weapons[i].WeaponClass == Weapons[x].ReplacedWeaponClass) + L.Weapons[i].WeaponClass = Weapons[x].WeaponClass; + return true; + } + + //STARTING WEAPON + if( xPawn(Other) != None ) + xPawn(Other).RequiredEquipment[0] = string(Weapons[1].WeaponClass); + if( xPawn(Other) != None && bUseFieldGenerator == True && Level.Game.bAllowVehicles) + xPawn(Other).RequiredEquipment[2] = "U2Weapons.U2WeaponFieldGenerator"; + if( xPawn(Other) != None && bUseProximitySensor == True && Level.Game.bAllowVehicles) + xPawn(Other).RequiredEquipment[3] = "U2Weapons.U2ProximitySensorDeploy"; + + //GE: Special handling - Shield Reward integration + if (bIntegrateShieldReward && Other.IsA('ShieldReward')) + { + ShieldPack(Other).SetStaticMesh(StaticMesh'XMPWorldItemsM.items.Pickup_TD_001'); + ShieldPack(Other).Skins[0] = Shader'U2343T.Pickups.Energy_Pickup_B_FX_01'; + ShieldPack(Other).RepSkin = Shader'U2343T.Pickups.Energy_Pickup_B_FX_01'; + ShieldPack(Other).SetDrawScale(0.35); + ShieldPack(Other).SetCollisionSize(27.0, 4.0); + ShieldPack(Other).PickupMessage = "You got an Energy Pickup."; + ShieldPack(Other).PickupSound = Sound'U2A.Powerups.EnergyPowerUp'; + } + + return Super.CheckReplacement(Other,bSuperRelevant); +} + +/* + * GE: This is for further replacement, I think... + */ +function string GetInventoryClassOverride(string InventoryClassName) +{ + local int x; + + for (x = 0; x < IterationNum; x++) + { + if (InventoryClassName ~= string(Weapons[x].ReplacedWeaponClass) && ValidReplacement(x)) + return string(Weapons[x].WeaponClass); + } + + return Super.GetInventoryClassOverride(InventoryClassName); +} + +/* + * GE: Configuration options. + */ +static function FillPlayInfo(PlayInfo PlayInfo) +{ + local array Recs; + local string WeaponOptions; + local int i; + + Super.FillPlayInfo(PlayInfo); + + class'CacheManager'.static.GetWeaponList(Recs); + for (i = 0; i < Recs.Length; i++) + { + if (WeaponOptions != "") + WeaponOptions $= ";"; + + WeaponOptions $= Recs[i].ClassName $ ";" $ Recs[i].FriendlyName; + } + + PlayInfo.AddSetting(default.RulesGroup, "bConfigUseU2Weapon0", default.U2WeaponDisplayText[0], 0, 3, "Check"); + PlayInfo.AddSetting(default.RulesGroup, "ReplacedWeaponClassNames0", default.U2WeaponDisplayText[1], 0, 4, "Select", WeaponOptions); + PlayInfo.AddSetting(default.RulesGroup, "bConfigUseU2Weapon1", default.U2WeaponDisplayText[2], 0, 5, "Check"); + PlayInfo.AddSetting(default.RulesGroup, "ReplacedWeaponClassNames1", default.U2WeaponDisplayText[3], 0, 6, "Select", WeaponOptions); + PlayInfo.AddSetting(default.RulesGroup, "bConfigUseU2Weapon2", default.U2WeaponDisplayText[6], 0, 7, "Check"); + PlayInfo.AddSetting(default.RulesGroup, "ReplacedWeaponClassNames2", default.U2WeaponDisplayText[7], 0, 8, "Select", WeaponOptions); + PlayInfo.AddSetting(default.RulesGroup, "bConfigUseU2Weapon3", default.U2WeaponDisplayText[8], 0, 9, "Check"); + PlayInfo.AddSetting(default.RulesGroup, "ReplacedWeaponClassNames3", default.U2WeaponDisplayText[9], 0, 10, "Select", WeaponOptions); + PlayInfo.AddSetting(default.RulesGroup, "bConfigUseU2Weapon4", default.U2WeaponDisplayText[10], 0, 11, "Check"); + PlayInfo.AddSetting(default.RulesGroup, "ReplacedWeaponClassNames4", default.U2WeaponDisplayText[11], 0, 12, "Select", WeaponOptions); + PlayInfo.AddSetting(default.RulesGroup, "bConfigUseU2Weapon5", default.U2WeaponDisplayText[12], 0, 13, "Check"); + PlayInfo.AddSetting(default.RulesGroup, "ReplacedWeaponClassNames5", default.U2WeaponDisplayText[13], 0, 14, "Select", WeaponOptions); + PlayInfo.AddSetting(default.RulesGroup, "bConfigUseU2Weapon6", default.U2WeaponDisplayText[14], 0, 15, "Check"); + PlayInfo.AddSetting(default.RulesGroup, "ReplacedWeaponClassNames6", default.U2WeaponDisplayText[15], 0, 16, "Select", WeaponOptions); + PlayInfo.AddSetting(default.RulesGroup, "bConfigUseU2Weapon7", default.U2WeaponDisplayText[16], 0, 17, "Check"); + PlayInfo.AddSetting(default.RulesGroup, "ReplacedWeaponClassNames7", default.U2WeaponDisplayText[17], 0, 18, "Select", WeaponOptions); + PlayInfo.AddSetting(default.RulesGroup, "bConfigUseU2Weapon8", default.U2WeaponDisplayText[18], 0, 19, "Check"); + PlayInfo.AddSetting(default.RulesGroup, "ReplacedWeaponClassNames8", default.U2WeaponDisplayText[19], 0, 20, "Select", WeaponOptions); + PlayInfo.AddSetting(default.RulesGroup, "bConfigUseU2Weapon9", default.U2WeaponDisplayText[20], 0, 21, "Check"); + PlayInfo.AddSetting(default.RulesGroup, "ReplacedWeaponClassNames9", default.U2WeaponDisplayText[21], 0, 22, "Select", WeaponOptions); + PlayInfo.AddSetting(default.RulesGroup, "bConfigUseU2Weapon10", default.U2WeaponDisplayText[22], 0, 23, "Check"); + PlayInfo.AddSetting(default.RulesGroup, "ReplacedWeaponClassNames10", default.U2WeaponDisplayText[23], 0, 24, "Select", WeaponOptions); + PlayInfo.AddSetting(default.RulesGroup, "bConfigUseU2Weapon11", default.U2WeaponDisplayText[24], 0, 25, "Check"); + PlayInfo.AddSetting(default.RulesGroup, "ReplacedWeaponClassNames11", default.U2WeaponDisplayText[25], 0, 26, "Select", WeaponOptions); + PlayInfo.AddSetting(default.RulesGroup, "bConfigUseU2Weapon12", default.U2WeaponDisplayText[26], 0, 27, "Check"); + PlayInfo.AddSetting(default.RulesGroup, "ReplacedWeaponClassNames12", default.U2WeaponDisplayText[27], 0, 28, "Select", WeaponOptions); + PlayInfo.AddSetting(default.RulesGroup, "bUseXMPFeel", default.U2WeaponDisplayText[4], 0, 29, "Check"); + PlayInfo.AddSetting(default.RulesGroup, "DamagePercentage", default.U2WeaponDisplayText[30], 0, 30, "Text", "3;0:100"); + PlayInfo.AddSetting(default.RulesGroup, "bExperimental", default.U2WeaponDisplayText[5], 0, 31, "Check"); + PlayInfo.AddSetting(default.RulesGroup, "bUseFieldGenerator", default.U2WeaponDisplayText[28], 0, 32, "Check"); + PlayInfo.AddSetting(default.RulesGroup, "bUseProximitySensor", default.U2WeaponDisplayText[29], 0, 33, "Check"); + PlayInfo.AddSetting(default.RulesGroup, "bIntegrateShieldReward", default.U2WeaponDisplayText[31], 0, 34, "Check"); + PlayInfo.AddSetting(default.RulesGroup, "FlashbangModeString", default.U2WeaponDisplayText[32], 0, 35, "Select", "FM_None;None;FM_Directional;Direction-based;FM_DistanceBased;Distance-based"); +} + +/* + * GE: Configuration tooltips. + */ +static event string GetDescriptionText(string PropName) +{ + if (PropName == "bConfigUseU2Weapon0") + return default.U2WeaponDescText[0]; + if (PropName == "ReplacedWeaponClassNames0") + return default.U2WeaponDescText[1]; + if (PropName == "bConfigUseU2Weapon1") + return default.U2WeaponDescText[2]; + if (PropName == "ReplacedWeaponClassNames1") + return default.U2WeaponDescText[3]; + if (PropName == "bConfigUseU2Weapon2") + return default.U2WeaponDescText[6]; + if (PropName == "ReplacedWeaponClassNames2") + return default.U2WeaponDescText[7]; + if (PropName == "bConfigUseU2Weapon3") + return default.U2WeaponDescText[8]; + if (PropName == "ReplacedWeaponClassNames3") + return default.U2WeaponDescText[9]; + if (PropName == "bConfigUseU2Weapon4") + return default.U2WeaponDescText[10]; + if (PropName == "ReplacedWeaponClassNames4") + return default.U2WeaponDescText[11]; + if (PropName == "bConfigUseU2Weapon5") + return default.U2WeaponDescText[12]; + if (PropName == "ReplacedWeaponClassNames5") + return default.U2WeaponDescText[13]; + if (PropName == "bConfigUseU2Weapon6") + return default.U2WeaponDescText[14]; + if (PropName == "ReplacedWeaponClassNames6") + return default.U2WeaponDescText[15]; + if (PropName == "bConfigUseU2Weapon7") + return default.U2WeaponDescText[16]; + if (PropName == "ReplacedWeaponClassNames7") + return default.U2WeaponDescText[17]; + if (PropName == "bConfigUseU2Weapon8") + return default.U2WeaponDescText[18]; + if (PropName == "ReplacedWeaponClassNames8") + return default.U2WeaponDescText[19]; + if (PropName == "bConfigUseU2Weapon9") + return default.U2WeaponDescText[20]; + if (PropName == "ReplacedWeaponClassNames9") + return default.U2WeaponDescText[21]; + if (PropName == "bConfigUseU2Weapon10") + return default.U2WeaponDescText[22]; + if (PropName == "ReplacedWeaponClassNames10") + return default.U2WeaponDescText[23]; + if (PropName == "bConfigUseU2Weapon11") + return default.U2WeaponDescText[24]; + if (PropName == "ReplacedWeaponClassNames11") + return default.U2WeaponDescText[25]; + if (PropName == "bConfigUseU2Weapon12") + return default.U2WeaponDescText[26]; + if (PropName == "ReplacedWeaponClassNames12") + return default.U2WeaponDescText[27]; + if (PropName == "bUseXMPFeel") + return default.U2WeaponDescText[4]; + if (PropName == "bExperimental") + return default.U2WeaponDescText[5]; + if (PropName == "bUseFieldGenerator") + return default.U2WeaponDescText[28]; + if (PropName == "bUseProximitySensor") + return default.U2WeaponDescText[29]; + if (PropName == "DamagePercentage") + return default.U2WeaponDescText[30]; + if (PropName == "bIntegrateShieldReward") + return default.U2WeaponDescText[31]; + if (PropName == "FlashbangModeString") + return default.U2WeaponDescText[32]; + + return Super.GetDescriptionText(PropName); +} + +/* + * GE: Here we set all the properties for different play styles. + */ +event PreBeginPlay() +{ + //local int x; + //local class Weapons; + local float k; //GE: Multiplier. + + Super.PreBeginPlay(); + + k=float(DamagePercentage)/100.0; + //log("MutU2Weapons: k is"@k); + //Sets various settings that match different games + + /*if (FirePowerMode == 1) { //Original XMP - use the UTXMP original values + k=1; + } + else */if (!bUseXMPFeel && DamagePercentage != class'MutU2Weapons'.default.DamagePercentage) { //Original U2; compensate for float division errors + Class'U2Weapons.U2AssaultRifleFire'.default.DamageMin *= DamageMultiplier * k; + Class'U2Weapons.U2AssaultRifleFire'.default.DamageMax *= DamageMultiplier * k; + Class'U2Weapons.U2AssaultRifleProjAlt'.default.Damage *= DamageMultiplier * k; + Class'U2Weapons.U2ProjectileASExplAlt'.default.Damage *= DamageMultiplier * k; + Class'U2Weapons.U2ProjectileAltEnergyRifle'.default.Damage *= DamageMultiplier * k; + Class'U2Weapons.U2ProjectileEnergyRifle'.default.Damage *= DamageMultiplier * k; + Class'U2Weapons.U2FireFlameThrower'.default.DamageMin *= DamageMultiplier * k; + Class'U2Weapons.U2FireFlameThrower'.default.DamageMax *= DamageMultiplier * k; + Class'U2Weapons.U2ProjectileFragGrenade'.default.Damage *= DamageMultiplier * k; + Class'U2Weapons.U2ProjectileIncendiaryGrenade'.default.Damage *= DamageMultiplier * k; + Class'U2Weapons.U2ProjectileConcussionGrenade'.default.Damage *= DamageMultiplier * k; + Class'U2Weapons.U2ProjectileRocketDrunken'.default.Damage *= DamageMultiplier * k; + Class'U2Weapons.U2ProjectileRocketSeeking'.default.Damage *= DamageMultiplier * k; + Class'U2Weapons.U2ProjectileRocket'.default.Damage *= DamageMultiplier * k; + Class'U2Weapons.U2ProjectileAltShotgun'.default.Damage *= DamageMultiplier * k; + Class'U2Weapons.U2FireShotgun'.default.DamageMin *= DamageMultiplier * k; + Class'U2Weapons.U2FireShotgun'.default.DamageMax *= DamageMultiplier * k; + Class'U2Weapons.U2FireSniper'.default.DamageMin *= DamageMultiplier * k; + Class'U2Weapons.U2FireSniper'.default.DamageMax *= DamageMultiplier * k; + Class'U2Weapons.U2FirePistol'.default.DamageMin *= DamageMultiplier * k; + Class'U2Weapons.U2FirePistol'.default.DamageMax *= DamageMultiplier * k; + Class'U2Weapons.U2FireAltPistol'.default.DamageMin *= DamageMultiplier * k; + Class'U2Weapons.U2FireAltPistol'.default.DamageMax *= DamageMultiplier * k; + Class'U2Weapons.U2ProjectileEMPGrenade'.default.Damage *= DamageMultiplier * k; + Class'U2Weapons.U2ProjectileToxicGrenade'.default.Damage *= DamageMultiplier * k; + Class'U2Weapons.U2HurterProxy_Gas'.default.myDamage *= DamageMultiplier * k; + Class'U2Weapons.U2HurterProxy_Fire'.default.myDamage *= DamageMultiplier * k; + } + //Dampened U2 is already the default - no need for a rewrite? + else if (bUseXMPFeel) { //General XMP + Class'U2Weapons.U2AssaultRifleFire'.default.Spread = 6.0; + Class'U2Weapons.U2AssaultRifleAmmoInv'.default.MaxAmmo = 300; + Class'U2Weapons.U2AssaultRifleProjAlt'.default.Speed = 5000; + Class'U2Weapons.U2AssaultRifleProjAlt'.default.MomentumTransfer = 8000; + Class'U2Weapons.U2WeaponEnergyRifle'.default.ClipSize = 30; + Class'U2Weapons.U2FireAltEnergyRifle'.default.FireLastReloadTime = 2.265000; + Class'U2Weapons.U2ProjectileAltEnergyRifle'.default.Speed = 1400.000000; + Class'U2Weapons.U2ProjectileAltEnergyRifle'.default.DamageRadius = 290.000000; + Class'U2Weapons.U2ProjectileAltEnergyRifle'.default.LifeSpan = 6.0; + Class'U2Weapons.U2ProjectileEnergyRifle'.default.ShakeRadius = 1024.0; + Class'U2Weapons.U2ProjectileEnergyRifle'.default.ShakeMagnitude = 1.0; + Class'U2Weapons.U2ProjectileEnergyRifle'.default.Speed = 2500.0; + Class'U2Weapons.U2ProjectileEnergyRifle'.default.MaxSpeed = 5000.0; + Class'U2Weapons.U2ProjectileEnergyRifle'.default.LifeSpan = 6.0; + Class'U2Weapons.U2AmmoEnergyRifle'.default.MaxAmmo = 150; + Class'U2Weapons.U2FireAltFlameThrower'.default.FireRate = 0.25; + Class'U2Weapons.U2ProjectileAltFlameThrower'.default.MaxSpeed = 500.0; + Class'U2Weapons.U2ProjectileAltFlameThrower'.default.LifeSpan = 22.0; + Class'U2Weapons.U2ProjectileAltFlameThrower'.default.MomentumTransfer = 500.0; + Class'U2Weapons.U2WeaponFlameThrower'.default.ClipSize = 80; + Class'U2Weapons.U2WeaponFlameThrower'.default.ReloadTime = 2.0; + Class'U2Weapons.U2AmmoFlameThrower'.default.MaxAmmo = 480; + Class'U2Weapons.U2ProjectileFragGrenade'.default.MomentumTransfer = 9000; + Class'U2Weapons.U2ProjectileFragGrenade'.default.MaxSpeed = 2600.0; + Class'U2Weapons.U2ProjectileFragGrenade'.default.Speed = 2600.0; + Class'U2Weapons.U2ProjectileSmokeGrenade'.default.MaxSpeed = 2600.0; + Class'U2Weapons.U2ProjectileSmokeGrenade'.default.Speed = 2600.0; + Class'U2Weapons.U2ProjectileIncendiaryGrenade'.default.DamageRadius = 256.0; + Class'U2Weapons.U2ProjectileIncendiaryGrenade'.default.MomentumTransfer = 9000.0; + Class'U2Weapons.U2ProjectileConcussionGrenade'.default.DamageRadius = 180.0; + Class'U2Weapons.U2FireGrenade'.default.FireRate = 1.33; + Class'U2Weapons.U2WeaponRocketLauncher'.default.ReloadTime = 2.0; + Class'U2Weapons.U2AmmoRocketLauncher'.default.MaxAmmo = 25; + Class'U2Weapons.U2ProjectileRocketDrunken'.default.Speed = 1200.0; + Class'U2Weapons.U2ProjectileRocketSeeking'.default.Speed = 1200.0; + Class'U2Weapons.U2ProjectileRocket'.default.Speed = 2133.0;//3200 is too much + Class'U2Weapons.U2ProjectileRocket'.default.MaxSpeed = 2133.0; + Class'U2Weapons.U2ProjectileRocket'.default.DamageRadius = 384.0; + Class'U2Weapons.U2WeaponShotgun'.default.ReloadTime = 2.21; + Class'U2Weapons.U2WeaponShotgun'.default.ClipSize = 6; + Class'U2Weapons.U2AmmoShotgun'.default.MaxAmmo = 42; + Class'U2Weapons.U2WeaponSniper'.default.ClipSize = 3; + Class'U2Weapons.U2FireSniper'.default.FireRate = 1.0; + Class'U2Weapons.U2AmmoSniper'.default.MaxAmmo = 18; + Class'U2Weapons.U2FirePistol'.default.FireLastReloadTime = 2.4; + Class'U2Weapons.U2FireAltPistol'.default.FireLastReloadTime = 2.4; + Class'U2Weapons.U2AmmoPistol'.default.MaxAmmo = 45; + Class'U2Weapons.U2DamTypePistol'.default.VehicleDamageScaling = 0.30; + Class'U2Weapons.U2DamTypeAltPistol'.default.VehicleDamageScaling = 0.30; + + Class'U2Weapons.U2AssaultRifleFire'.default.DamageMin = 20*k; + Class'U2Weapons.U2AssaultRifleFire'.default.DamageMax = 20*k; + Class'U2Weapons.U2AssaultRifleProjAlt'.default.Damage = 175*k; + Class'U2Weapons.U2ProjectileASExplAlt'.default.Damage = 64.0*k; + Class'U2Weapons.U2ProjectileAltEnergyRifle'.default.Damage = 120.0*k; + Class'U2Weapons.U2ProjectileEnergyRifle'.default.Damage = 13.0*k; + Class'U2Weapons.U2FireFlameThrower'.default.DamageMin = 15*k; + Class'U2Weapons.U2FireFlameThrower'.default.DamageMax = 15*k; + Class'U2Weapons.U2ProjectileFragGrenade'.default.Damage = 200.0*k; + Class'U2Weapons.U2ProjectileIncendiaryGrenade'.default.Damage = 50.0*k; + Class'U2Weapons.U2ProjectileConcussionGrenade'.default.Damage = 15.0*k; + Class'U2Weapons.U2ProjectileRocketDrunken'.default.Damage = 70.0*k; + Class'U2Weapons.U2ProjectileRocketSeeking'.default.Damage = 70.0*k; + Class'U2Weapons.U2ProjectileRocket'.default.Damage = 190.0*k; + Class'U2Weapons.U2ProjectileAltShotgun'.default.Damage = 22.0*k; + Class'U2Weapons.U2FireShotgun'.default.DamageMin = 16*k; + Class'U2Weapons.U2FireShotgun'.default.DamageMax = 16*k; + Class'U2Weapons.U2FireSniper'.default.DamageMin = 75*k; + Class'U2Weapons.U2FireSniper'.default.DamageMax = 75*k; + Class'U2Weapons.U2FirePistol'.default.DamageMin = 40*k; + Class'U2Weapons.U2FirePistol'.default.DamageMax = 40*k; + Class'U2Weapons.U2FireAltPistol'.default.DamageMin = 65*k; + Class'U2Weapons.U2FireAltPistol'.default.DamageMax = 65*k; + Class'U2Weapons.U2ProjectileEMPGrenade'.default.Damage = 140.0*k; + Class'U2Weapons.U2ProjectileToxicGrenade'.default.Damage = 100.0*k; + Class'U2Weapons.U2HurterProxy_Gas'.default.myDamage = 30.0*k; + Class'U2Weapons.U2HurterProxy_Fire'.default.myDamage = 80.0*k; + } + + // + //----------------------------------------------------------- + // + //Experimental options - lets you Unuse EMPimp projectile and fire from two CAR barrels + if ((bExperimental) && (!bUseXMPFeel)) { //General U2 + Class'U2Weapons.U2ProjectileAltEnergyRifle'.default.LifeSpan = 2.0; + Class'U2Weapons.U2ProjectileAltEnergyRifle'.default.Damage = 210.0*k; + } + if (bExperimental) { //CAR - nothing's setting it, FireMode independent + Class'U2Weapons.U2AssaultRifleFire'.default.bModeExclusive = false; + Class'U2Weapons.U2AssaultRifleAltFire'.default.bModeExclusive = false; + } + + class'U2ProjectileConcussionGrenade'.static.SetFlashbangMode(FlashbangModeString); +} + +defaultproperties +{ + ReplacedWeaponClassNames0="XWeapons.Minigun" + ReplacedWeaponClassNames1="XWeapons.AssaultRifle" + ReplacedWeaponClassNames2="XWeapons.BioRifle" + ReplacedWeaponClassNames3="XWeapons.ShockRifle" + ReplacedWeaponClassNames4="Onslaught.ONSGrenadeLauncher" + ReplacedWeaponClassNames5="XWeapons.RocketLauncher" + ReplacedWeaponClassNames6="XWeapons.FlakCannon" + ReplacedWeaponClassNames7="XWeapons.SniperRifle" + ReplacedWeaponClassNames8="UTClassic.ClassicSniperRifle" + ReplacedWeaponClassNames9="Onslaught.ONSMineLayer" + ReplacedWeaponClassNames10="XWeapons.Redeemer" + ReplacedWeaponClassNames11="XWeapons.Painter" + ReplacedWeaponClassNames12="XWeapons.LinkGun" + bConfigUseU2Weapon0=True + bConfigUseU2Weapon1=True + bConfigUseU2Weapon2=True + bConfigUseU2Weapon3=True + bConfigUseU2Weapon4=True + bConfigUseU2Weapon5=True + bConfigUseU2Weapon6=True + bConfigUseU2Weapon7=True + bConfigUseU2Weapon8=True + bConfigUseU2Weapon9=True + bConfigUseU2Weapon10=True + bConfigUseU2Weapon11=True + bConfigUseU2Weapon12=True + bUseFieldGenerator=True + bUseProximitySensor=True + U2WeaponClasses(0)=Class'U2Weapons.U2AssaultRifleInv' + U2WeaponClasses(1)=Class'U2Weapons.U2WeaponEnergyRifle' + U2WeaponClasses(2)=Class'U2Weapons.U2WeaponFlameThrower' + U2WeaponClasses(3)=Class'U2Weapons.U2WeaponPistol' + U2WeaponClasses(4)=Class'U2Weapons.U2AutoTurretDeploy' + U2WeaponClasses(5)=Class'U2Weapons.U2WeaponRocketLauncher' + U2WeaponClasses(6)=Class'U2Weapons.U2WeaponGrenadeLauncher' + U2WeaponClasses(7)=Class'U2Weapons.U2WeaponSniper' + U2WeaponClasses(8)=Class'U2Weapons.U2WeaponSniper' + U2WeaponClasses(9)=Class'U2Weapons.U2WeaponRocketTurret' + U2WeaponClasses(10)=Class'U2Weapons.U2WeaponLandMine' + U2WeaponClasses(11)=Class'U2Weapons.U2WeaponLaserTripMine' + U2WeaponClasses(12)=Class'U2Weapons.U2WeaponShotgun' //GE: Has to be in !Level.Game.bAllowVehicles + bIsVehicle(0)=0 + bIsVehicle(1)=0 + bIsVehicle(2)=0 + bIsVehicle(3)=0 + bIsVehicle(4)=1 + bIsVehicle(5)=0 + bIsVehicle(6)=0 + bIsVehicle(7)=0 + bIsVehicle(8)=0 + bIsVehicle(9)=1 + bIsVehicle(10)=1 + bIsVehicle(11)=1 + bIsVehicle(12)=0 + bNotVehicle(12)=1 + U2AmmoPickupClassNames(0)="U2Weapons.U2AssaultRifleAmmoPickup" + U2AmmoPickupClassNames(1)="U2Weapons.U2PickupAmmoEnergyRifle" + U2AmmoPickupClassNames(2)="U2Weapons.U2PickupAmmoFlameThrower" + U2AmmoPickupClassNames(3)="U2Weapons.U2PickupAmmoPistol" + U2AmmoPickupClassNames(4)="U2Weapons.U2PickupAutoTurret" + U2AmmoPickupClassNames(5)="U2Weapons.U2PickupAmmoRocket" + U2AmmoPickupClassNames(6)="U2Weapons.U2PickupAmmoGrenade" + U2AmmoPickupClassNames(7)="U2Weapons.U2PickupAmmoSniper" + U2AmmoPickupClassNames(8)="U2Weapons.U2PickupAmmoSniper" + U2AmmoPickupClassNames(9)="U2Weapons.U2PickupRocketTurret" + U2AmmoPickupClassNames(10)="U2Weapons.U2PickupLandMine" + U2AmmoPickupClassNames(11)="U2Weapons.U2PickupLaserTripMine" + U2AmmoPickupClassNames(12)="U2Weapons.U2PickupAmmoShotgun" + U2WeaponDisplayText(0)="Include the Combat Assault Rifle" + U2WeaponDisplayText(1)="Replace this with the M32 Duster CAR" + U2WeaponDisplayText(2)="Include the Shock Lance" + U2WeaponDisplayText(3)="Replace this with the Shock Lance" + U2WeaponDisplayText(4)="Use XMP-style fire power?" + U2WeaponDisplayText(5)="Use alternative options?" + U2WeaponDisplayText(6)="Include the Flamethrower" + U2WeaponDisplayText(7)="Replace this with the Vulcan" + U2WeaponDisplayText(8)="Include the Magnum Pistol" + U2WeaponDisplayText(9)="Replace this with the Magnum Pistol" + U2WeaponDisplayText(10)="Include the Auto Turret" + U2WeaponDisplayText(11)="Replace this with the Auto Turret" + U2WeaponDisplayText(12)="Include the Shark Rocket Launcher" + U2WeaponDisplayText(13)="Replace this with the Shark" + U2WeaponDisplayText(14)="Include the Grenade Launcher" + U2WeaponDisplayText(15)="Replace this with the Hydra" + U2WeaponDisplayText(16)="Include the Widowmaker Sniper (1)" + U2WeaponDisplayText(17)="Replace this with the Widowmaker Rifle" + U2WeaponDisplayText(18)="Include the Widowmaker Sniper (2)" + U2WeaponDisplayText(19)="Replace this with the Widowmaker Rifle too" + U2WeaponDisplayText(20)="Include the Rocket Turret" + U2WeaponDisplayText(21)="Replace this with the Rocket Turret" + U2WeaponDisplayText(22)="Include the Land Mine" + U2WeaponDisplayText(23)="Replace this with the Land Mine" + U2WeaponDisplayText(24)="Include the Laser Trip Mine" + U2WeaponDisplayText(25)="Replace this with the Laser Trip Mine" + U2WeaponDisplayText(26)="Include the Crowd Pleaser Shotgun" + U2WeaponDisplayText(27)="Replace this with the Crowd Pleaser" + U2WeaponDisplayText(28)="Include the Field Generator" + U2WeaponDisplayText(29)="Include the Proximity Sensor" + U2WeaponDisplayText(30)="Firepower damping percentage" + U2WeaponDisplayText(31)="Integrate with Shield Reward" + U2WeaponDisplayText(32)="Concussion grenade behaviour" + U2WeaponDescText(0)="Include the M32 Duster Combat Assault Rifle in the game, i.e. enable it?" + U2WeaponDescText(1)="What weapon should be replaced with the CAR. By default it's the Minigun." + U2WeaponDescText(2)="Enable the Shock Lance Energy Rifle?" + U2WeaponDescText(3)="What weapon should be replaced with the Energy Rifle. By default it's the Assault Rifle. NOTE: Changing this value is not recommended." + U2WeaponDescText(4)="If enabled, this option will make all weapon firepower the same as in Unreal II XMP; if not, the firepower is consistent with Unreal II SP." + U2WeaponDescText(5)="If enabled, will make the Shock Lance use another, limited, secondary fire mode and allow Combat Assault Rifle use Unreal: Return to Na Pali fire style (shooting out of 2 barrels)." + U2WeaponDescText(6)="Enable the Vulcan Flamethrower?" + U2WeaponDescText(7)="What weapon should be replaced with the Flamethrower. By default it's the Bio Rifle." + U2WeaponDescText(8)="Enable the Magnum Pistol?" + U2WeaponDescText(9)="What weapon should be replaced with the Magnum Pistol. By default it's the Shock Rifle." + U2WeaponDescText(10)="Enable the Automatic Turret?" + U2WeaponDescText(11)="What weapon should be replaced with the Auto Turret. By default it's the Onslaught Grenade Launcher." + U2WeaponDescText(12)="Enable the Shark Rocket Launcher?" + U2WeaponDescText(13)="What weapon should be replaced with the Shark Rocket Launcher. By default it's the Rocket Launcher." + U2WeaponDescText(14)="Enable the Hydra Grenade Launcher?" + U2WeaponDescText(15)="What weapon should be replaced with the Hydra Grenade Launcher. By default it's the Flak Cannon." + U2WeaponDescText(16)="Should the Lightning Gun be replaced with the Widowmaker Sniper Rifle?" + U2WeaponDescText(17)="What weapon should be replaced with the Widowmaker Sniper Rifle. By default it's the Lightning Gun here." + U2WeaponDescText(18)="Should the Classic Sniper Rifle be replaced with the Widowmaker Sniper Rifle?" + U2WeaponDescText(19)="What weapon should be replaced with the Widowmaker Sniper Rifle. By default it's the Classic Sniper Rifle here." + U2WeaponDescText(20)="Enable the Rocket Turret delpoyable?" + U2WeaponDescText(21)="What weapon should be replaced with the Rocket Turret deployable. By default it's the Mine Layer." + U2WeaponDescText(22)="Enable the Land Mine?" + U2WeaponDescText(23)="What weapon should be replaced with the Land Mine. By default it's the Redeemer." + U2WeaponDescText(24)="Enable the Laser Trip Mine?" + U2WeaponDescText(25)="What weapon should be replaced with the Laser Trip Mine. By default it's the Ion Painter." + U2WeaponDescText(26)="Enable the Crowd Pleaser Shotgun? It won't replace the Link Gun in matches with vehicles." + U2WeaponDescText(27)="What weapon should be replaced with the Crowd Pleaser Shotgun. By default it's the Link Gun. It does not replace it in vehicle matches." + U2WeaponDescText(28)="Enable the Field Generator? If enabled, you start with one." + U2WeaponDescText(29)="Enable the Proximity Sensor? If enabled, you start with one." + U2WeaponDescText(30)="This number controls how powerful all weapons are. By deafult the firepower is set to 55% of the original in order to compensate for the fact that players in UT2004 don't have shields or damage filtering." + U2WeaponDescText(31)="If checked, the Shield Reward mutator produces Unreal II shield pickups." + U2WeaponDescText(32)="Choose between no white overlay, overlay depending on the player's view (XMP style) and overlay depending on the distance from the player (default, foolproof)." + //FirePowerMode=4 + DamagePercentage=55 + bUseXMPFeel=False + bIntegrateShieldReward=True + FlashbangModeString="FM_DistanceBased" + GroupName="Arena" + FriendlyName="Unreal II or XMP Weapons" + Description="Add the Unreal II weapons to other gametypes. Fully customisable, you can choose between Unreal II and XMP weapon behaviour." +} diff --git a/samples/UnrealScript/US3HelloWorld.uc b/samples/UnrealScript/US3HelloWorld.uc new file mode 100644 index 00000000..3dcf151f --- /dev/null +++ b/samples/UnrealScript/US3HelloWorld.uc @@ -0,0 +1,10 @@ +class US3HelloWorld extends GameInfo; + +event InitGame( string Options, out string Error ) +{ + `log( "Hello, world!" ); +} + +defaultproperties +{ +} From f0558769f249cf110f093a20c94c88ec69fbcf7c Mon Sep 17 00:00:00 2001 From: Andrew Fischer Date: Sat, 9 Nov 2013 12:31:29 -0500 Subject: [PATCH 13/24] added initial NetLogo support --- lib/linguist/languages.yml | 6 + samples/NetLogo/Ants.nlogo | 614 ++++++++++++++++++++++++++++ samples/NetLogo/Life.nlogo | 628 +++++++++++++++++++++++++++++ samples/NetLogo/Star Fractal.nlogo | 501 +++++++++++++++++++++++ samples/NetLogo/readme.md | 439 ++++++++++++++++++++ 5 files changed, 2188 insertions(+) create mode 100644 samples/NetLogo/Ants.nlogo create mode 100644 samples/NetLogo/Life.nlogo create mode 100644 samples/NetLogo/Star Fractal.nlogo create mode 100644 samples/NetLogo/readme.md diff --git a/lib/linguist/languages.yml b/lib/linguist/languages.yml index 16780097..69be1ad3 100644 --- a/lib/linguist/languages.yml +++ b/lib/linguist/languages.yml @@ -981,6 +981,12 @@ Nemerle: color: "#0d3c6e" primary_extension: .n +NetLogo: + type: programming + lexer: Common Lisp + color: "#ff2b2b" + primary_extension: .nlogo + Nginx: type: markup lexer: Nginx configuration file diff --git a/samples/NetLogo/Ants.nlogo b/samples/NetLogo/Ants.nlogo new file mode 100644 index 00000000..9379c690 --- /dev/null +++ b/samples/NetLogo/Ants.nlogo @@ -0,0 +1,614 @@ +patches-own [ + chemical ;; amount of chemical on this patch + food ;; amount of food on this patch (0, 1, or 2) + nest? ;; true on nest patches, false elsewhere + nest-scent ;; number that is higher closer to the nest + food-source-number ;; number (1, 2, or 3) to identify the food sources +] + +;;;;;;;;;;;;;;;;;;;;;;;; +;;; Setup procedures ;;; +;;;;;;;;;;;;;;;;;;;;;;;; + +to setup + clear-all + set-default-shape turtles "bug" + crt population + [ set size 2 ;; easier to see + set color red ] ;; red = not carrying food + setup-patches + reset-ticks +end + +to setup-patches + ask patches + [ setup-nest + setup-food + recolor-patch ] +end + +to setup-nest ;; patch procedure + ;; set nest? variable to true inside the nest, false elsewhere + set nest? (distancexy 0 0) < 5 + ;; spread a nest-scent over the whole world -- stronger near the nest + set nest-scent 200 - distancexy 0 0 +end + +to setup-food ;; patch procedure + ;; setup food source one on the right + if (distancexy (0.6 * max-pxcor) 0) < 5 + [ set food-source-number 1 ] + ;; setup food source two on the lower-left + if (distancexy (-0.6 * max-pxcor) (-0.6 * max-pycor)) < 5 + [ set food-source-number 2 ] + ;; setup food source three on the upper-left + if (distancexy (-0.8 * max-pxcor) (0.8 * max-pycor)) < 5 + [ set food-source-number 3 ] + ;; set "food" at sources to either 1 or 2, randomly + if food-source-number > 0 + [ set food one-of [1 2] ] +end + +to recolor-patch ;; patch procedure + ;; give color to nest and food sources + ifelse nest? + [ set pcolor violet ] + [ ifelse food > 0 + [ if food-source-number = 1 [ set pcolor cyan ] + if food-source-number = 2 [ set pcolor sky ] + if food-source-number = 3 [ set pcolor blue ] ] + ;; scale color to show chemical concentration + [ set pcolor scale-color green chemical 0.1 5 ] ] +end + +;;;;;;;;;;;;;;;;;;;;; +;;; Go procedures ;;; +;;;;;;;;;;;;;;;;;;;;; + +to go ;; forever button + ask turtles + [ if who >= ticks [ stop ] ;; delay initial departure + ifelse color = red + [ look-for-food ] ;; not carrying food? look for it + [ return-to-nest ] ;; carrying food? take it back to nest + wiggle + fd 1 ] + diffuse chemical (diffusion-rate / 100) + ask patches + [ set chemical chemical * (100 - evaporation-rate) / 100 ;; slowly evaporate chemical + recolor-patch ] + tick +end + +to return-to-nest ;; turtle procedure + ifelse nest? + [ ;; drop food and head out again + set color red + rt 180 ] + [ set chemical chemical + 60 ;; drop some chemical + uphill-nest-scent ] ;; head toward the greatest value of nest-scent +end + +to look-for-food ;; turtle procedure + if food > 0 + [ set color orange + 1 ;; pick up food + set food food - 1 ;; and reduce the food source + rt 180 ;; and turn around + stop ] + ;; go in the direction where the chemical smell is strongest + if (chemical >= 0.05) and (chemical < 2) + [ uphill-chemical ] +end + +;; sniff left and right, and go where the strongest smell is +to uphill-chemical ;; turtle procedure + let scent-ahead chemical-scent-at-angle 0 + let scent-right chemical-scent-at-angle 45 + let scent-left chemical-scent-at-angle -45 + if (scent-right > scent-ahead) or (scent-left > scent-ahead) + [ ifelse scent-right > scent-left + [ rt 45 ] + [ lt 45 ] ] +end + +;; sniff left and right, and go where the strongest smell is +to uphill-nest-scent ;; turtle procedure + let scent-ahead nest-scent-at-angle 0 + let scent-right nest-scent-at-angle 45 + let scent-left nest-scent-at-angle -45 + if (scent-right > scent-ahead) or (scent-left > scent-ahead) + [ ifelse scent-right > scent-left + [ rt 45 ] + [ lt 45 ] ] +end + +to wiggle ;; turtle procedure + rt random 40 + lt random 40 + if not can-move? 1 [ rt 180 ] +end + +to-report nest-scent-at-angle [angle] + let p patch-right-and-ahead angle 1 + if p = nobody [ report 0 ] + report [nest-scent] of p +end + +to-report chemical-scent-at-angle [angle] + let p patch-right-and-ahead angle 1 + if p = nobody [ report 0 ] + report [chemical] of p +end +@#$#@#$#@ +GRAPHICS-WINDOW +257 +10 +764 +538 +35 +35 +7.0 +1 +10 +1 +1 +1 +0 +0 +0 +1 +-35 +35 +-35 +35 +1 +1 +1 +ticks +30.0 + +BUTTON +46 +71 +126 +104 +NIL +setup +NIL +1 +T +OBSERVER +NIL +NIL +NIL +NIL +1 + +SLIDER +31 +106 +221 +139 +diffusion-rate +diffusion-rate +0.0 +99.0 +50 +1.0 +1 +NIL +HORIZONTAL + +SLIDER +31 +141 +221 +174 +evaporation-rate +evaporation-rate +0.0 +99.0 +10 +1.0 +1 +NIL +HORIZONTAL + +BUTTON +136 +71 +211 +104 +NIL +go +T +1 +T +OBSERVER +NIL +NIL +NIL +NIL +1 + +SLIDER +31 +36 +221 +69 +population +population +0.0 +200.0 +125 +1.0 +1 +NIL +HORIZONTAL + +PLOT +5 +197 +248 +476 +Food in each pile +time +food +0.0 +50.0 +0.0 +120.0 +true +false +"" "" +PENS +"food-in-pile1" 1.0 0 -11221820 true "" "plotxy ticks sum [food] of patches with [pcolor = cyan]" +"food-in-pile2" 1.0 0 -13791810 true "" "plotxy ticks sum [food] of patches with [pcolor = sky]" +"food-in-pile3" 1.0 0 -13345367 true "" "plotxy ticks sum [food] of patches with [pcolor = blue]" + +@#$#@#$#@ +## WHAT IS IT? + +In this project, a colony of ants forages for food. Though each ant follows a set of simple rules, the colony as a whole acts in a sophisticated way. + +## HOW IT WORKS + +When an ant finds a piece of food, it carries the food back to the nest, dropping a chemical as it moves. When other ants "sniff" the chemical, they follow the chemical toward the food. As more ants carry food to the nest, they reinforce the chemical trail. + +## HOW TO USE IT + +Click the SETUP button to set up the ant nest (in violet, at center) and three piles of food. Click the GO button to start the simulation. The chemical is shown in a green-to-white gradient. + +The EVAPORATION-RATE slider controls the evaporation rate of the chemical. The DIFFUSION-RATE slider controls the diffusion rate of the chemical. + +If you want to change the number of ants, move the POPULATION slider before pressing SETUP. + +## THINGS TO NOTICE + +The ant colony generally exploits the food source in order, starting with the food closest to the nest, and finishing with the food most distant from the nest. It is more difficult for the ants to form a stable trail to the more distant food, since the chemical trail has more time to evaporate and diffuse before being reinforced. + +Once the colony finishes collecting the closest food, the chemical trail to that food naturally disappears, freeing up ants to help collect the other food sources. The more distant food sources require a larger "critical number" of ants to form a stable trail. + +The consumption of the food is shown in a plot. The line colors in the plot match the colors of the food piles. + +## EXTENDING THE MODEL + +Try different placements for the food sources. What happens if two food sources are equidistant from the nest? When that happens in the real world, ant colonies typically exploit one source then the other (not at the same time). + +In this project, the ants use a "trick" to find their way back to the nest: they follow the "nest scent." Real ants use a variety of different approaches to find their way back to the nest. Try to implement some alternative strategies. + +The ants only respond to chemical levels between 0.05 and 2. The lower limit is used so the ants aren't infinitely sensitive. Try removing the upper limit. What happens? Why? + +In the `uphill-chemical` procedure, the ant "follows the gradient" of the chemical. That is, it "sniffs" in three directions, then turns in the direction where the chemical is strongest. You might want to try variants of the `uphill-chemical` procedure, changing the number and placement of "ant sniffs." + +## NETLOGO FEATURES + +The built-in `diffuse` primitive lets us diffuse the chemical easily without complicated code. + +The primitive `patch-right-and-ahead` is used to make the ants smell in different directions without actually turning. + +## CREDITS AND REFERENCES +@#$#@#$#@ +default +true +0 +Polygon -7500403 true true 150 5 40 250 150 205 260 250 + +airplane +true +0 +Polygon -7500403 true true 150 0 135 15 120 60 120 105 15 165 15 195 120 180 135 240 105 270 120 285 150 270 180 285 210 270 165 240 180 180 285 195 285 165 180 105 180 60 165 15 + +arrow +true +0 +Polygon -7500403 true true 150 0 0 150 105 150 105 293 195 293 195 150 300 150 + +box +false +0 +Polygon -7500403 true true 150 285 285 225 285 75 150 135 +Polygon -7500403 true true 150 135 15 75 150 15 285 75 +Polygon -7500403 true true 15 75 15 225 150 285 150 135 +Line -16777216 false 150 285 150 135 +Line -16777216 false 150 135 15 75 +Line -16777216 false 150 135 285 75 + +bug +true +0 +Circle -7500403 true true 96 182 108 +Circle -7500403 true true 110 127 80 +Circle -7500403 true true 110 75 80 +Line -7500403 true 150 100 80 30 +Line -7500403 true 150 100 220 30 + +butterfly +true +0 +Polygon -7500403 true true 150 165 209 199 225 225 225 255 195 270 165 255 150 240 +Polygon -7500403 true true 150 165 89 198 75 225 75 255 105 270 135 255 150 240 +Polygon -7500403 true true 139 148 100 105 55 90 25 90 10 105 10 135 25 180 40 195 85 194 139 163 +Polygon -7500403 true true 162 150 200 105 245 90 275 90 290 105 290 135 275 180 260 195 215 195 162 165 +Polygon -16777216 true false 150 255 135 225 120 150 135 120 150 105 165 120 180 150 165 225 +Circle -16777216 true false 135 90 30 +Line -16777216 false 150 105 195 60 +Line -16777216 false 150 105 105 60 + +car +false +0 +Polygon -7500403 true true 300 180 279 164 261 144 240 135 226 132 213 106 203 84 185 63 159 50 135 50 75 60 0 150 0 165 0 225 300 225 300 180 +Circle -16777216 true false 180 180 90 +Circle -16777216 true false 30 180 90 +Polygon -16777216 true false 162 80 132 78 134 135 209 135 194 105 189 96 180 89 +Circle -7500403 true true 47 195 58 +Circle -7500403 true true 195 195 58 + +circle +false +0 +Circle -7500403 true true 0 0 300 + +circle 2 +false +0 +Circle -7500403 true true 0 0 300 +Circle -16777216 true false 30 30 240 + +cow +false +0 +Polygon -7500403 true true 200 193 197 249 179 249 177 196 166 187 140 189 93 191 78 179 72 211 49 209 48 181 37 149 25 120 25 89 45 72 103 84 179 75 198 76 252 64 272 81 293 103 285 121 255 121 242 118 224 167 +Polygon -7500403 true true 73 210 86 251 62 249 48 208 +Polygon -7500403 true true 25 114 16 195 9 204 23 213 25 200 39 123 + +cylinder +false +0 +Circle -7500403 true true 0 0 300 + +dot +false +0 +Circle -7500403 true true 90 90 120 + +face happy +false +0 +Circle -7500403 true true 8 8 285 +Circle -16777216 true false 60 75 60 +Circle -16777216 true false 180 75 60 +Polygon -16777216 true false 150 255 90 239 62 213 47 191 67 179 90 203 109 218 150 225 192 218 210 203 227 181 251 194 236 217 212 240 + +face neutral +false +0 +Circle -7500403 true true 8 7 285 +Circle -16777216 true false 60 75 60 +Circle -16777216 true false 180 75 60 +Rectangle -16777216 true false 60 195 240 225 + +face sad +false +0 +Circle -7500403 true true 8 8 285 +Circle -16777216 true false 60 75 60 +Circle -16777216 true false 180 75 60 +Polygon -16777216 true false 150 168 90 184 62 210 47 232 67 244 90 220 109 205 150 198 192 205 210 220 227 242 251 229 236 206 212 183 + +fish +false +0 +Polygon -1 true false 44 131 21 87 15 86 0 120 15 150 0 180 13 214 20 212 45 166 +Polygon -1 true false 135 195 119 235 95 218 76 210 46 204 60 165 +Polygon -1 true false 75 45 83 77 71 103 86 114 166 78 135 60 +Polygon -7500403 true true 30 136 151 77 226 81 280 119 292 146 292 160 287 170 270 195 195 210 151 212 30 166 +Circle -16777216 true false 215 106 30 + +flag +false +0 +Rectangle -7500403 true true 60 15 75 300 +Polygon -7500403 true true 90 150 270 90 90 30 +Line -7500403 true 75 135 90 135 +Line -7500403 true 75 45 90 45 + +flower +false +0 +Polygon -10899396 true false 135 120 165 165 180 210 180 240 150 300 165 300 195 240 195 195 165 135 +Circle -7500403 true true 85 132 38 +Circle -7500403 true true 130 147 38 +Circle -7500403 true true 192 85 38 +Circle -7500403 true true 85 40 38 +Circle -7500403 true true 177 40 38 +Circle -7500403 true true 177 132 38 +Circle -7500403 true true 70 85 38 +Circle -7500403 true true 130 25 38 +Circle -7500403 true true 96 51 108 +Circle -16777216 true false 113 68 74 +Polygon -10899396 true false 189 233 219 188 249 173 279 188 234 218 +Polygon -10899396 true false 180 255 150 210 105 210 75 240 135 240 + +house +false +0 +Rectangle -7500403 true true 45 120 255 285 +Rectangle -16777216 true false 120 210 180 285 +Polygon -7500403 true true 15 120 150 15 285 120 +Line -16777216 false 30 120 270 120 + +leaf +false +0 +Polygon -7500403 true true 150 210 135 195 120 210 60 210 30 195 60 180 60 165 15 135 30 120 15 105 40 104 45 90 60 90 90 105 105 120 120 120 105 60 120 60 135 30 150 15 165 30 180 60 195 60 180 120 195 120 210 105 240 90 255 90 263 104 285 105 270 120 285 135 240 165 240 180 270 195 240 210 180 210 165 195 +Polygon -7500403 true true 135 195 135 240 120 255 105 255 105 285 135 285 165 240 165 195 + +line +true +0 +Line -7500403 true 150 0 150 300 + +line half +true +0 +Line -7500403 true 150 0 150 150 + +pentagon +false +0 +Polygon -7500403 true true 150 15 15 120 60 285 240 285 285 120 + +person +false +0 +Circle -7500403 true true 110 5 80 +Polygon -7500403 true true 105 90 120 195 90 285 105 300 135 300 150 225 165 300 195 300 210 285 180 195 195 90 +Rectangle -7500403 true true 127 79 172 94 +Polygon -7500403 true true 195 90 240 150 225 180 165 105 +Polygon -7500403 true true 105 90 60 150 75 180 135 105 + +plant +false +0 +Rectangle -7500403 true true 135 90 165 300 +Polygon -7500403 true true 135 255 90 210 45 195 75 255 135 285 +Polygon -7500403 true true 165 255 210 210 255 195 225 255 165 285 +Polygon -7500403 true true 135 180 90 135 45 120 75 180 135 210 +Polygon -7500403 true true 165 180 165 210 225 180 255 120 210 135 +Polygon -7500403 true true 135 105 90 60 45 45 75 105 135 135 +Polygon -7500403 true true 165 105 165 135 225 105 255 45 210 60 +Polygon -7500403 true true 135 90 120 45 150 15 180 45 165 90 + +square +false +0 +Rectangle -7500403 true true 30 30 270 270 + +square 2 +false +0 +Rectangle -7500403 true true 30 30 270 270 +Rectangle -16777216 true false 60 60 240 240 + +star +false +0 +Polygon -7500403 true true 151 1 185 108 298 108 207 175 242 282 151 216 59 282 94 175 3 108 116 108 + +target +false +0 +Circle -7500403 true true 0 0 300 +Circle -16777216 true false 30 30 240 +Circle -7500403 true true 60 60 180 +Circle -16777216 true false 90 90 120 +Circle -7500403 true true 120 120 60 + +tree +false +0 +Circle -7500403 true true 118 3 94 +Rectangle -6459832 true false 120 195 180 300 +Circle -7500403 true true 65 21 108 +Circle -7500403 true true 116 41 127 +Circle -7500403 true true 45 90 120 +Circle -7500403 true true 104 74 152 + +triangle +false +0 +Polygon -7500403 true true 150 30 15 255 285 255 + +triangle 2 +false +0 +Polygon -7500403 true true 150 30 15 255 285 255 +Polygon -16777216 true false 151 99 225 223 75 224 + +truck +false +0 +Rectangle -7500403 true true 4 45 195 187 +Polygon -7500403 true true 296 193 296 150 259 134 244 104 208 104 207 194 +Rectangle -1 true false 195 60 195 105 +Polygon -16777216 true false 238 112 252 141 219 141 218 112 +Circle -16777216 true false 234 174 42 +Rectangle -7500403 true true 181 185 214 194 +Circle -16777216 true false 144 174 42 +Circle -16777216 true false 24 174 42 +Circle -7500403 false true 24 174 42 +Circle -7500403 false true 144 174 42 +Circle -7500403 false true 234 174 42 + +turtle +true +0 +Polygon -10899396 true false 215 204 240 233 246 254 228 266 215 252 193 210 +Polygon -10899396 true false 195 90 225 75 245 75 260 89 269 108 261 124 240 105 225 105 210 105 +Polygon -10899396 true false 105 90 75 75 55 75 40 89 31 108 39 124 60 105 75 105 90 105 +Polygon -10899396 true false 132 85 134 64 107 51 108 17 150 2 192 18 192 52 169 65 172 87 +Polygon -10899396 true false 85 204 60 233 54 254 72 266 85 252 107 210 +Polygon -7500403 true true 119 75 179 75 209 101 224 135 220 225 175 261 128 261 81 224 74 135 88 99 + +wheel +false +0 +Circle -7500403 true true 3 3 294 +Circle -16777216 true false 30 30 240 +Line -7500403 true 150 285 150 15 +Line -7500403 true 15 150 285 150 +Circle -7500403 true true 120 120 60 +Line -7500403 true 216 40 79 269 +Line -7500403 true 40 84 269 221 +Line -7500403 true 40 216 269 79 +Line -7500403 true 84 40 221 269 + +x +false +0 +Polygon -7500403 true true 270 75 225 30 30 225 75 270 +Polygon -7500403 true true 30 75 75 30 270 225 225 270 + +@#$#@#$#@ +NetLogo 5.0.5 +@#$#@#$#@ +@#$#@#$#@ +@#$#@#$#@ +@#$#@#$#@ +@#$#@#$#@ +default +0.0 +-0.2 0 1.0 0.0 +0.0 1 1.0 0.0 +0.2 0 1.0 0.0 +link direction +true +0 +Line -7500403 true 150 150 90 180 +Line -7500403 true 150 150 210 180 + +@#$#@#$#@ +0 +@#$#@#$#@ diff --git a/samples/NetLogo/Life.nlogo b/samples/NetLogo/Life.nlogo new file mode 100644 index 00000000..f79207f0 --- /dev/null +++ b/samples/NetLogo/Life.nlogo @@ -0,0 +1,628 @@ +patches-own [ + living? ;; indicates if the cell is living + live-neighbors ;; counts how many neighboring cells are alive +] + +to setup-blank + clear-all + ask patches [ cell-death ] + reset-ticks +end + +to setup-random + clear-all + ask patches + [ ifelse random-float 100.0 < initial-density + [ cell-birth ] + [ cell-death ] ] + reset-ticks +end + +to cell-birth + set living? true + set pcolor fgcolor +end + +to cell-death + set living? false + set pcolor bgcolor +end + +to go + ask patches + [ set live-neighbors count neighbors with [living?] ] + ;; Starting a new "ask patches" here ensures that all the patches + ;; finish executing the first ask before any of them start executing + ;; the second ask. This keeps all the patches in synch with each other, + ;; so the births and deaths at each generation all happen in lockstep. + ask patches + [ ifelse live-neighbors = 3 + [ cell-birth ] + [ if live-neighbors != 2 + [ cell-death ] ] ] + tick +end + +to draw-cells + let erasing? [living?] of patch mouse-xcor mouse-ycor + while [mouse-down?] + [ ask patch mouse-xcor mouse-ycor + [ ifelse erasing? + [ cell-death ] + [ cell-birth ] ] + display ] +end +@#$#@#$#@ +GRAPHICS-WINDOW +285 +10 +699 +445 +50 +50 +4.0 +1 +10 +1 +1 +1 +0 +1 +1 +1 +-50 +50 +-50 +50 +1 +1 +1 +ticks +15.0 + +SLIDER +120 +67 +276 +100 +initial-density +initial-density +0.0 +100.0 +35 +0.1 +1 +% +HORIZONTAL + +BUTTON +11 +68 +113 +101 +NIL +setup-random +NIL +1 +T +OBSERVER +NIL +NIL +NIL +NIL +1 + +BUTTON +11 +204 +114 +242 +go-once +go +NIL +1 +T +OBSERVER +NIL +NIL +NIL +NIL +1 + +BUTTON +122 +204 +225 +242 +go-forever +go +T +1 +T +OBSERVER +NIL +NIL +NIL +NIL +1 + +BUTTON +178 +276 +274 +309 +recolor +ifelse living?\n [ set pcolor fgcolor ]\n [ set pcolor bgcolor ] +NIL +1 +T +PATCH +NIL +NIL +NIL +NIL +1 + +MONITOR +12 +248 +115 +293 +current density +count patches with\n [living?]\n/ count patches +2 +1 +11 + +BUTTON +11 +32 +113 +65 +NIL +setup-blank +NIL +1 +T +OBSERVER +NIL +NIL +NIL +NIL +1 + +TEXTBOX +124 +125 +277 +193 +When this button is down, you can add or remove cells by holding down the mouse button and \"drawing\". +11 +0.0 +0 + +BUTTON +9 +134 +112 +169 +NIL +draw-cells +T +1 +T +OBSERVER +NIL +NIL +NIL +NIL +1 + +INPUTBOX +119 +309 +274 +369 +fgcolor +123 +1 +0 +Color + +INPUTBOX +119 +371 +274 +431 +bgcolor +79 +1 +0 +Color + +@#$#@#$#@ +## WHAT IS IT? + +This program is an example of a two-dimensional cellular automaton. This particular cellular automaton is called The Game of Life. + +A cellular automaton is a computational machine that performs actions based on certain rules. It can be thought of as a board which is divided into cells (such as square cells of a checkerboard). Each cell can be either "alive" or "dead." This is called the "state" of the cell. According to specified rules, each cell will be alive or dead at the next time step. + +## HOW IT WORKS + +The rules of the game are as follows. Each cell checks the state of itself and its eight surrounding neighbors and then sets itself to either alive or dead. If there are less than two alive neighbors, then the cell dies. If there are more than three alive neighbors, the cell dies. If there are 2 alive neighbors, the cell remains in the state it is in. If there are exactly three alive neighbors, the cell becomes alive. This is done in parallel and continues forever. + +There are certain recurring shapes in Life, for example, the "glider" and the "blinker". The glider is composed of 5 cells which form a small arrow-headed shape, like this: + + O + O + OOO + +This glider will wiggle across the world, retaining its shape. A blinker is a block of three cells (either up and down or left and right) that rotates between horizontal and vertical orientations. + +## HOW TO USE IT + +The INITIAL-DENSITY slider determines the initial density of cells that are alive. SETUP-RANDOM places these cells. GO-FOREVER runs the rule forever. GO-ONCE runs the rule once. + +If you want to draw your own pattern, use the DRAW-CELLS button and then use the mouse to "draw" and "erase" in the view. + +## THINGS TO NOTICE + +Find some objects that are alive, but motionless. + +Is there a "critical density" - one at which all change and motion stops/eternal motion begins? + +## THINGS TO TRY + +Are there any recurring shapes other than gliders and blinkers? + +Build some objects that don't die (using DRAW-CELLS) + +How much life can the board hold and still remain motionless and unchanging? (use DRAW-CELLS) + +The glider gun is a large conglomeration of cells that repeatedly spits out gliders. Find a "glider gun" (very, very difficult!). + +## EXTENDING THE MODEL + +Give some different rules to life and see what happens. + +Experiment with using neighbors4 instead of neighbors (see below). + +## NETLOGO FEATURES + +The neighbors primitive returns the agentset of the patches to the north, south, east, west, northeast, northwest, southeast, and southwest. So `count neighbors with [living?]` counts how many of those eight patches have the `living?` patch variable set to true. + +`neighbors4` is like `neighbors` but only uses the patches to the north, south, east, and west. Some cellular automata, like this one, are defined using the 8-neighbors rule, others the 4-neighbors. + +## RELATED MODELS + +Life Turtle-Based --- same as this, but implemented using turtles instead of patches, for a more attractive display +CA 1D Elementary --- a model that shows all 256 possible simple 1D cellular automata +CA 1D Totalistic --- a model that shows all 2,187 possible 1D 3-color totalistic cellular automata +CA 1D Rule 30 --- the basic rule 30 model +CA 1D Rule 30 Turtle --- the basic rule 30 model implemented using turtles +CA 1D Rule 90 --- the basic rule 90 model +CA 1D Rule 110 --- the basic rule 110 model +CA 1D Rule 250 --- the basic rule 250 model + +## CREDITS AND REFERENCES + +The Game of Life was invented by John Horton Conway. + +See also: + +Von Neumann, J. and Burks, A. W., Eds, 1966. Theory of Self-Reproducing Automata. University of Illinois Press, Champaign, IL. + +"LifeLine: A Quarterly Newsletter for Enthusiasts of John Conway's Game of Life", nos. 1-11, 1971-1973. + +Martin Gardner, "Mathematical Games: The fantastic combinations of John Conway's new solitaire game `life',", Scientific American, October, 1970, pp. 120-123. + +Martin Gardner, "Mathematical Games: On cellular automata, self-reproduction, the Garden of Eden, and the game `life',", Scientific American, February, 1971, pp. 112-117. + +Berlekamp, Conway, and Guy, Winning Ways for your Mathematical Plays, Academic Press: New York, 1982. + +William Poundstone, The Recursive Universe, William Morrow: New York, 1985. +@#$#@#$#@ +default +true +0 +Polygon -7500403 true true 150 5 40 250 150 205 260 250 + +airplane +true +0 +Polygon -7500403 true true 150 0 135 15 120 60 120 105 15 165 15 195 120 180 135 240 105 270 120 285 150 270 180 285 210 270 165 240 180 180 285 195 285 165 180 105 180 60 165 15 + +arrow +true +0 +Polygon -7500403 true true 150 0 0 150 105 150 105 293 195 293 195 150 300 150 + +box +false +0 +Polygon -7500403 true true 150 285 285 225 285 75 150 135 +Polygon -7500403 true true 150 135 15 75 150 15 285 75 +Polygon -7500403 true true 15 75 15 225 150 285 150 135 +Line -16777216 false 150 285 150 135 +Line -16777216 false 150 135 15 75 +Line -16777216 false 150 135 285 75 + +bug +true +0 +Circle -7500403 true true 96 182 108 +Circle -7500403 true true 110 127 80 +Circle -7500403 true true 110 75 80 +Line -7500403 true 150 100 80 30 +Line -7500403 true 150 100 220 30 + +butterfly +true +0 +Polygon -7500403 true true 150 165 209 199 225 225 225 255 195 270 165 255 150 240 +Polygon -7500403 true true 150 165 89 198 75 225 75 255 105 270 135 255 150 240 +Polygon -7500403 true true 139 148 100 105 55 90 25 90 10 105 10 135 25 180 40 195 85 194 139 163 +Polygon -7500403 true true 162 150 200 105 245 90 275 90 290 105 290 135 275 180 260 195 215 195 162 165 +Polygon -16777216 true false 150 255 135 225 120 150 135 120 150 105 165 120 180 150 165 225 +Circle -16777216 true false 135 90 30 +Line -16777216 false 150 105 195 60 +Line -16777216 false 150 105 105 60 + +car +false +0 +Polygon -7500403 true true 300 180 279 164 261 144 240 135 226 132 213 106 203 84 185 63 159 50 135 50 75 60 0 150 0 165 0 225 300 225 300 180 +Circle -16777216 true false 180 180 90 +Circle -16777216 true false 30 180 90 +Polygon -16777216 true false 162 80 132 78 134 135 209 135 194 105 189 96 180 89 +Circle -7500403 true true 47 195 58 +Circle -7500403 true true 195 195 58 + +circle +false +0 +Circle -7500403 true true 0 0 300 + +circle 2 +false +0 +Circle -7500403 true true 0 0 300 +Circle -16777216 true false 30 30 240 + +cow +false +0 +Polygon -7500403 true true 200 193 197 249 179 249 177 196 166 187 140 189 93 191 78 179 72 211 49 209 48 181 37 149 25 120 25 89 45 72 103 84 179 75 198 76 252 64 272 81 293 103 285 121 255 121 242 118 224 167 +Polygon -7500403 true true 73 210 86 251 62 249 48 208 +Polygon -7500403 true true 25 114 16 195 9 204 23 213 25 200 39 123 + +cylinder +false +0 +Circle -7500403 true true 0 0 300 + +dot +false +0 +Circle -7500403 true true 90 90 120 + +face happy +false +0 +Circle -7500403 true true 8 8 285 +Circle -16777216 true false 60 75 60 +Circle -16777216 true false 180 75 60 +Polygon -16777216 true false 150 255 90 239 62 213 47 191 67 179 90 203 109 218 150 225 192 218 210 203 227 181 251 194 236 217 212 240 + +face neutral +false +0 +Circle -7500403 true true 8 7 285 +Circle -16777216 true false 60 75 60 +Circle -16777216 true false 180 75 60 +Rectangle -16777216 true false 60 195 240 225 + +face sad +false +0 +Circle -7500403 true true 8 8 285 +Circle -16777216 true false 60 75 60 +Circle -16777216 true false 180 75 60 +Polygon -16777216 true false 150 168 90 184 62 210 47 232 67 244 90 220 109 205 150 198 192 205 210 220 227 242 251 229 236 206 212 183 + +fish +false +0 +Polygon -1 true false 44 131 21 87 15 86 0 120 15 150 0 180 13 214 20 212 45 166 +Polygon -1 true false 135 195 119 235 95 218 76 210 46 204 60 165 +Polygon -1 true false 75 45 83 77 71 103 86 114 166 78 135 60 +Polygon -7500403 true true 30 136 151 77 226 81 280 119 292 146 292 160 287 170 270 195 195 210 151 212 30 166 +Circle -16777216 true false 215 106 30 + +flag +false +0 +Rectangle -7500403 true true 60 15 75 300 +Polygon -7500403 true true 90 150 270 90 90 30 +Line -7500403 true 75 135 90 135 +Line -7500403 true 75 45 90 45 + +flower +false +0 +Polygon -10899396 true false 135 120 165 165 180 210 180 240 150 300 165 300 195 240 195 195 165 135 +Circle -7500403 true true 85 132 38 +Circle -7500403 true true 130 147 38 +Circle -7500403 true true 192 85 38 +Circle -7500403 true true 85 40 38 +Circle -7500403 true true 177 40 38 +Circle -7500403 true true 177 132 38 +Circle -7500403 true true 70 85 38 +Circle -7500403 true true 130 25 38 +Circle -7500403 true true 96 51 108 +Circle -16777216 true false 113 68 74 +Polygon -10899396 true false 189 233 219 188 249 173 279 188 234 218 +Polygon -10899396 true false 180 255 150 210 105 210 75 240 135 240 + +house +false +0 +Rectangle -7500403 true true 45 120 255 285 +Rectangle -16777216 true false 120 210 180 285 +Polygon -7500403 true true 15 120 150 15 285 120 +Line -16777216 false 30 120 270 120 + +leaf +false +0 +Polygon -7500403 true true 150 210 135 195 120 210 60 210 30 195 60 180 60 165 15 135 30 120 15 105 40 104 45 90 60 90 90 105 105 120 120 120 105 60 120 60 135 30 150 15 165 30 180 60 195 60 180 120 195 120 210 105 240 90 255 90 263 104 285 105 270 120 285 135 240 165 240 180 270 195 240 210 180 210 165 195 +Polygon -7500403 true true 135 195 135 240 120 255 105 255 105 285 135 285 165 240 165 195 + +line +true +0 +Line -7500403 true 150 0 150 300 + +line half +true +0 +Line -7500403 true 150 0 150 150 + +pentagon +false +0 +Polygon -7500403 true true 150 15 15 120 60 285 240 285 285 120 + +person +false +0 +Circle -7500403 true true 110 5 80 +Polygon -7500403 true true 105 90 120 195 90 285 105 300 135 300 150 225 165 300 195 300 210 285 180 195 195 90 +Rectangle -7500403 true true 127 79 172 94 +Polygon -7500403 true true 195 90 240 150 225 180 165 105 +Polygon -7500403 true true 105 90 60 150 75 180 135 105 + +plant +false +0 +Rectangle -7500403 true true 135 90 165 300 +Polygon -7500403 true true 135 255 90 210 45 195 75 255 135 285 +Polygon -7500403 true true 165 255 210 210 255 195 225 255 165 285 +Polygon -7500403 true true 135 180 90 135 45 120 75 180 135 210 +Polygon -7500403 true true 165 180 165 210 225 180 255 120 210 135 +Polygon -7500403 true true 135 105 90 60 45 45 75 105 135 135 +Polygon -7500403 true true 165 105 165 135 225 105 255 45 210 60 +Polygon -7500403 true true 135 90 120 45 150 15 180 45 165 90 + +square +false +0 +Rectangle -7500403 true true 30 30 270 270 + +square 2 +false +0 +Rectangle -7500403 true true 30 30 270 270 +Rectangle -16777216 true false 60 60 240 240 + +star +false +0 +Polygon -7500403 true true 151 1 185 108 298 108 207 175 242 282 151 216 59 282 94 175 3 108 116 108 + +target +false +0 +Circle -7500403 true true 0 0 300 +Circle -16777216 true false 30 30 240 +Circle -7500403 true true 60 60 180 +Circle -16777216 true false 90 90 120 +Circle -7500403 true true 120 120 60 + +tree +false +0 +Circle -7500403 true true 118 3 94 +Rectangle -6459832 true false 120 195 180 300 +Circle -7500403 true true 65 21 108 +Circle -7500403 true true 116 41 127 +Circle -7500403 true true 45 90 120 +Circle -7500403 true true 104 74 152 + +triangle +false +0 +Polygon -7500403 true true 150 30 15 255 285 255 + +triangle 2 +false +0 +Polygon -7500403 true true 150 30 15 255 285 255 +Polygon -16777216 true false 151 99 225 223 75 224 + +truck +false +0 +Rectangle -7500403 true true 4 45 195 187 +Polygon -7500403 true true 296 193 296 150 259 134 244 104 208 104 207 194 +Rectangle -1 true false 195 60 195 105 +Polygon -16777216 true false 238 112 252 141 219 141 218 112 +Circle -16777216 true false 234 174 42 +Rectangle -7500403 true true 181 185 214 194 +Circle -16777216 true false 144 174 42 +Circle -16777216 true false 24 174 42 +Circle -7500403 false true 24 174 42 +Circle -7500403 false true 144 174 42 +Circle -7500403 false true 234 174 42 + +turtle +true +0 +Polygon -10899396 true false 215 204 240 233 246 254 228 266 215 252 193 210 +Polygon -10899396 true false 195 90 225 75 245 75 260 89 269 108 261 124 240 105 225 105 210 105 +Polygon -10899396 true false 105 90 75 75 55 75 40 89 31 108 39 124 60 105 75 105 90 105 +Polygon -10899396 true false 132 85 134 64 107 51 108 17 150 2 192 18 192 52 169 65 172 87 +Polygon -10899396 true false 85 204 60 233 54 254 72 266 85 252 107 210 +Polygon -7500403 true true 119 75 179 75 209 101 224 135 220 225 175 261 128 261 81 224 74 135 88 99 + +wheel +false +0 +Circle -7500403 true true 3 3 294 +Circle -16777216 true false 30 30 240 +Line -7500403 true 150 285 150 15 +Line -7500403 true 15 150 285 150 +Circle -7500403 true true 120 120 60 +Line -7500403 true 216 40 79 269 +Line -7500403 true 40 84 269 221 +Line -7500403 true 40 216 269 79 +Line -7500403 true 84 40 221 269 + +x +false +0 +Polygon -7500403 true true 270 75 225 30 30 225 75 270 +Polygon -7500403 true true 30 75 75 30 270 225 225 270 + +@#$#@#$#@ +NetLogo 5.0.5 +@#$#@#$#@ +setup-random repeat 20 [ go ] +@#$#@#$#@ +@#$#@#$#@ +@#$#@#$#@ +@#$#@#$#@ +default +0.0 +-0.2 0 1.0 0.0 +0.0 1 1.0 0.0 +0.2 0 1.0 0.0 +link direction +true +0 +Line -7500403 true 150 150 90 180 +Line -7500403 true 150 150 210 180 + +@#$#@#$#@ +0 +@#$#@#$#@ diff --git a/samples/NetLogo/Star Fractal.nlogo b/samples/NetLogo/Star Fractal.nlogo new file mode 100644 index 00000000..e5486b23 --- /dev/null +++ b/samples/NetLogo/Star Fractal.nlogo @@ -0,0 +1,501 @@ +turtles-own [ + moves ;; how many sides the turtles has drawn so far + star-side ;; The length of the side that the turtle is drawing + generation ;; How many generations of turtles have come before it. So, +] ;; if the turtle was hatched from a turtle that was hatched + ;; by another turtle, it's generation is 2 + +to setup + clear-all + crt 1 [ + set size 8 ;; so turtles are easy to see + set ycor max-pycor * 0.9 ;; place near top of world + set star-side ycor * 1.97538 ;; length of the sides of the star it will draw + pen-down + set heading 180 + 18 + recolor + ] + reset-ticks +end + +to go + if not any? turtles [ stop ] + ask turtles [ + fd star-side + rt 180 + 36 + if generation < fractal-level [ ;; If it's not drawing at the deepest level of the figure, + hatch 1 [ ;; hatch a new turtle to draw at a lower level + set generation generation + 1 + set star-side star-side / 2 + recolor + set moves 0 + rt 18 + ] + ] + set moves moves + 1 + if moves > 5 [ die ] ;; When the turtle has completed its star, it's done + ] + tick +end + +to recolor ;; turtle procedure + set color scale-color red (fractal-level - generation) -1 (fractal-level + 1) +end +@#$#@#$#@ +GRAPHICS-WINDOW +274 +10 +686 +443 +100 +100 +2.0 +1 +10 +1 +1 +1 +0 +0 +0 +1 +-100 +100 +-100 +100 +1 +1 +1 +ticks +30.0 + +BUTTON +146 +42 +211 +75 +go +go +T +1 +T +OBSERVER +NIL +NIL +NIL +NIL +1 + +SLIDER +32 +88 +248 +121 +fractal-level +fractal-level +0 +4 +3 +1 +1 +NIL +HORIZONTAL + +BUTTON +69 +42 +133 +75 +setup +setup +NIL +1 +T +OBSERVER +NIL +NIL +NIL +NIL +1 + +MONITOR +105 +128 +190 +173 +turtles +count turtles +3 +1 +11 + +PLOT +2 +179 +272 +394 +Turtles vs. Time +Time +Num Turtles +0.0 +25.0 +0.0 +180.0 +true +false +"" "" +PENS +"default" 1.0 0 -16777216 true "" "plot count turtles" + +@#$#@#$#@ +## WHAT IS IT? + +This model creates a fractal-like structure consisting of stars drawn at various scales, the number of which is specified by the user. The structure is drawn by generations of turtles that draw stars at a given scale and hatch successive generations to draw new ones at smaller scales. + +## HOW TO USE IT + +The FRACTAL-LEVEL slider controls the number of levels the structure is drawn in. For instance, a fractal level of 0 results in a single star, while a fractal level of 1 draws a star with smaller stars that begin at each of its 5 corners. This pattern is repeated as the level increases. + +Click the SETUP button to initialize the structure and GO to begin drawing it. + +## THINGS TO NOTICE + +The figure drawn embodies the most important fractal quality: self-similar structure at smaller scales. This means that no matter how far you "zoom in" to it, you will still see the same shape (namely, a star). The fractal level determines to how small a scale this property holds, so the greater the level the more you can "zoom in" and still see stars. + +Notice that at a fractal level greater than 1, the model begins with one turtle, which hatches new turtles at each corner, and these turtles similarly hatch new ones at each of their corners as well. This behavior is made possible by a powerful mathematical technique called recursion. A process is called recursive when its workings involve "performing itself". In this case, the process performed by each turtle at each step is to draw a new side of its star and then create new turtles to perform the very same process. A helpful property of recursive processes is that the instructions are often short, because each performer is executing the same instructions. Hence the brevity of Star Fractal's procedures. + +The ideas behind fractal scaling (the property of self-similar structures at different scales) and recursion are essentially the same. This is suggested by the fact that a recursive process is able to generate a fractal-like structure, as in this model. One way to think about it is that recursion applies these ideas to processes (like NetLogo models), and fractal scaling applies them to physical or mathematical structures (like the figure drawn by Star Fractal). + +## THINGS TO TRY + +Edit GO so that it's not a forever button, and/or use the speed slider to slow the model down, and note what happens during each tick. Notice that what begins as a single drawing multiplies into many drawings, each of which is at a smaller scale but proceeds exactly like the larger one that spawned it. Thus, recursion begets self-sameness at different scales. + +Try the model initially with small fractal levels and work your way up to higher ones. Try to figure out how many more stars are incorporated into the figure each time the level increases by one. What kind of general rule you can come up with? That is, given a generation of turtles g, how many turtles will be in the generation g + 1? Start from g = 0. (This is a recursive rule.) + +## EXTENDING THE MODEL + +In increasing order of difficulty: + +Change the color scaling so that the smaller stars are brighter than the larger ones. + +Change the model so that it draws shapes other than stars. Will any shape work? + +The structure that this model draws is only "fractal-like", because even when you "zoom in" and look at smaller scales, the smaller stars aren't actually part of the larger ones; they're just connected to them at a vertex. An important property of fractals is that the larger structures are composed of the smaller ones, something which clearly doesn't hold here. For a tougher exercise, try changing the model so that the smaller stars (or whatever shapes are being drawn) are actually part of the larger ones, for instance by drawing them in the middle of their sides. Such a figure will be a lot less "noisy" than this one, in terms of how difficult it is to discern individual stars, and it will have different properties when you zoom in. + +## NETLOGO FEATURES + +This model makes use of an important NetLogo command: `hatch`. `hatch` allows one turtle to create a new one on the same patch and give it some initial instructions. In this case, the parent turtle sets the length of the star its offspring will draw, its initial heading, and several other variables. Notice that the new turtle uses the values of its parent turtle's variables in the body of the hatch procedure. + +Another useful primitive this model uses is `scale-color`. It is used to make the brightness of the color the turtles are drawing inversely proportional to the turtle's generation, so that larger stars are brighter than smaller ones (this was done to make the larger ones more visible). This code: + + scale-color red (fractal-level - generation) -1 (fractal-level + 1) + +works as follows: Subtract the value of `generation` from that of `fractal-level`. The higher that resulting value is on the scale from -1 to `(fractal-level + 1)`, the darker the shade of red the turtle will draw with. + +## CREDITS AND REFERENCES +@#$#@#$#@ +default +true +0 +Polygon -7500403 true true 150 5 40 250 150 205 260 250 + +airplane +true +0 +Polygon -7500403 true true 150 0 135 15 120 60 120 105 15 165 15 195 120 180 135 240 105 270 120 285 150 270 180 285 210 270 165 240 180 180 285 195 285 165 180 105 180 60 165 15 + +arrow +true +0 +Polygon -7500403 true true 150 0 0 150 105 150 105 293 195 293 195 150 300 150 + +box +false +0 +Polygon -7500403 true true 150 285 285 225 285 75 150 135 +Polygon -7500403 true true 150 135 15 75 150 15 285 75 +Polygon -7500403 true true 15 75 15 225 150 285 150 135 +Line -16777216 false 150 285 150 135 +Line -16777216 false 150 135 15 75 +Line -16777216 false 150 135 285 75 + +bug +true +0 +Circle -7500403 true true 96 182 108 +Circle -7500403 true true 110 127 80 +Circle -7500403 true true 110 75 80 +Line -7500403 true 150 100 80 30 +Line -7500403 true 150 100 220 30 + +butterfly +true +0 +Polygon -7500403 true true 150 165 209 199 225 225 225 255 195 270 165 255 150 240 +Polygon -7500403 true true 150 165 89 198 75 225 75 255 105 270 135 255 150 240 +Polygon -7500403 true true 139 148 100 105 55 90 25 90 10 105 10 135 25 180 40 195 85 194 139 163 +Polygon -7500403 true true 162 150 200 105 245 90 275 90 290 105 290 135 275 180 260 195 215 195 162 165 +Polygon -16777216 true false 150 255 135 225 120 150 135 120 150 105 165 120 180 150 165 225 +Circle -16777216 true false 135 90 30 +Line -16777216 false 150 105 195 60 +Line -16777216 false 150 105 105 60 + +car +false +0 +Polygon -7500403 true true 300 180 279 164 261 144 240 135 226 132 213 106 203 84 185 63 159 50 135 50 75 60 0 150 0 165 0 225 300 225 300 180 +Circle -16777216 true false 180 180 90 +Circle -16777216 true false 30 180 90 +Polygon -16777216 true false 162 80 132 78 134 135 209 135 194 105 189 96 180 89 +Circle -7500403 true true 47 195 58 +Circle -7500403 true true 195 195 58 + +circle +false +0 +Circle -7500403 true true 0 0 300 + +circle 2 +false +0 +Circle -7500403 true true 0 0 300 +Circle -16777216 true false 30 30 240 + +cow +false +0 +Polygon -7500403 true true 200 193 197 249 179 249 177 196 166 187 140 189 93 191 78 179 72 211 49 209 48 181 37 149 25 120 25 89 45 72 103 84 179 75 198 76 252 64 272 81 293 103 285 121 255 121 242 118 224 167 +Polygon -7500403 true true 73 210 86 251 62 249 48 208 +Polygon -7500403 true true 25 114 16 195 9 204 23 213 25 200 39 123 + +cylinder +false +0 +Circle -7500403 true true 0 0 300 + +dot +false +0 +Circle -7500403 true true 90 90 120 + +face happy +false +0 +Circle -7500403 true true 8 8 285 +Circle -16777216 true false 60 75 60 +Circle -16777216 true false 180 75 60 +Polygon -16777216 true false 150 255 90 239 62 213 47 191 67 179 90 203 109 218 150 225 192 218 210 203 227 181 251 194 236 217 212 240 + +face neutral +false +0 +Circle -7500403 true true 8 7 285 +Circle -16777216 true false 60 75 60 +Circle -16777216 true false 180 75 60 +Rectangle -16777216 true false 60 195 240 225 + +face sad +false +0 +Circle -7500403 true true 8 8 285 +Circle -16777216 true false 60 75 60 +Circle -16777216 true false 180 75 60 +Polygon -16777216 true false 150 168 90 184 62 210 47 232 67 244 90 220 109 205 150 198 192 205 210 220 227 242 251 229 236 206 212 183 + +fish +false +0 +Polygon -1 true false 44 131 21 87 15 86 0 120 15 150 0 180 13 214 20 212 45 166 +Polygon -1 true false 135 195 119 235 95 218 76 210 46 204 60 165 +Polygon -1 true false 75 45 83 77 71 103 86 114 166 78 135 60 +Polygon -7500403 true true 30 136 151 77 226 81 280 119 292 146 292 160 287 170 270 195 195 210 151 212 30 166 +Circle -16777216 true false 215 106 30 + +flag +false +0 +Rectangle -7500403 true true 60 15 75 300 +Polygon -7500403 true true 90 150 270 90 90 30 +Line -7500403 true 75 135 90 135 +Line -7500403 true 75 45 90 45 + +flower +false +0 +Polygon -10899396 true false 135 120 165 165 180 210 180 240 150 300 165 300 195 240 195 195 165 135 +Circle -7500403 true true 85 132 38 +Circle -7500403 true true 130 147 38 +Circle -7500403 true true 192 85 38 +Circle -7500403 true true 85 40 38 +Circle -7500403 true true 177 40 38 +Circle -7500403 true true 177 132 38 +Circle -7500403 true true 70 85 38 +Circle -7500403 true true 130 25 38 +Circle -7500403 true true 96 51 108 +Circle -16777216 true false 113 68 74 +Polygon -10899396 true false 189 233 219 188 249 173 279 188 234 218 +Polygon -10899396 true false 180 255 150 210 105 210 75 240 135 240 + +house +false +0 +Rectangle -7500403 true true 45 120 255 285 +Rectangle -16777216 true false 120 210 180 285 +Polygon -7500403 true true 15 120 150 15 285 120 +Line -16777216 false 30 120 270 120 + +leaf +false +0 +Polygon -7500403 true true 150 210 135 195 120 210 60 210 30 195 60 180 60 165 15 135 30 120 15 105 40 104 45 90 60 90 90 105 105 120 120 120 105 60 120 60 135 30 150 15 165 30 180 60 195 60 180 120 195 120 210 105 240 90 255 90 263 104 285 105 270 120 285 135 240 165 240 180 270 195 240 210 180 210 165 195 +Polygon -7500403 true true 135 195 135 240 120 255 105 255 105 285 135 285 165 240 165 195 + +line +true +0 +Line -7500403 true 150 0 150 300 + +line half +true +0 +Line -7500403 true 150 0 150 150 + +pentagon +false +0 +Polygon -7500403 true true 150 15 15 120 60 285 240 285 285 120 + +person +false +0 +Circle -7500403 true true 110 5 80 +Polygon -7500403 true true 105 90 120 195 90 285 105 300 135 300 150 225 165 300 195 300 210 285 180 195 195 90 +Rectangle -7500403 true true 127 79 172 94 +Polygon -7500403 true true 195 90 240 150 225 180 165 105 +Polygon -7500403 true true 105 90 60 150 75 180 135 105 + +plant +false +0 +Rectangle -7500403 true true 135 90 165 300 +Polygon -7500403 true true 135 255 90 210 45 195 75 255 135 285 +Polygon -7500403 true true 165 255 210 210 255 195 225 255 165 285 +Polygon -7500403 true true 135 180 90 135 45 120 75 180 135 210 +Polygon -7500403 true true 165 180 165 210 225 180 255 120 210 135 +Polygon -7500403 true true 135 105 90 60 45 45 75 105 135 135 +Polygon -7500403 true true 165 105 165 135 225 105 255 45 210 60 +Polygon -7500403 true true 135 90 120 45 150 15 180 45 165 90 + +square +false +0 +Rectangle -7500403 true true 30 30 270 270 + +square 2 +false +0 +Rectangle -7500403 true true 30 30 270 270 +Rectangle -16777216 true false 60 60 240 240 + +star +false +0 +Polygon -7500403 true true 151 1 185 108 298 108 207 175 242 282 151 216 59 282 94 175 3 108 116 108 + +target +false +0 +Circle -7500403 true true 0 0 300 +Circle -16777216 true false 30 30 240 +Circle -7500403 true true 60 60 180 +Circle -16777216 true false 90 90 120 +Circle -7500403 true true 120 120 60 + +tree +false +0 +Circle -7500403 true true 118 3 94 +Rectangle -6459832 true false 120 195 180 300 +Circle -7500403 true true 65 21 108 +Circle -7500403 true true 116 41 127 +Circle -7500403 true true 45 90 120 +Circle -7500403 true true 104 74 152 + +triangle +false +0 +Polygon -7500403 true true 150 30 15 255 285 255 + +triangle 2 +false +0 +Polygon -7500403 true true 150 30 15 255 285 255 +Polygon -16777216 true false 151 99 225 223 75 224 + +truck +false +0 +Rectangle -7500403 true true 4 45 195 187 +Polygon -7500403 true true 296 193 296 150 259 134 244 104 208 104 207 194 +Rectangle -1 true false 195 60 195 105 +Polygon -16777216 true false 238 112 252 141 219 141 218 112 +Circle -16777216 true false 234 174 42 +Rectangle -7500403 true true 181 185 214 194 +Circle -16777216 true false 144 174 42 +Circle -16777216 true false 24 174 42 +Circle -7500403 false true 24 174 42 +Circle -7500403 false true 144 174 42 +Circle -7500403 false true 234 174 42 + +turtle +true +0 +Polygon -10899396 true false 215 204 240 233 246 254 228 266 215 252 193 210 +Polygon -10899396 true false 195 90 225 75 245 75 260 89 269 108 261 124 240 105 225 105 210 105 +Polygon -10899396 true false 105 90 75 75 55 75 40 89 31 108 39 124 60 105 75 105 90 105 +Polygon -10899396 true false 132 85 134 64 107 51 108 17 150 2 192 18 192 52 169 65 172 87 +Polygon -10899396 true false 85 204 60 233 54 254 72 266 85 252 107 210 +Polygon -7500403 true true 119 75 179 75 209 101 224 135 220 225 175 261 128 261 81 224 74 135 88 99 + +wheel +false +0 +Circle -7500403 true true 3 3 294 +Circle -16777216 true false 30 30 240 +Line -7500403 true 150 285 150 15 +Line -7500403 true 15 150 285 150 +Circle -7500403 true true 120 120 60 +Line -7500403 true 216 40 79 269 +Line -7500403 true 40 84 269 221 +Line -7500403 true 40 216 269 79 +Line -7500403 true 84 40 221 269 + +x +false +0 +Polygon -7500403 true true 270 75 225 30 30 225 75 270 +Polygon -7500403 true true 30 75 75 30 270 225 225 270 + +@#$#@#$#@ +NetLogo 5.0.5 +@#$#@#$#@ +setup +while [any? turtles] [ go ] +@#$#@#$#@ +@#$#@#$#@ +@#$#@#$#@ +@#$#@#$#@ +default +0.0 +-0.2 0 0.0 1.0 +0.0 1 1.0 0.0 +0.2 0 0.0 1.0 +link direction +true +0 +Line -7500403 true 150 150 90 180 +Line -7500403 true 150 150 210 180 + +@#$#@#$#@ +0 +@#$#@#$#@ diff --git a/samples/NetLogo/readme.md b/samples/NetLogo/readme.md new file mode 100644 index 00000000..749c3e04 --- /dev/null +++ b/samples/NetLogo/readme.md @@ -0,0 +1,439 @@ +#NetLogo + +Examples taken from @NetLogo/models. + +NetLogo is a programing language originating from LISP. +View source here: https://github.com/NetLogo/NetLogo + +View models here: https://github.com/NetLogo/models + +##License +####Models +The models in this repository are provided under a variety of licenses. + +Some models are public domain, some models are open source, some models are CC BY-NC-SA (free for noncommercial distribution and use). + +See legal.txt for details. + +####NetLogo +NetLogo +Copyright (C) 1999-2013 Uri Wilensky + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301, USA. + +== + +Commercial licenses are also available. To inquire about commercial +licenses, please contact Uri Wilensky at uri@northwestern.edu . + +=== + +NetLogo User Manual +Copyright (C) 1999-2013 Uri Wilensky + +This work is licensed under the Creative Commons +Attribution-ShareAlike 3.0 Unported License. To view a copy of this +license, visit http://creativecommons.org/licenses/by-sa/3.0/ or send +a letter to Creative Commons, 444 Castro Street, Suite 900, Mountain +View, California, 94041, USA. + +=== + +Much of NetLogo is written in the Scala language and uses the +Scala standard libraries. The license for Scala is as follows: + +Copyright (c) 2002-2013 EPFL, Lausanne, unless otherwise specified. +All rights reserved. + +This software was developed by the Programming Methods Laboratory of the +Swiss Federal Institute of Technology (EPFL), Lausanne, Switzerland. + +Permission to use, copy, modify, and distribute this software in source +or binary form for any purpose with or without fee is hereby granted, +provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + 3. Neither the name of the EPFL nor the names of its contributors + may be used to endorse or promote products derived from this + software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +SUCH DAMAGE. + +=== + +For random number generation, NetLogo uses the MersenneTwisterFast class +by Sean Luke. The copyright for that code is as follows: + +Copyright (c) 2003 by Sean Luke. +Portions copyright (c) 1993 by Michael Lecuyer +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: +- Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +- Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +- Neither the name of the copyright owners, their employers, nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written + permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=== + +Parts of this software (specifically, the random-gamma primitive) are +based on code from the Colt library +(http://acs.lbl.gov/~hoschek/colt/). The copyright for +that code is as follows: + +Copyright 1999 CERN - European Organization for Nuclear Research. +Permission to use, copy, modify, distribute and sell this software and +its documentation for any purpose is hereby granted without fee, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation. CERN makes no representations about the +suitability of this software for any purpose. It is provided "as is" +without expressed or implied warranty. + +=== + +This software uses the MRJ Adapter library, which is Copyright (c) +2003-2005 Steve Roy . The library is covered by +the Artistic License. MRJ Adapter is available from +https://mrjadapter.dev.java.net/ . + +=== + +This software uses the Quaqua Look and Feel library, which is +Copyright (c) 2003-2005 Werner Randelshofer, +http://www.randelshofer.ch/, werner.randelshofer@bluewin.ch, All +Rights Reserved. The library is covered by the GNU LGPL (Lesser +General Public License). This license is available online from +http://www.gnu.org/copyleft/lesser.html and is also included with +every download of NetLogo (in the "docs" folder). + +=== + +For the system dynamics modeler, NetLogo uses the JHotDraw library, +which is Copyright (c) 1996, 1997 by IFA Informatik and Erich Gamma. +The library is covered by the GNU LGPL (Lesser General Public +License). The text of that license is included in the "docs" folder +which accompanies the NetLogo download, and is also available from +http://www.gnu.org/copyleft/lesser.html . + +=== + +For movie-making, NetLogo uses code adapted from +sim.util.media.MovieEncoder.java by Sean Luke, distributed under the +MASON Open Source License. The copyright for that code is as follows: + +This software is Copyright 2003 by Sean Luke. Portions Copyright 2003 +by Gabriel Catalin Balan, Liviu Panait, Sean Paus, and Dan Kuebrich. +All Rights Reserved + +Developed in Conjunction with the George Mason University Center for +Social Complexity + +By using the source code, binary code files, or related data included +in this distribution, you agree to the following terms of usage for +this software distribution. All but a few source code files in this +distribution fall under this license; the exceptions contain open +source licenses embedded in the source code files themselves. In this +license the Authors means the Copyright Holders listed above, and the +license itself is Copyright 2003 by Sean Luke. + +The Authors hereby grant you a world-wide, royalty-free, non-exclusive +license, subject to third party intellectual property claims: + +to use, reproduce, modify, display, perform, sublicense and distribute +all or any portion of the source code or binary form of this software +or related data with or without modifications, or as part of a larger +work; and under patents now or hereafter owned or controlled by the +Authors, to make, have made, use and sell ("Utilize") all or any +portion of the source code or binary form of this software or related +data, but solely to the extent that any such patent is reasonably +necessary to enable you to Utilize all or any portion of the source +code or binary form of this software or related data, and not to any +greater extent that may be necessary to Utilize further modifications +or combinations. + +In return you agree to the following conditions: + +If you redistribute all or any portion of the source code of this +software or related data, it must retain the above copyright notice +and this license and disclaimer. If you redistribute all or any +portion of this code in binary form, you must include the above +copyright notice and this license and disclaimer in the documentation +and/or other materials provided with the distribution, and must +indicate the use of this software in a prominent, publically +accessible location of the larger work. You must not use the Authors's +names to endorse or promote products derived from this software +without the specific prior written permission of the Authors. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS, NOR THEIR +EMPLOYERS, NOR GEORGE MASON UNIVERSITY, BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR +THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +=== + +For movie-making, NetLogo uses code adapted from +JpegImagesToMovie.java by Sun Microsystems. The copyright for that +code is as follows: + +Copyright (c) 1999-2001 Sun Microsystems, Inc. All Rights Reserved. + +Sun grants you ("Licensee") a non-exclusive, royalty free, license to +use, modify and redistribute this software in source and binary code +form, provided that i) this copyright notice and license appear on all +copies of the software; and ii) Licensee does not utilize the software +in a manner which is disparaging to Sun. + +This software is provided "AS IS," without a warranty of any kind. ALL +EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, +INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN AND +ITS LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE +AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THE SOFTWARE OR ITS +DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY +LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, +CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND +REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF OR +INABILITY TO USE SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + +This software is not designed or intended for use in on-line control +of aircraft, air traffic, aircraft navigation or aircraft +communications; or in the design, construction, operation or +maintenance of any nuclear facility. Licensee represents and warrants +that it will not use or redistribute the Software for such purposes. + +=== + +For 3D graphics rendering, NetLogo uses JOGL, a Java API for OpenGL. +For more information about JOGL, see http://jogl.dev.java.net/. +The library is distributed under the BSD license: + +Copyright (c) 2003-2006 Sun Microsystems, Inc. All Rights Reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + +- Redistribution of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +- Redistribution in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +Neither the name of Sun Microsystems, Inc. or the names of +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +This software is provided "AS IS," without a warranty of any kind. ALL +EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, +INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN +MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR +ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR +DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR +ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR +DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE +DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, +ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF +SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +You acknowledge that this software is not designed or intended for use +in the design, construction, operation or maintenance of any nuclear +facility. + +=== + +For 3D matrix operations, NetLogo uses the Matrix3D class. It is +distributed under the following license: + +Copyright (c) 1994-1996 Sun Microsystems, Inc. All Rights Reserved. + +Sun grants you ("Licensee") a non-exclusive, royalty free, license to use, +modify and redistribute this software in source and binary code form, +provided that i) this copyright notice and license appear on all copies of +the software; and ii) Licensee does not utilize the software in a manner +which is disparaging to Sun. + +This software is provided "AS IS," without a warranty of any kind. ALL +EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY +IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR +NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN AND ITS LICENSORS SHALL NOT BE +LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING +OR DISTRIBUTING THE SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR ITS +LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT, +INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER +CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF +OR INABILITY TO USE SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + +This software is not designed or intended for use in on-line control of +aircraft, air traffic, aircraft navigation or aircraft communications; or in +the design, construction, operation or maintenance of any nuclear +facility. Licensee represents and warrants that it will not use or +redistribute the Software for such purposes. + +=== + +For JVM bytecode generation, NetLogo uses the ASM library. It is +distributed under the following license: + +Copyright (c) 2000-2010 INRIA, France Telecom +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +3. Neither the name of the copyright holders nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF +THE POSSIBILITY OF SUCH DAMAGE. + +=== + +For logging, NetLogo uses the Log4j library. The copyright and license +for the library are as follows: + +Copyright 2007 The Apache Software Foundation + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +=== + +For dependency injection, NetLogo uses the PicoContainer library. The +copyright and license for the library are as follows: + +Copyright (c) 2003-2006, PicoContainer Organization +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + Neither the name of the PicoContainer Organization nor the names of its + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + +=== + +For the Info tab, NetLogo uses the Pegdown and Parboiled libraries. + +The copyright and license for Pegdown are as follows: + +pegdown - Copyright (C) 2010-2011 Mathias Doenitz + +Based on peg-markdown - markdown in c, implemented using PEG grammar +Copyright (c) 2008 John MacFarlane (http://github.com/jgm/peg-markdown) + +pegdown is released under the Apache License 2.0. +(http://www.apache.org/licenses/LICENSE-2.0) + +The copyright and license for Parboiled are as follows: + +parboiled - Copyright (C) 2009-2011 Mathias Doenitz + +This product includes software developed by +Mathias Doenitz (http://www.parboiled.org/). + +pegdown is released under the Apache License 2.0. +(http://www.apache.org/licenses/LICENSE-2.0) \ No newline at end of file From 240f6a63f44f4d6565157494170c6987300f0903 Mon Sep 17 00:00:00 2001 From: Andrew Fischer Date: Sat, 9 Nov 2013 12:44:09 -0500 Subject: [PATCH 14/24] removed error causing readme... oops. --- samples/NetLogo/readme.md | 439 -------------------------------------- 1 file changed, 439 deletions(-) delete mode 100644 samples/NetLogo/readme.md diff --git a/samples/NetLogo/readme.md b/samples/NetLogo/readme.md deleted file mode 100644 index 749c3e04..00000000 --- a/samples/NetLogo/readme.md +++ /dev/null @@ -1,439 +0,0 @@ -#NetLogo - -Examples taken from @NetLogo/models. - -NetLogo is a programing language originating from LISP. -View source here: https://github.com/NetLogo/NetLogo - -View models here: https://github.com/NetLogo/models - -##License -####Models -The models in this repository are provided under a variety of licenses. - -Some models are public domain, some models are open source, some models are CC BY-NC-SA (free for noncommercial distribution and use). - -See legal.txt for details. - -####NetLogo -NetLogo -Copyright (C) 1999-2013 Uri Wilensky - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301, USA. - -== - -Commercial licenses are also available. To inquire about commercial -licenses, please contact Uri Wilensky at uri@northwestern.edu . - -=== - -NetLogo User Manual -Copyright (C) 1999-2013 Uri Wilensky - -This work is licensed under the Creative Commons -Attribution-ShareAlike 3.0 Unported License. To view a copy of this -license, visit http://creativecommons.org/licenses/by-sa/3.0/ or send -a letter to Creative Commons, 444 Castro Street, Suite 900, Mountain -View, California, 94041, USA. - -=== - -Much of NetLogo is written in the Scala language and uses the -Scala standard libraries. The license for Scala is as follows: - -Copyright (c) 2002-2013 EPFL, Lausanne, unless otherwise specified. -All rights reserved. - -This software was developed by the Programming Methods Laboratory of the -Swiss Federal Institute of Technology (EPFL), Lausanne, Switzerland. - -Permission to use, copy, modify, and distribute this software in source -or binary form for any purpose with or without fee is hereby granted, -provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - 3. Neither the name of the EPFL nor the names of its contributors - may be used to endorse or promote products derived from this - software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -SUCH DAMAGE. - -=== - -For random number generation, NetLogo uses the MersenneTwisterFast class -by Sean Luke. The copyright for that code is as follows: - -Copyright (c) 2003 by Sean Luke. -Portions copyright (c) 1993 by Michael Lecuyer -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: -- Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. -- Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. -- Neither the name of the copyright owners, their employers, nor the - names of its contributors may be used to endorse or promote products - derived from this software without specific prior written - permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=== - -Parts of this software (specifically, the random-gamma primitive) are -based on code from the Colt library -(http://acs.lbl.gov/~hoschek/colt/). The copyright for -that code is as follows: - -Copyright 1999 CERN - European Organization for Nuclear Research. -Permission to use, copy, modify, distribute and sell this software and -its documentation for any purpose is hereby granted without fee, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation. CERN makes no representations about the -suitability of this software for any purpose. It is provided "as is" -without expressed or implied warranty. - -=== - -This software uses the MRJ Adapter library, which is Copyright (c) -2003-2005 Steve Roy . The library is covered by -the Artistic License. MRJ Adapter is available from -https://mrjadapter.dev.java.net/ . - -=== - -This software uses the Quaqua Look and Feel library, which is -Copyright (c) 2003-2005 Werner Randelshofer, -http://www.randelshofer.ch/, werner.randelshofer@bluewin.ch, All -Rights Reserved. The library is covered by the GNU LGPL (Lesser -General Public License). This license is available online from -http://www.gnu.org/copyleft/lesser.html and is also included with -every download of NetLogo (in the "docs" folder). - -=== - -For the system dynamics modeler, NetLogo uses the JHotDraw library, -which is Copyright (c) 1996, 1997 by IFA Informatik and Erich Gamma. -The library is covered by the GNU LGPL (Lesser General Public -License). The text of that license is included in the "docs" folder -which accompanies the NetLogo download, and is also available from -http://www.gnu.org/copyleft/lesser.html . - -=== - -For movie-making, NetLogo uses code adapted from -sim.util.media.MovieEncoder.java by Sean Luke, distributed under the -MASON Open Source License. The copyright for that code is as follows: - -This software is Copyright 2003 by Sean Luke. Portions Copyright 2003 -by Gabriel Catalin Balan, Liviu Panait, Sean Paus, and Dan Kuebrich. -All Rights Reserved - -Developed in Conjunction with the George Mason University Center for -Social Complexity - -By using the source code, binary code files, or related data included -in this distribution, you agree to the following terms of usage for -this software distribution. All but a few source code files in this -distribution fall under this license; the exceptions contain open -source licenses embedded in the source code files themselves. In this -license the Authors means the Copyright Holders listed above, and the -license itself is Copyright 2003 by Sean Luke. - -The Authors hereby grant you a world-wide, royalty-free, non-exclusive -license, subject to third party intellectual property claims: - -to use, reproduce, modify, display, perform, sublicense and distribute -all or any portion of the source code or binary form of this software -or related data with or without modifications, or as part of a larger -work; and under patents now or hereafter owned or controlled by the -Authors, to make, have made, use and sell ("Utilize") all or any -portion of the source code or binary form of this software or related -data, but solely to the extent that any such patent is reasonably -necessary to enable you to Utilize all or any portion of the source -code or binary form of this software or related data, and not to any -greater extent that may be necessary to Utilize further modifications -or combinations. - -In return you agree to the following conditions: - -If you redistribute all or any portion of the source code of this -software or related data, it must retain the above copyright notice -and this license and disclaimer. If you redistribute all or any -portion of this code in binary form, you must include the above -copyright notice and this license and disclaimer in the documentation -and/or other materials provided with the distribution, and must -indicate the use of this software in a prominent, publically -accessible location of the larger work. You must not use the Authors's -names to endorse or promote products derived from this software -without the specific prior written permission of the Authors. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS, NOR THEIR -EMPLOYERS, NOR GEORGE MASON UNIVERSITY, BE LIABLE FOR ANY CLAIM, -DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR -THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -=== - -For movie-making, NetLogo uses code adapted from -JpegImagesToMovie.java by Sun Microsystems. The copyright for that -code is as follows: - -Copyright (c) 1999-2001 Sun Microsystems, Inc. All Rights Reserved. - -Sun grants you ("Licensee") a non-exclusive, royalty free, license to -use, modify and redistribute this software in source and binary code -form, provided that i) this copyright notice and license appear on all -copies of the software; and ii) Licensee does not utilize the software -in a manner which is disparaging to Sun. - -This software is provided "AS IS," without a warranty of any kind. ALL -EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, -INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A -PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN AND -ITS LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE -AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THE SOFTWARE OR ITS -DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY -LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, -CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND -REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF OR -INABILITY TO USE SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - -This software is not designed or intended for use in on-line control -of aircraft, air traffic, aircraft navigation or aircraft -communications; or in the design, construction, operation or -maintenance of any nuclear facility. Licensee represents and warrants -that it will not use or redistribute the Software for such purposes. - -=== - -For 3D graphics rendering, NetLogo uses JOGL, a Java API for OpenGL. -For more information about JOGL, see http://jogl.dev.java.net/. -The library is distributed under the BSD license: - -Copyright (c) 2003-2006 Sun Microsystems, Inc. All Rights Reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -- Redistribution of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - -- Redistribution in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - -Neither the name of Sun Microsystems, Inc. or the names of -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -This software is provided "AS IS," without a warranty of any kind. ALL -EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, -INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A -PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN -MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR -ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR -DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR -ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR -DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE -DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, -ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF -SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -You acknowledge that this software is not designed or intended for use -in the design, construction, operation or maintenance of any nuclear -facility. - -=== - -For 3D matrix operations, NetLogo uses the Matrix3D class. It is -distributed under the following license: - -Copyright (c) 1994-1996 Sun Microsystems, Inc. All Rights Reserved. - -Sun grants you ("Licensee") a non-exclusive, royalty free, license to use, -modify and redistribute this software in source and binary code form, -provided that i) this copyright notice and license appear on all copies of -the software; and ii) Licensee does not utilize the software in a manner -which is disparaging to Sun. - -This software is provided "AS IS," without a warranty of any kind. ALL -EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY -IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR -NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN AND ITS LICENSORS SHALL NOT BE -LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING -OR DISTRIBUTING THE SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR ITS -LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT, -INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER -CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF -OR INABILITY TO USE SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - -This software is not designed or intended for use in on-line control of -aircraft, air traffic, aircraft navigation or aircraft communications; or in -the design, construction, operation or maintenance of any nuclear -facility. Licensee represents and warrants that it will not use or -redistribute the Software for such purposes. - -=== - -For JVM bytecode generation, NetLogo uses the ASM library. It is -distributed under the following license: - -Copyright (c) 2000-2010 INRIA, France Telecom -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - -3. Neither the name of the copyright holders nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF -THE POSSIBILITY OF SUCH DAMAGE. - -=== - -For logging, NetLogo uses the Log4j library. The copyright and license -for the library are as follows: - -Copyright 2007 The Apache Software Foundation - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. - -=== - -For dependency injection, NetLogo uses the PicoContainer library. The -copyright and license for the library are as follows: - -Copyright (c) 2003-2006, PicoContainer Organization -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - Neither the name of the PicoContainer Organization nor the names of its - contributors may be used to endorse or promote products derived from this - software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -=== - -For the Info tab, NetLogo uses the Pegdown and Parboiled libraries. - -The copyright and license for Pegdown are as follows: - -pegdown - Copyright (C) 2010-2011 Mathias Doenitz - -Based on peg-markdown - markdown in c, implemented using PEG grammar -Copyright (c) 2008 John MacFarlane (http://github.com/jgm/peg-markdown) - -pegdown is released under the Apache License 2.0. -(http://www.apache.org/licenses/LICENSE-2.0) - -The copyright and license for Parboiled are as follows: - -parboiled - Copyright (C) 2009-2011 Mathias Doenitz - -This product includes software developed by -Mathias Doenitz (http://www.parboiled.org/). - -pegdown is released under the Apache License 2.0. -(http://www.apache.org/licenses/LICENSE-2.0) \ No newline at end of file From 12f01e9e946194796d04e654cefa559a31c035de Mon Sep 17 00:00:00 2001 From: Ted Nyman Date: Sat, 9 Nov 2013 16:39:55 -0800 Subject: [PATCH 15/24] Color for dart --- lib/linguist/languages.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/linguist/languages.yml b/lib/linguist/languages.yml index 16780097..1c6c4353 100644 --- a/lib/linguist/languages.yml +++ b/lib/linguist/languages.yml @@ -392,6 +392,7 @@ Darcs Patch: Dart: type: programming + color: "#98BAD6" primary_extension: .dart DCPU-16 ASM: From 43723ba5eff3b10ae718f1cbdea5f0fd7c318eb5 Mon Sep 17 00:00:00 2001 From: Ted Nyman Date: Sat, 9 Nov 2013 16:43:45 -0800 Subject: [PATCH 16/24] Simpler samples --- samples/NetLogo/Ants.nlogo | 614 ----------------------------- samples/NetLogo/Life.nlogo | 573 --------------------------- samples/NetLogo/Star Fractal.nlogo | 501 ----------------------- 3 files changed, 1688 deletions(-) delete mode 100644 samples/NetLogo/Ants.nlogo delete mode 100644 samples/NetLogo/Star Fractal.nlogo diff --git a/samples/NetLogo/Ants.nlogo b/samples/NetLogo/Ants.nlogo deleted file mode 100644 index 9379c690..00000000 --- a/samples/NetLogo/Ants.nlogo +++ /dev/null @@ -1,614 +0,0 @@ -patches-own [ - chemical ;; amount of chemical on this patch - food ;; amount of food on this patch (0, 1, or 2) - nest? ;; true on nest patches, false elsewhere - nest-scent ;; number that is higher closer to the nest - food-source-number ;; number (1, 2, or 3) to identify the food sources -] - -;;;;;;;;;;;;;;;;;;;;;;;; -;;; Setup procedures ;;; -;;;;;;;;;;;;;;;;;;;;;;;; - -to setup - clear-all - set-default-shape turtles "bug" - crt population - [ set size 2 ;; easier to see - set color red ] ;; red = not carrying food - setup-patches - reset-ticks -end - -to setup-patches - ask patches - [ setup-nest - setup-food - recolor-patch ] -end - -to setup-nest ;; patch procedure - ;; set nest? variable to true inside the nest, false elsewhere - set nest? (distancexy 0 0) < 5 - ;; spread a nest-scent over the whole world -- stronger near the nest - set nest-scent 200 - distancexy 0 0 -end - -to setup-food ;; patch procedure - ;; setup food source one on the right - if (distancexy (0.6 * max-pxcor) 0) < 5 - [ set food-source-number 1 ] - ;; setup food source two on the lower-left - if (distancexy (-0.6 * max-pxcor) (-0.6 * max-pycor)) < 5 - [ set food-source-number 2 ] - ;; setup food source three on the upper-left - if (distancexy (-0.8 * max-pxcor) (0.8 * max-pycor)) < 5 - [ set food-source-number 3 ] - ;; set "food" at sources to either 1 or 2, randomly - if food-source-number > 0 - [ set food one-of [1 2] ] -end - -to recolor-patch ;; patch procedure - ;; give color to nest and food sources - ifelse nest? - [ set pcolor violet ] - [ ifelse food > 0 - [ if food-source-number = 1 [ set pcolor cyan ] - if food-source-number = 2 [ set pcolor sky ] - if food-source-number = 3 [ set pcolor blue ] ] - ;; scale color to show chemical concentration - [ set pcolor scale-color green chemical 0.1 5 ] ] -end - -;;;;;;;;;;;;;;;;;;;;; -;;; Go procedures ;;; -;;;;;;;;;;;;;;;;;;;;; - -to go ;; forever button - ask turtles - [ if who >= ticks [ stop ] ;; delay initial departure - ifelse color = red - [ look-for-food ] ;; not carrying food? look for it - [ return-to-nest ] ;; carrying food? take it back to nest - wiggle - fd 1 ] - diffuse chemical (diffusion-rate / 100) - ask patches - [ set chemical chemical * (100 - evaporation-rate) / 100 ;; slowly evaporate chemical - recolor-patch ] - tick -end - -to return-to-nest ;; turtle procedure - ifelse nest? - [ ;; drop food and head out again - set color red - rt 180 ] - [ set chemical chemical + 60 ;; drop some chemical - uphill-nest-scent ] ;; head toward the greatest value of nest-scent -end - -to look-for-food ;; turtle procedure - if food > 0 - [ set color orange + 1 ;; pick up food - set food food - 1 ;; and reduce the food source - rt 180 ;; and turn around - stop ] - ;; go in the direction where the chemical smell is strongest - if (chemical >= 0.05) and (chemical < 2) - [ uphill-chemical ] -end - -;; sniff left and right, and go where the strongest smell is -to uphill-chemical ;; turtle procedure - let scent-ahead chemical-scent-at-angle 0 - let scent-right chemical-scent-at-angle 45 - let scent-left chemical-scent-at-angle -45 - if (scent-right > scent-ahead) or (scent-left > scent-ahead) - [ ifelse scent-right > scent-left - [ rt 45 ] - [ lt 45 ] ] -end - -;; sniff left and right, and go where the strongest smell is -to uphill-nest-scent ;; turtle procedure - let scent-ahead nest-scent-at-angle 0 - let scent-right nest-scent-at-angle 45 - let scent-left nest-scent-at-angle -45 - if (scent-right > scent-ahead) or (scent-left > scent-ahead) - [ ifelse scent-right > scent-left - [ rt 45 ] - [ lt 45 ] ] -end - -to wiggle ;; turtle procedure - rt random 40 - lt random 40 - if not can-move? 1 [ rt 180 ] -end - -to-report nest-scent-at-angle [angle] - let p patch-right-and-ahead angle 1 - if p = nobody [ report 0 ] - report [nest-scent] of p -end - -to-report chemical-scent-at-angle [angle] - let p patch-right-and-ahead angle 1 - if p = nobody [ report 0 ] - report [chemical] of p -end -@#$#@#$#@ -GRAPHICS-WINDOW -257 -10 -764 -538 -35 -35 -7.0 -1 -10 -1 -1 -1 -0 -0 -0 -1 --35 -35 --35 -35 -1 -1 -1 -ticks -30.0 - -BUTTON -46 -71 -126 -104 -NIL -setup -NIL -1 -T -OBSERVER -NIL -NIL -NIL -NIL -1 - -SLIDER -31 -106 -221 -139 -diffusion-rate -diffusion-rate -0.0 -99.0 -50 -1.0 -1 -NIL -HORIZONTAL - -SLIDER -31 -141 -221 -174 -evaporation-rate -evaporation-rate -0.0 -99.0 -10 -1.0 -1 -NIL -HORIZONTAL - -BUTTON -136 -71 -211 -104 -NIL -go -T -1 -T -OBSERVER -NIL -NIL -NIL -NIL -1 - -SLIDER -31 -36 -221 -69 -population -population -0.0 -200.0 -125 -1.0 -1 -NIL -HORIZONTAL - -PLOT -5 -197 -248 -476 -Food in each pile -time -food -0.0 -50.0 -0.0 -120.0 -true -false -"" "" -PENS -"food-in-pile1" 1.0 0 -11221820 true "" "plotxy ticks sum [food] of patches with [pcolor = cyan]" -"food-in-pile2" 1.0 0 -13791810 true "" "plotxy ticks sum [food] of patches with [pcolor = sky]" -"food-in-pile3" 1.0 0 -13345367 true "" "plotxy ticks sum [food] of patches with [pcolor = blue]" - -@#$#@#$#@ -## WHAT IS IT? - -In this project, a colony of ants forages for food. Though each ant follows a set of simple rules, the colony as a whole acts in a sophisticated way. - -## HOW IT WORKS - -When an ant finds a piece of food, it carries the food back to the nest, dropping a chemical as it moves. When other ants "sniff" the chemical, they follow the chemical toward the food. As more ants carry food to the nest, they reinforce the chemical trail. - -## HOW TO USE IT - -Click the SETUP button to set up the ant nest (in violet, at center) and three piles of food. Click the GO button to start the simulation. The chemical is shown in a green-to-white gradient. - -The EVAPORATION-RATE slider controls the evaporation rate of the chemical. The DIFFUSION-RATE slider controls the diffusion rate of the chemical. - -If you want to change the number of ants, move the POPULATION slider before pressing SETUP. - -## THINGS TO NOTICE - -The ant colony generally exploits the food source in order, starting with the food closest to the nest, and finishing with the food most distant from the nest. It is more difficult for the ants to form a stable trail to the more distant food, since the chemical trail has more time to evaporate and diffuse before being reinforced. - -Once the colony finishes collecting the closest food, the chemical trail to that food naturally disappears, freeing up ants to help collect the other food sources. The more distant food sources require a larger "critical number" of ants to form a stable trail. - -The consumption of the food is shown in a plot. The line colors in the plot match the colors of the food piles. - -## EXTENDING THE MODEL - -Try different placements for the food sources. What happens if two food sources are equidistant from the nest? When that happens in the real world, ant colonies typically exploit one source then the other (not at the same time). - -In this project, the ants use a "trick" to find their way back to the nest: they follow the "nest scent." Real ants use a variety of different approaches to find their way back to the nest. Try to implement some alternative strategies. - -The ants only respond to chemical levels between 0.05 and 2. The lower limit is used so the ants aren't infinitely sensitive. Try removing the upper limit. What happens? Why? - -In the `uphill-chemical` procedure, the ant "follows the gradient" of the chemical. That is, it "sniffs" in three directions, then turns in the direction where the chemical is strongest. You might want to try variants of the `uphill-chemical` procedure, changing the number and placement of "ant sniffs." - -## NETLOGO FEATURES - -The built-in `diffuse` primitive lets us diffuse the chemical easily without complicated code. - -The primitive `patch-right-and-ahead` is used to make the ants smell in different directions without actually turning. - -## CREDITS AND REFERENCES -@#$#@#$#@ -default -true -0 -Polygon -7500403 true true 150 5 40 250 150 205 260 250 - -airplane -true -0 -Polygon -7500403 true true 150 0 135 15 120 60 120 105 15 165 15 195 120 180 135 240 105 270 120 285 150 270 180 285 210 270 165 240 180 180 285 195 285 165 180 105 180 60 165 15 - -arrow -true -0 -Polygon -7500403 true true 150 0 0 150 105 150 105 293 195 293 195 150 300 150 - -box -false -0 -Polygon -7500403 true true 150 285 285 225 285 75 150 135 -Polygon -7500403 true true 150 135 15 75 150 15 285 75 -Polygon -7500403 true true 15 75 15 225 150 285 150 135 -Line -16777216 false 150 285 150 135 -Line -16777216 false 150 135 15 75 -Line -16777216 false 150 135 285 75 - -bug -true -0 -Circle -7500403 true true 96 182 108 -Circle -7500403 true true 110 127 80 -Circle -7500403 true true 110 75 80 -Line -7500403 true 150 100 80 30 -Line -7500403 true 150 100 220 30 - -butterfly -true -0 -Polygon -7500403 true true 150 165 209 199 225 225 225 255 195 270 165 255 150 240 -Polygon -7500403 true true 150 165 89 198 75 225 75 255 105 270 135 255 150 240 -Polygon -7500403 true true 139 148 100 105 55 90 25 90 10 105 10 135 25 180 40 195 85 194 139 163 -Polygon -7500403 true true 162 150 200 105 245 90 275 90 290 105 290 135 275 180 260 195 215 195 162 165 -Polygon -16777216 true false 150 255 135 225 120 150 135 120 150 105 165 120 180 150 165 225 -Circle -16777216 true false 135 90 30 -Line -16777216 false 150 105 195 60 -Line -16777216 false 150 105 105 60 - -car -false -0 -Polygon -7500403 true true 300 180 279 164 261 144 240 135 226 132 213 106 203 84 185 63 159 50 135 50 75 60 0 150 0 165 0 225 300 225 300 180 -Circle -16777216 true false 180 180 90 -Circle -16777216 true false 30 180 90 -Polygon -16777216 true false 162 80 132 78 134 135 209 135 194 105 189 96 180 89 -Circle -7500403 true true 47 195 58 -Circle -7500403 true true 195 195 58 - -circle -false -0 -Circle -7500403 true true 0 0 300 - -circle 2 -false -0 -Circle -7500403 true true 0 0 300 -Circle -16777216 true false 30 30 240 - -cow -false -0 -Polygon -7500403 true true 200 193 197 249 179 249 177 196 166 187 140 189 93 191 78 179 72 211 49 209 48 181 37 149 25 120 25 89 45 72 103 84 179 75 198 76 252 64 272 81 293 103 285 121 255 121 242 118 224 167 -Polygon -7500403 true true 73 210 86 251 62 249 48 208 -Polygon -7500403 true true 25 114 16 195 9 204 23 213 25 200 39 123 - -cylinder -false -0 -Circle -7500403 true true 0 0 300 - -dot -false -0 -Circle -7500403 true true 90 90 120 - -face happy -false -0 -Circle -7500403 true true 8 8 285 -Circle -16777216 true false 60 75 60 -Circle -16777216 true false 180 75 60 -Polygon -16777216 true false 150 255 90 239 62 213 47 191 67 179 90 203 109 218 150 225 192 218 210 203 227 181 251 194 236 217 212 240 - -face neutral -false -0 -Circle -7500403 true true 8 7 285 -Circle -16777216 true false 60 75 60 -Circle -16777216 true false 180 75 60 -Rectangle -16777216 true false 60 195 240 225 - -face sad -false -0 -Circle -7500403 true true 8 8 285 -Circle -16777216 true false 60 75 60 -Circle -16777216 true false 180 75 60 -Polygon -16777216 true false 150 168 90 184 62 210 47 232 67 244 90 220 109 205 150 198 192 205 210 220 227 242 251 229 236 206 212 183 - -fish -false -0 -Polygon -1 true false 44 131 21 87 15 86 0 120 15 150 0 180 13 214 20 212 45 166 -Polygon -1 true false 135 195 119 235 95 218 76 210 46 204 60 165 -Polygon -1 true false 75 45 83 77 71 103 86 114 166 78 135 60 -Polygon -7500403 true true 30 136 151 77 226 81 280 119 292 146 292 160 287 170 270 195 195 210 151 212 30 166 -Circle -16777216 true false 215 106 30 - -flag -false -0 -Rectangle -7500403 true true 60 15 75 300 -Polygon -7500403 true true 90 150 270 90 90 30 -Line -7500403 true 75 135 90 135 -Line -7500403 true 75 45 90 45 - -flower -false -0 -Polygon -10899396 true false 135 120 165 165 180 210 180 240 150 300 165 300 195 240 195 195 165 135 -Circle -7500403 true true 85 132 38 -Circle -7500403 true true 130 147 38 -Circle -7500403 true true 192 85 38 -Circle -7500403 true true 85 40 38 -Circle -7500403 true true 177 40 38 -Circle -7500403 true true 177 132 38 -Circle -7500403 true true 70 85 38 -Circle -7500403 true true 130 25 38 -Circle -7500403 true true 96 51 108 -Circle -16777216 true false 113 68 74 -Polygon -10899396 true false 189 233 219 188 249 173 279 188 234 218 -Polygon -10899396 true false 180 255 150 210 105 210 75 240 135 240 - -house -false -0 -Rectangle -7500403 true true 45 120 255 285 -Rectangle -16777216 true false 120 210 180 285 -Polygon -7500403 true true 15 120 150 15 285 120 -Line -16777216 false 30 120 270 120 - -leaf -false -0 -Polygon -7500403 true true 150 210 135 195 120 210 60 210 30 195 60 180 60 165 15 135 30 120 15 105 40 104 45 90 60 90 90 105 105 120 120 120 105 60 120 60 135 30 150 15 165 30 180 60 195 60 180 120 195 120 210 105 240 90 255 90 263 104 285 105 270 120 285 135 240 165 240 180 270 195 240 210 180 210 165 195 -Polygon -7500403 true true 135 195 135 240 120 255 105 255 105 285 135 285 165 240 165 195 - -line -true -0 -Line -7500403 true 150 0 150 300 - -line half -true -0 -Line -7500403 true 150 0 150 150 - -pentagon -false -0 -Polygon -7500403 true true 150 15 15 120 60 285 240 285 285 120 - -person -false -0 -Circle -7500403 true true 110 5 80 -Polygon -7500403 true true 105 90 120 195 90 285 105 300 135 300 150 225 165 300 195 300 210 285 180 195 195 90 -Rectangle -7500403 true true 127 79 172 94 -Polygon -7500403 true true 195 90 240 150 225 180 165 105 -Polygon -7500403 true true 105 90 60 150 75 180 135 105 - -plant -false -0 -Rectangle -7500403 true true 135 90 165 300 -Polygon -7500403 true true 135 255 90 210 45 195 75 255 135 285 -Polygon -7500403 true true 165 255 210 210 255 195 225 255 165 285 -Polygon -7500403 true true 135 180 90 135 45 120 75 180 135 210 -Polygon -7500403 true true 165 180 165 210 225 180 255 120 210 135 -Polygon -7500403 true true 135 105 90 60 45 45 75 105 135 135 -Polygon -7500403 true true 165 105 165 135 225 105 255 45 210 60 -Polygon -7500403 true true 135 90 120 45 150 15 180 45 165 90 - -square -false -0 -Rectangle -7500403 true true 30 30 270 270 - -square 2 -false -0 -Rectangle -7500403 true true 30 30 270 270 -Rectangle -16777216 true false 60 60 240 240 - -star -false -0 -Polygon -7500403 true true 151 1 185 108 298 108 207 175 242 282 151 216 59 282 94 175 3 108 116 108 - -target -false -0 -Circle -7500403 true true 0 0 300 -Circle -16777216 true false 30 30 240 -Circle -7500403 true true 60 60 180 -Circle -16777216 true false 90 90 120 -Circle -7500403 true true 120 120 60 - -tree -false -0 -Circle -7500403 true true 118 3 94 -Rectangle -6459832 true false 120 195 180 300 -Circle -7500403 true true 65 21 108 -Circle -7500403 true true 116 41 127 -Circle -7500403 true true 45 90 120 -Circle -7500403 true true 104 74 152 - -triangle -false -0 -Polygon -7500403 true true 150 30 15 255 285 255 - -triangle 2 -false -0 -Polygon -7500403 true true 150 30 15 255 285 255 -Polygon -16777216 true false 151 99 225 223 75 224 - -truck -false -0 -Rectangle -7500403 true true 4 45 195 187 -Polygon -7500403 true true 296 193 296 150 259 134 244 104 208 104 207 194 -Rectangle -1 true false 195 60 195 105 -Polygon -16777216 true false 238 112 252 141 219 141 218 112 -Circle -16777216 true false 234 174 42 -Rectangle -7500403 true true 181 185 214 194 -Circle -16777216 true false 144 174 42 -Circle -16777216 true false 24 174 42 -Circle -7500403 false true 24 174 42 -Circle -7500403 false true 144 174 42 -Circle -7500403 false true 234 174 42 - -turtle -true -0 -Polygon -10899396 true false 215 204 240 233 246 254 228 266 215 252 193 210 -Polygon -10899396 true false 195 90 225 75 245 75 260 89 269 108 261 124 240 105 225 105 210 105 -Polygon -10899396 true false 105 90 75 75 55 75 40 89 31 108 39 124 60 105 75 105 90 105 -Polygon -10899396 true false 132 85 134 64 107 51 108 17 150 2 192 18 192 52 169 65 172 87 -Polygon -10899396 true false 85 204 60 233 54 254 72 266 85 252 107 210 -Polygon -7500403 true true 119 75 179 75 209 101 224 135 220 225 175 261 128 261 81 224 74 135 88 99 - -wheel -false -0 -Circle -7500403 true true 3 3 294 -Circle -16777216 true false 30 30 240 -Line -7500403 true 150 285 150 15 -Line -7500403 true 15 150 285 150 -Circle -7500403 true true 120 120 60 -Line -7500403 true 216 40 79 269 -Line -7500403 true 40 84 269 221 -Line -7500403 true 40 216 269 79 -Line -7500403 true 84 40 221 269 - -x -false -0 -Polygon -7500403 true true 270 75 225 30 30 225 75 270 -Polygon -7500403 true true 30 75 75 30 270 225 225 270 - -@#$#@#$#@ -NetLogo 5.0.5 -@#$#@#$#@ -@#$#@#$#@ -@#$#@#$#@ -@#$#@#$#@ -@#$#@#$#@ -default -0.0 --0.2 0 1.0 0.0 -0.0 1 1.0 0.0 -0.2 0 1.0 0.0 -link direction -true -0 -Line -7500403 true 150 150 90 180 -Line -7500403 true 150 150 210 180 - -@#$#@#$#@ -0 -@#$#@#$#@ diff --git a/samples/NetLogo/Life.nlogo b/samples/NetLogo/Life.nlogo index f79207f0..cb28c1a3 100644 --- a/samples/NetLogo/Life.nlogo +++ b/samples/NetLogo/Life.nlogo @@ -52,577 +52,4 @@ to draw-cells [ cell-birth ] ] display ] end -@#$#@#$#@ -GRAPHICS-WINDOW -285 -10 -699 -445 -50 -50 -4.0 -1 -10 -1 -1 -1 -0 -1 -1 -1 --50 -50 --50 -50 -1 -1 -1 -ticks -15.0 -SLIDER -120 -67 -276 -100 -initial-density -initial-density -0.0 -100.0 -35 -0.1 -1 -% -HORIZONTAL - -BUTTON -11 -68 -113 -101 -NIL -setup-random -NIL -1 -T -OBSERVER -NIL -NIL -NIL -NIL -1 - -BUTTON -11 -204 -114 -242 -go-once -go -NIL -1 -T -OBSERVER -NIL -NIL -NIL -NIL -1 - -BUTTON -122 -204 -225 -242 -go-forever -go -T -1 -T -OBSERVER -NIL -NIL -NIL -NIL -1 - -BUTTON -178 -276 -274 -309 -recolor -ifelse living?\n [ set pcolor fgcolor ]\n [ set pcolor bgcolor ] -NIL -1 -T -PATCH -NIL -NIL -NIL -NIL -1 - -MONITOR -12 -248 -115 -293 -current density -count patches with\n [living?]\n/ count patches -2 -1 -11 - -BUTTON -11 -32 -113 -65 -NIL -setup-blank -NIL -1 -T -OBSERVER -NIL -NIL -NIL -NIL -1 - -TEXTBOX -124 -125 -277 -193 -When this button is down, you can add or remove cells by holding down the mouse button and \"drawing\". -11 -0.0 -0 - -BUTTON -9 -134 -112 -169 -NIL -draw-cells -T -1 -T -OBSERVER -NIL -NIL -NIL -NIL -1 - -INPUTBOX -119 -309 -274 -369 -fgcolor -123 -1 -0 -Color - -INPUTBOX -119 -371 -274 -431 -bgcolor -79 -1 -0 -Color - -@#$#@#$#@ -## WHAT IS IT? - -This program is an example of a two-dimensional cellular automaton. This particular cellular automaton is called The Game of Life. - -A cellular automaton is a computational machine that performs actions based on certain rules. It can be thought of as a board which is divided into cells (such as square cells of a checkerboard). Each cell can be either "alive" or "dead." This is called the "state" of the cell. According to specified rules, each cell will be alive or dead at the next time step. - -## HOW IT WORKS - -The rules of the game are as follows. Each cell checks the state of itself and its eight surrounding neighbors and then sets itself to either alive or dead. If there are less than two alive neighbors, then the cell dies. If there are more than three alive neighbors, the cell dies. If there are 2 alive neighbors, the cell remains in the state it is in. If there are exactly three alive neighbors, the cell becomes alive. This is done in parallel and continues forever. - -There are certain recurring shapes in Life, for example, the "glider" and the "blinker". The glider is composed of 5 cells which form a small arrow-headed shape, like this: - - O - O - OOO - -This glider will wiggle across the world, retaining its shape. A blinker is a block of three cells (either up and down or left and right) that rotates between horizontal and vertical orientations. - -## HOW TO USE IT - -The INITIAL-DENSITY slider determines the initial density of cells that are alive. SETUP-RANDOM places these cells. GO-FOREVER runs the rule forever. GO-ONCE runs the rule once. - -If you want to draw your own pattern, use the DRAW-CELLS button and then use the mouse to "draw" and "erase" in the view. - -## THINGS TO NOTICE - -Find some objects that are alive, but motionless. - -Is there a "critical density" - one at which all change and motion stops/eternal motion begins? - -## THINGS TO TRY - -Are there any recurring shapes other than gliders and blinkers? - -Build some objects that don't die (using DRAW-CELLS) - -How much life can the board hold and still remain motionless and unchanging? (use DRAW-CELLS) - -The glider gun is a large conglomeration of cells that repeatedly spits out gliders. Find a "glider gun" (very, very difficult!). - -## EXTENDING THE MODEL - -Give some different rules to life and see what happens. - -Experiment with using neighbors4 instead of neighbors (see below). - -## NETLOGO FEATURES - -The neighbors primitive returns the agentset of the patches to the north, south, east, west, northeast, northwest, southeast, and southwest. So `count neighbors with [living?]` counts how many of those eight patches have the `living?` patch variable set to true. - -`neighbors4` is like `neighbors` but only uses the patches to the north, south, east, and west. Some cellular automata, like this one, are defined using the 8-neighbors rule, others the 4-neighbors. - -## RELATED MODELS - -Life Turtle-Based --- same as this, but implemented using turtles instead of patches, for a more attractive display -CA 1D Elementary --- a model that shows all 256 possible simple 1D cellular automata -CA 1D Totalistic --- a model that shows all 2,187 possible 1D 3-color totalistic cellular automata -CA 1D Rule 30 --- the basic rule 30 model -CA 1D Rule 30 Turtle --- the basic rule 30 model implemented using turtles -CA 1D Rule 90 --- the basic rule 90 model -CA 1D Rule 110 --- the basic rule 110 model -CA 1D Rule 250 --- the basic rule 250 model - -## CREDITS AND REFERENCES - -The Game of Life was invented by John Horton Conway. - -See also: - -Von Neumann, J. and Burks, A. W., Eds, 1966. Theory of Self-Reproducing Automata. University of Illinois Press, Champaign, IL. - -"LifeLine: A Quarterly Newsletter for Enthusiasts of John Conway's Game of Life", nos. 1-11, 1971-1973. - -Martin Gardner, "Mathematical Games: The fantastic combinations of John Conway's new solitaire game `life',", Scientific American, October, 1970, pp. 120-123. - -Martin Gardner, "Mathematical Games: On cellular automata, self-reproduction, the Garden of Eden, and the game `life',", Scientific American, February, 1971, pp. 112-117. - -Berlekamp, Conway, and Guy, Winning Ways for your Mathematical Plays, Academic Press: New York, 1982. - -William Poundstone, The Recursive Universe, William Morrow: New York, 1985. -@#$#@#$#@ -default -true -0 -Polygon -7500403 true true 150 5 40 250 150 205 260 250 - -airplane -true -0 -Polygon -7500403 true true 150 0 135 15 120 60 120 105 15 165 15 195 120 180 135 240 105 270 120 285 150 270 180 285 210 270 165 240 180 180 285 195 285 165 180 105 180 60 165 15 - -arrow -true -0 -Polygon -7500403 true true 150 0 0 150 105 150 105 293 195 293 195 150 300 150 - -box -false -0 -Polygon -7500403 true true 150 285 285 225 285 75 150 135 -Polygon -7500403 true true 150 135 15 75 150 15 285 75 -Polygon -7500403 true true 15 75 15 225 150 285 150 135 -Line -16777216 false 150 285 150 135 -Line -16777216 false 150 135 15 75 -Line -16777216 false 150 135 285 75 - -bug -true -0 -Circle -7500403 true true 96 182 108 -Circle -7500403 true true 110 127 80 -Circle -7500403 true true 110 75 80 -Line -7500403 true 150 100 80 30 -Line -7500403 true 150 100 220 30 - -butterfly -true -0 -Polygon -7500403 true true 150 165 209 199 225 225 225 255 195 270 165 255 150 240 -Polygon -7500403 true true 150 165 89 198 75 225 75 255 105 270 135 255 150 240 -Polygon -7500403 true true 139 148 100 105 55 90 25 90 10 105 10 135 25 180 40 195 85 194 139 163 -Polygon -7500403 true true 162 150 200 105 245 90 275 90 290 105 290 135 275 180 260 195 215 195 162 165 -Polygon -16777216 true false 150 255 135 225 120 150 135 120 150 105 165 120 180 150 165 225 -Circle -16777216 true false 135 90 30 -Line -16777216 false 150 105 195 60 -Line -16777216 false 150 105 105 60 - -car -false -0 -Polygon -7500403 true true 300 180 279 164 261 144 240 135 226 132 213 106 203 84 185 63 159 50 135 50 75 60 0 150 0 165 0 225 300 225 300 180 -Circle -16777216 true false 180 180 90 -Circle -16777216 true false 30 180 90 -Polygon -16777216 true false 162 80 132 78 134 135 209 135 194 105 189 96 180 89 -Circle -7500403 true true 47 195 58 -Circle -7500403 true true 195 195 58 - -circle -false -0 -Circle -7500403 true true 0 0 300 - -circle 2 -false -0 -Circle -7500403 true true 0 0 300 -Circle -16777216 true false 30 30 240 - -cow -false -0 -Polygon -7500403 true true 200 193 197 249 179 249 177 196 166 187 140 189 93 191 78 179 72 211 49 209 48 181 37 149 25 120 25 89 45 72 103 84 179 75 198 76 252 64 272 81 293 103 285 121 255 121 242 118 224 167 -Polygon -7500403 true true 73 210 86 251 62 249 48 208 -Polygon -7500403 true true 25 114 16 195 9 204 23 213 25 200 39 123 - -cylinder -false -0 -Circle -7500403 true true 0 0 300 - -dot -false -0 -Circle -7500403 true true 90 90 120 - -face happy -false -0 -Circle -7500403 true true 8 8 285 -Circle -16777216 true false 60 75 60 -Circle -16777216 true false 180 75 60 -Polygon -16777216 true false 150 255 90 239 62 213 47 191 67 179 90 203 109 218 150 225 192 218 210 203 227 181 251 194 236 217 212 240 - -face neutral -false -0 -Circle -7500403 true true 8 7 285 -Circle -16777216 true false 60 75 60 -Circle -16777216 true false 180 75 60 -Rectangle -16777216 true false 60 195 240 225 - -face sad -false -0 -Circle -7500403 true true 8 8 285 -Circle -16777216 true false 60 75 60 -Circle -16777216 true false 180 75 60 -Polygon -16777216 true false 150 168 90 184 62 210 47 232 67 244 90 220 109 205 150 198 192 205 210 220 227 242 251 229 236 206 212 183 - -fish -false -0 -Polygon -1 true false 44 131 21 87 15 86 0 120 15 150 0 180 13 214 20 212 45 166 -Polygon -1 true false 135 195 119 235 95 218 76 210 46 204 60 165 -Polygon -1 true false 75 45 83 77 71 103 86 114 166 78 135 60 -Polygon -7500403 true true 30 136 151 77 226 81 280 119 292 146 292 160 287 170 270 195 195 210 151 212 30 166 -Circle -16777216 true false 215 106 30 - -flag -false -0 -Rectangle -7500403 true true 60 15 75 300 -Polygon -7500403 true true 90 150 270 90 90 30 -Line -7500403 true 75 135 90 135 -Line -7500403 true 75 45 90 45 - -flower -false -0 -Polygon -10899396 true false 135 120 165 165 180 210 180 240 150 300 165 300 195 240 195 195 165 135 -Circle -7500403 true true 85 132 38 -Circle -7500403 true true 130 147 38 -Circle -7500403 true true 192 85 38 -Circle -7500403 true true 85 40 38 -Circle -7500403 true true 177 40 38 -Circle -7500403 true true 177 132 38 -Circle -7500403 true true 70 85 38 -Circle -7500403 true true 130 25 38 -Circle -7500403 true true 96 51 108 -Circle -16777216 true false 113 68 74 -Polygon -10899396 true false 189 233 219 188 249 173 279 188 234 218 -Polygon -10899396 true false 180 255 150 210 105 210 75 240 135 240 - -house -false -0 -Rectangle -7500403 true true 45 120 255 285 -Rectangle -16777216 true false 120 210 180 285 -Polygon -7500403 true true 15 120 150 15 285 120 -Line -16777216 false 30 120 270 120 - -leaf -false -0 -Polygon -7500403 true true 150 210 135 195 120 210 60 210 30 195 60 180 60 165 15 135 30 120 15 105 40 104 45 90 60 90 90 105 105 120 120 120 105 60 120 60 135 30 150 15 165 30 180 60 195 60 180 120 195 120 210 105 240 90 255 90 263 104 285 105 270 120 285 135 240 165 240 180 270 195 240 210 180 210 165 195 -Polygon -7500403 true true 135 195 135 240 120 255 105 255 105 285 135 285 165 240 165 195 - -line -true -0 -Line -7500403 true 150 0 150 300 - -line half -true -0 -Line -7500403 true 150 0 150 150 - -pentagon -false -0 -Polygon -7500403 true true 150 15 15 120 60 285 240 285 285 120 - -person -false -0 -Circle -7500403 true true 110 5 80 -Polygon -7500403 true true 105 90 120 195 90 285 105 300 135 300 150 225 165 300 195 300 210 285 180 195 195 90 -Rectangle -7500403 true true 127 79 172 94 -Polygon -7500403 true true 195 90 240 150 225 180 165 105 -Polygon -7500403 true true 105 90 60 150 75 180 135 105 - -plant -false -0 -Rectangle -7500403 true true 135 90 165 300 -Polygon -7500403 true true 135 255 90 210 45 195 75 255 135 285 -Polygon -7500403 true true 165 255 210 210 255 195 225 255 165 285 -Polygon -7500403 true true 135 180 90 135 45 120 75 180 135 210 -Polygon -7500403 true true 165 180 165 210 225 180 255 120 210 135 -Polygon -7500403 true true 135 105 90 60 45 45 75 105 135 135 -Polygon -7500403 true true 165 105 165 135 225 105 255 45 210 60 -Polygon -7500403 true true 135 90 120 45 150 15 180 45 165 90 - -square -false -0 -Rectangle -7500403 true true 30 30 270 270 - -square 2 -false -0 -Rectangle -7500403 true true 30 30 270 270 -Rectangle -16777216 true false 60 60 240 240 - -star -false -0 -Polygon -7500403 true true 151 1 185 108 298 108 207 175 242 282 151 216 59 282 94 175 3 108 116 108 - -target -false -0 -Circle -7500403 true true 0 0 300 -Circle -16777216 true false 30 30 240 -Circle -7500403 true true 60 60 180 -Circle -16777216 true false 90 90 120 -Circle -7500403 true true 120 120 60 - -tree -false -0 -Circle -7500403 true true 118 3 94 -Rectangle -6459832 true false 120 195 180 300 -Circle -7500403 true true 65 21 108 -Circle -7500403 true true 116 41 127 -Circle -7500403 true true 45 90 120 -Circle -7500403 true true 104 74 152 - -triangle -false -0 -Polygon -7500403 true true 150 30 15 255 285 255 - -triangle 2 -false -0 -Polygon -7500403 true true 150 30 15 255 285 255 -Polygon -16777216 true false 151 99 225 223 75 224 - -truck -false -0 -Rectangle -7500403 true true 4 45 195 187 -Polygon -7500403 true true 296 193 296 150 259 134 244 104 208 104 207 194 -Rectangle -1 true false 195 60 195 105 -Polygon -16777216 true false 238 112 252 141 219 141 218 112 -Circle -16777216 true false 234 174 42 -Rectangle -7500403 true true 181 185 214 194 -Circle -16777216 true false 144 174 42 -Circle -16777216 true false 24 174 42 -Circle -7500403 false true 24 174 42 -Circle -7500403 false true 144 174 42 -Circle -7500403 false true 234 174 42 - -turtle -true -0 -Polygon -10899396 true false 215 204 240 233 246 254 228 266 215 252 193 210 -Polygon -10899396 true false 195 90 225 75 245 75 260 89 269 108 261 124 240 105 225 105 210 105 -Polygon -10899396 true false 105 90 75 75 55 75 40 89 31 108 39 124 60 105 75 105 90 105 -Polygon -10899396 true false 132 85 134 64 107 51 108 17 150 2 192 18 192 52 169 65 172 87 -Polygon -10899396 true false 85 204 60 233 54 254 72 266 85 252 107 210 -Polygon -7500403 true true 119 75 179 75 209 101 224 135 220 225 175 261 128 261 81 224 74 135 88 99 - -wheel -false -0 -Circle -7500403 true true 3 3 294 -Circle -16777216 true false 30 30 240 -Line -7500403 true 150 285 150 15 -Line -7500403 true 15 150 285 150 -Circle -7500403 true true 120 120 60 -Line -7500403 true 216 40 79 269 -Line -7500403 true 40 84 269 221 -Line -7500403 true 40 216 269 79 -Line -7500403 true 84 40 221 269 - -x -false -0 -Polygon -7500403 true true 270 75 225 30 30 225 75 270 -Polygon -7500403 true true 30 75 75 30 270 225 225 270 - -@#$#@#$#@ -NetLogo 5.0.5 -@#$#@#$#@ -setup-random repeat 20 [ go ] -@#$#@#$#@ -@#$#@#$#@ -@#$#@#$#@ -@#$#@#$#@ -default -0.0 --0.2 0 1.0 0.0 -0.0 1 1.0 0.0 -0.2 0 1.0 0.0 -link direction -true -0 -Line -7500403 true 150 150 90 180 -Line -7500403 true 150 150 210 180 - -@#$#@#$#@ -0 -@#$#@#$#@ diff --git a/samples/NetLogo/Star Fractal.nlogo b/samples/NetLogo/Star Fractal.nlogo deleted file mode 100644 index e5486b23..00000000 --- a/samples/NetLogo/Star Fractal.nlogo +++ /dev/null @@ -1,501 +0,0 @@ -turtles-own [ - moves ;; how many sides the turtles has drawn so far - star-side ;; The length of the side that the turtle is drawing - generation ;; How many generations of turtles have come before it. So, -] ;; if the turtle was hatched from a turtle that was hatched - ;; by another turtle, it's generation is 2 - -to setup - clear-all - crt 1 [ - set size 8 ;; so turtles are easy to see - set ycor max-pycor * 0.9 ;; place near top of world - set star-side ycor * 1.97538 ;; length of the sides of the star it will draw - pen-down - set heading 180 + 18 - recolor - ] - reset-ticks -end - -to go - if not any? turtles [ stop ] - ask turtles [ - fd star-side - rt 180 + 36 - if generation < fractal-level [ ;; If it's not drawing at the deepest level of the figure, - hatch 1 [ ;; hatch a new turtle to draw at a lower level - set generation generation + 1 - set star-side star-side / 2 - recolor - set moves 0 - rt 18 - ] - ] - set moves moves + 1 - if moves > 5 [ die ] ;; When the turtle has completed its star, it's done - ] - tick -end - -to recolor ;; turtle procedure - set color scale-color red (fractal-level - generation) -1 (fractal-level + 1) -end -@#$#@#$#@ -GRAPHICS-WINDOW -274 -10 -686 -443 -100 -100 -2.0 -1 -10 -1 -1 -1 -0 -0 -0 -1 --100 -100 --100 -100 -1 -1 -1 -ticks -30.0 - -BUTTON -146 -42 -211 -75 -go -go -T -1 -T -OBSERVER -NIL -NIL -NIL -NIL -1 - -SLIDER -32 -88 -248 -121 -fractal-level -fractal-level -0 -4 -3 -1 -1 -NIL -HORIZONTAL - -BUTTON -69 -42 -133 -75 -setup -setup -NIL -1 -T -OBSERVER -NIL -NIL -NIL -NIL -1 - -MONITOR -105 -128 -190 -173 -turtles -count turtles -3 -1 -11 - -PLOT -2 -179 -272 -394 -Turtles vs. Time -Time -Num Turtles -0.0 -25.0 -0.0 -180.0 -true -false -"" "" -PENS -"default" 1.0 0 -16777216 true "" "plot count turtles" - -@#$#@#$#@ -## WHAT IS IT? - -This model creates a fractal-like structure consisting of stars drawn at various scales, the number of which is specified by the user. The structure is drawn by generations of turtles that draw stars at a given scale and hatch successive generations to draw new ones at smaller scales. - -## HOW TO USE IT - -The FRACTAL-LEVEL slider controls the number of levels the structure is drawn in. For instance, a fractal level of 0 results in a single star, while a fractal level of 1 draws a star with smaller stars that begin at each of its 5 corners. This pattern is repeated as the level increases. - -Click the SETUP button to initialize the structure and GO to begin drawing it. - -## THINGS TO NOTICE - -The figure drawn embodies the most important fractal quality: self-similar structure at smaller scales. This means that no matter how far you "zoom in" to it, you will still see the same shape (namely, a star). The fractal level determines to how small a scale this property holds, so the greater the level the more you can "zoom in" and still see stars. - -Notice that at a fractal level greater than 1, the model begins with one turtle, which hatches new turtles at each corner, and these turtles similarly hatch new ones at each of their corners as well. This behavior is made possible by a powerful mathematical technique called recursion. A process is called recursive when its workings involve "performing itself". In this case, the process performed by each turtle at each step is to draw a new side of its star and then create new turtles to perform the very same process. A helpful property of recursive processes is that the instructions are often short, because each performer is executing the same instructions. Hence the brevity of Star Fractal's procedures. - -The ideas behind fractal scaling (the property of self-similar structures at different scales) and recursion are essentially the same. This is suggested by the fact that a recursive process is able to generate a fractal-like structure, as in this model. One way to think about it is that recursion applies these ideas to processes (like NetLogo models), and fractal scaling applies them to physical or mathematical structures (like the figure drawn by Star Fractal). - -## THINGS TO TRY - -Edit GO so that it's not a forever button, and/or use the speed slider to slow the model down, and note what happens during each tick. Notice that what begins as a single drawing multiplies into many drawings, each of which is at a smaller scale but proceeds exactly like the larger one that spawned it. Thus, recursion begets self-sameness at different scales. - -Try the model initially with small fractal levels and work your way up to higher ones. Try to figure out how many more stars are incorporated into the figure each time the level increases by one. What kind of general rule you can come up with? That is, given a generation of turtles g, how many turtles will be in the generation g + 1? Start from g = 0. (This is a recursive rule.) - -## EXTENDING THE MODEL - -In increasing order of difficulty: - -Change the color scaling so that the smaller stars are brighter than the larger ones. - -Change the model so that it draws shapes other than stars. Will any shape work? - -The structure that this model draws is only "fractal-like", because even when you "zoom in" and look at smaller scales, the smaller stars aren't actually part of the larger ones; they're just connected to them at a vertex. An important property of fractals is that the larger structures are composed of the smaller ones, something which clearly doesn't hold here. For a tougher exercise, try changing the model so that the smaller stars (or whatever shapes are being drawn) are actually part of the larger ones, for instance by drawing them in the middle of their sides. Such a figure will be a lot less "noisy" than this one, in terms of how difficult it is to discern individual stars, and it will have different properties when you zoom in. - -## NETLOGO FEATURES - -This model makes use of an important NetLogo command: `hatch`. `hatch` allows one turtle to create a new one on the same patch and give it some initial instructions. In this case, the parent turtle sets the length of the star its offspring will draw, its initial heading, and several other variables. Notice that the new turtle uses the values of its parent turtle's variables in the body of the hatch procedure. - -Another useful primitive this model uses is `scale-color`. It is used to make the brightness of the color the turtles are drawing inversely proportional to the turtle's generation, so that larger stars are brighter than smaller ones (this was done to make the larger ones more visible). This code: - - scale-color red (fractal-level - generation) -1 (fractal-level + 1) - -works as follows: Subtract the value of `generation` from that of `fractal-level`. The higher that resulting value is on the scale from -1 to `(fractal-level + 1)`, the darker the shade of red the turtle will draw with. - -## CREDITS AND REFERENCES -@#$#@#$#@ -default -true -0 -Polygon -7500403 true true 150 5 40 250 150 205 260 250 - -airplane -true -0 -Polygon -7500403 true true 150 0 135 15 120 60 120 105 15 165 15 195 120 180 135 240 105 270 120 285 150 270 180 285 210 270 165 240 180 180 285 195 285 165 180 105 180 60 165 15 - -arrow -true -0 -Polygon -7500403 true true 150 0 0 150 105 150 105 293 195 293 195 150 300 150 - -box -false -0 -Polygon -7500403 true true 150 285 285 225 285 75 150 135 -Polygon -7500403 true true 150 135 15 75 150 15 285 75 -Polygon -7500403 true true 15 75 15 225 150 285 150 135 -Line -16777216 false 150 285 150 135 -Line -16777216 false 150 135 15 75 -Line -16777216 false 150 135 285 75 - -bug -true -0 -Circle -7500403 true true 96 182 108 -Circle -7500403 true true 110 127 80 -Circle -7500403 true true 110 75 80 -Line -7500403 true 150 100 80 30 -Line -7500403 true 150 100 220 30 - -butterfly -true -0 -Polygon -7500403 true true 150 165 209 199 225 225 225 255 195 270 165 255 150 240 -Polygon -7500403 true true 150 165 89 198 75 225 75 255 105 270 135 255 150 240 -Polygon -7500403 true true 139 148 100 105 55 90 25 90 10 105 10 135 25 180 40 195 85 194 139 163 -Polygon -7500403 true true 162 150 200 105 245 90 275 90 290 105 290 135 275 180 260 195 215 195 162 165 -Polygon -16777216 true false 150 255 135 225 120 150 135 120 150 105 165 120 180 150 165 225 -Circle -16777216 true false 135 90 30 -Line -16777216 false 150 105 195 60 -Line -16777216 false 150 105 105 60 - -car -false -0 -Polygon -7500403 true true 300 180 279 164 261 144 240 135 226 132 213 106 203 84 185 63 159 50 135 50 75 60 0 150 0 165 0 225 300 225 300 180 -Circle -16777216 true false 180 180 90 -Circle -16777216 true false 30 180 90 -Polygon -16777216 true false 162 80 132 78 134 135 209 135 194 105 189 96 180 89 -Circle -7500403 true true 47 195 58 -Circle -7500403 true true 195 195 58 - -circle -false -0 -Circle -7500403 true true 0 0 300 - -circle 2 -false -0 -Circle -7500403 true true 0 0 300 -Circle -16777216 true false 30 30 240 - -cow -false -0 -Polygon -7500403 true true 200 193 197 249 179 249 177 196 166 187 140 189 93 191 78 179 72 211 49 209 48 181 37 149 25 120 25 89 45 72 103 84 179 75 198 76 252 64 272 81 293 103 285 121 255 121 242 118 224 167 -Polygon -7500403 true true 73 210 86 251 62 249 48 208 -Polygon -7500403 true true 25 114 16 195 9 204 23 213 25 200 39 123 - -cylinder -false -0 -Circle -7500403 true true 0 0 300 - -dot -false -0 -Circle -7500403 true true 90 90 120 - -face happy -false -0 -Circle -7500403 true true 8 8 285 -Circle -16777216 true false 60 75 60 -Circle -16777216 true false 180 75 60 -Polygon -16777216 true false 150 255 90 239 62 213 47 191 67 179 90 203 109 218 150 225 192 218 210 203 227 181 251 194 236 217 212 240 - -face neutral -false -0 -Circle -7500403 true true 8 7 285 -Circle -16777216 true false 60 75 60 -Circle -16777216 true false 180 75 60 -Rectangle -16777216 true false 60 195 240 225 - -face sad -false -0 -Circle -7500403 true true 8 8 285 -Circle -16777216 true false 60 75 60 -Circle -16777216 true false 180 75 60 -Polygon -16777216 true false 150 168 90 184 62 210 47 232 67 244 90 220 109 205 150 198 192 205 210 220 227 242 251 229 236 206 212 183 - -fish -false -0 -Polygon -1 true false 44 131 21 87 15 86 0 120 15 150 0 180 13 214 20 212 45 166 -Polygon -1 true false 135 195 119 235 95 218 76 210 46 204 60 165 -Polygon -1 true false 75 45 83 77 71 103 86 114 166 78 135 60 -Polygon -7500403 true true 30 136 151 77 226 81 280 119 292 146 292 160 287 170 270 195 195 210 151 212 30 166 -Circle -16777216 true false 215 106 30 - -flag -false -0 -Rectangle -7500403 true true 60 15 75 300 -Polygon -7500403 true true 90 150 270 90 90 30 -Line -7500403 true 75 135 90 135 -Line -7500403 true 75 45 90 45 - -flower -false -0 -Polygon -10899396 true false 135 120 165 165 180 210 180 240 150 300 165 300 195 240 195 195 165 135 -Circle -7500403 true true 85 132 38 -Circle -7500403 true true 130 147 38 -Circle -7500403 true true 192 85 38 -Circle -7500403 true true 85 40 38 -Circle -7500403 true true 177 40 38 -Circle -7500403 true true 177 132 38 -Circle -7500403 true true 70 85 38 -Circle -7500403 true true 130 25 38 -Circle -7500403 true true 96 51 108 -Circle -16777216 true false 113 68 74 -Polygon -10899396 true false 189 233 219 188 249 173 279 188 234 218 -Polygon -10899396 true false 180 255 150 210 105 210 75 240 135 240 - -house -false -0 -Rectangle -7500403 true true 45 120 255 285 -Rectangle -16777216 true false 120 210 180 285 -Polygon -7500403 true true 15 120 150 15 285 120 -Line -16777216 false 30 120 270 120 - -leaf -false -0 -Polygon -7500403 true true 150 210 135 195 120 210 60 210 30 195 60 180 60 165 15 135 30 120 15 105 40 104 45 90 60 90 90 105 105 120 120 120 105 60 120 60 135 30 150 15 165 30 180 60 195 60 180 120 195 120 210 105 240 90 255 90 263 104 285 105 270 120 285 135 240 165 240 180 270 195 240 210 180 210 165 195 -Polygon -7500403 true true 135 195 135 240 120 255 105 255 105 285 135 285 165 240 165 195 - -line -true -0 -Line -7500403 true 150 0 150 300 - -line half -true -0 -Line -7500403 true 150 0 150 150 - -pentagon -false -0 -Polygon -7500403 true true 150 15 15 120 60 285 240 285 285 120 - -person -false -0 -Circle -7500403 true true 110 5 80 -Polygon -7500403 true true 105 90 120 195 90 285 105 300 135 300 150 225 165 300 195 300 210 285 180 195 195 90 -Rectangle -7500403 true true 127 79 172 94 -Polygon -7500403 true true 195 90 240 150 225 180 165 105 -Polygon -7500403 true true 105 90 60 150 75 180 135 105 - -plant -false -0 -Rectangle -7500403 true true 135 90 165 300 -Polygon -7500403 true true 135 255 90 210 45 195 75 255 135 285 -Polygon -7500403 true true 165 255 210 210 255 195 225 255 165 285 -Polygon -7500403 true true 135 180 90 135 45 120 75 180 135 210 -Polygon -7500403 true true 165 180 165 210 225 180 255 120 210 135 -Polygon -7500403 true true 135 105 90 60 45 45 75 105 135 135 -Polygon -7500403 true true 165 105 165 135 225 105 255 45 210 60 -Polygon -7500403 true true 135 90 120 45 150 15 180 45 165 90 - -square -false -0 -Rectangle -7500403 true true 30 30 270 270 - -square 2 -false -0 -Rectangle -7500403 true true 30 30 270 270 -Rectangle -16777216 true false 60 60 240 240 - -star -false -0 -Polygon -7500403 true true 151 1 185 108 298 108 207 175 242 282 151 216 59 282 94 175 3 108 116 108 - -target -false -0 -Circle -7500403 true true 0 0 300 -Circle -16777216 true false 30 30 240 -Circle -7500403 true true 60 60 180 -Circle -16777216 true false 90 90 120 -Circle -7500403 true true 120 120 60 - -tree -false -0 -Circle -7500403 true true 118 3 94 -Rectangle -6459832 true false 120 195 180 300 -Circle -7500403 true true 65 21 108 -Circle -7500403 true true 116 41 127 -Circle -7500403 true true 45 90 120 -Circle -7500403 true true 104 74 152 - -triangle -false -0 -Polygon -7500403 true true 150 30 15 255 285 255 - -triangle 2 -false -0 -Polygon -7500403 true true 150 30 15 255 285 255 -Polygon -16777216 true false 151 99 225 223 75 224 - -truck -false -0 -Rectangle -7500403 true true 4 45 195 187 -Polygon -7500403 true true 296 193 296 150 259 134 244 104 208 104 207 194 -Rectangle -1 true false 195 60 195 105 -Polygon -16777216 true false 238 112 252 141 219 141 218 112 -Circle -16777216 true false 234 174 42 -Rectangle -7500403 true true 181 185 214 194 -Circle -16777216 true false 144 174 42 -Circle -16777216 true false 24 174 42 -Circle -7500403 false true 24 174 42 -Circle -7500403 false true 144 174 42 -Circle -7500403 false true 234 174 42 - -turtle -true -0 -Polygon -10899396 true false 215 204 240 233 246 254 228 266 215 252 193 210 -Polygon -10899396 true false 195 90 225 75 245 75 260 89 269 108 261 124 240 105 225 105 210 105 -Polygon -10899396 true false 105 90 75 75 55 75 40 89 31 108 39 124 60 105 75 105 90 105 -Polygon -10899396 true false 132 85 134 64 107 51 108 17 150 2 192 18 192 52 169 65 172 87 -Polygon -10899396 true false 85 204 60 233 54 254 72 266 85 252 107 210 -Polygon -7500403 true true 119 75 179 75 209 101 224 135 220 225 175 261 128 261 81 224 74 135 88 99 - -wheel -false -0 -Circle -7500403 true true 3 3 294 -Circle -16777216 true false 30 30 240 -Line -7500403 true 150 285 150 15 -Line -7500403 true 15 150 285 150 -Circle -7500403 true true 120 120 60 -Line -7500403 true 216 40 79 269 -Line -7500403 true 40 84 269 221 -Line -7500403 true 40 216 269 79 -Line -7500403 true 84 40 221 269 - -x -false -0 -Polygon -7500403 true true 270 75 225 30 30 225 75 270 -Polygon -7500403 true true 30 75 75 30 270 225 225 270 - -@#$#@#$#@ -NetLogo 5.0.5 -@#$#@#$#@ -setup -while [any? turtles] [ go ] -@#$#@#$#@ -@#$#@#$#@ -@#$#@#$#@ -@#$#@#$#@ -default -0.0 --0.2 0 0.0 1.0 -0.0 1 1.0 0.0 -0.2 0 0.0 1.0 -link direction -true -0 -Line -7500403 true 150 150 90 180 -Line -7500403 true 150 150 210 180 - -@#$#@#$#@ -0 -@#$#@#$#@ From 5bef198e6d4585a9cb46983814349d0a96bc7e2b Mon Sep 17 00:00:00 2001 From: Ted Nyman Date: Sat, 9 Nov 2013 19:13:08 -0800 Subject: [PATCH 17/24] More lenient regex for LICENSE --- lib/linguist/vendor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/linguist/vendor.yml b/lib/linguist/vendor.yml index 1e106812..2bc71b72 100644 --- a/lib/linguist/vendor.yml +++ b/lib/linguist/vendor.yml @@ -139,7 +139,7 @@ # LICENSE, README, git config files - ^COPYING$ -- ^LICENSE$ +- LICENSE$ - gitattributes$ - gitignore$ - gitmodules$ From d7baf4ed7bae1b134b0443b7c25f35368b9ff829 Mon Sep 17 00:00:00 2001 From: William Kent Date: Sun, 10 Nov 2013 10:48:03 -0500 Subject: [PATCH 18/24] Fixed typo in a documentation comment. --- lib/linguist/generated.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/linguist/generated.rb b/lib/linguist/generated.rb index ea0a40ad..7ae89449 100644 --- a/lib/linguist/generated.rb +++ b/lib/linguist/generated.rb @@ -75,7 +75,7 @@ module Linguist # Internal: Is the blob minified files? # - # Consider a file minified if it contains more than 5% spaces. + # Consider a file minified if it contains less than 5% spaces. # Currently, only JS and CSS files are detected by this method. # # Returns true or false. From 762b389721a44c37cab5115d1a841f45824f3e59 Mon Sep 17 00:00:00 2001 From: Ted Nyman Date: Sun, 10 Nov 2013 17:55:17 -0800 Subject: [PATCH 19/24] Minor README updates --- README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f17de17b..76948111 100644 --- a/README.md +++ b/README.md @@ -31,9 +31,10 @@ We typically run on a pre-release version of Pygments, [pygments.rb](https://git ### Stats -The Language Graph you see on every repository is built by aggregating the languages of all repo's blobs. The top language in the graph determines the project's primary language. Collectively, these stats make up the [Top Languages](https://github.com/languages) page. +The Language Graph you see on every repository is built by aggregating the languages of each file in that repository. +The top language in the graph determines the project's primary language. Collectively, these stats make up the [Top Languages](https://github.com/languages) page. -The repository stats API can be used on a directory: +The repository stats API, accessed through `#languages`, can be used on a directory: ```ruby project = Linguist::Repository.from_directory(".") @@ -41,7 +42,7 @@ project.language.name #=> "Ruby" project.languages #=> { "Ruby" => 0.98, "Shell" => 0.02 } ``` -These stats are also printed out by the binary. Try running `linguist` on itself: +These stats are also printed out by the `linguist` binary. Try running `linguist` on itself: $ bundle exec linguist lib/ 100% Ruby From 04c78c8c339c4aa4e61f1116305e75cad57d5cdc Mon Sep 17 00:00:00 2001 From: Ted Nyman Date: Sun, 10 Nov 2013 17:57:43 -0800 Subject: [PATCH 20/24] Bit more README --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 76948111..80ab56c0 100644 --- a/README.md +++ b/README.md @@ -83,18 +83,18 @@ To run the tests: ## Contributing -The majority of patches won't need to touch any Ruby code at all. The [master language list](https://github.com/github/linguist/blob/master/lib/linguist/languages.yml) is just a configuration file. +The majority of contributions won't need to touch any Ruby code at all. The [master language list](https://github.com/github/linguist/blob/master/lib/linguist/languages.yml) is just a YAML configuration file. We try to only add languages once they have some usage on GitHub, so please note in-the-wild usage examples in your pull request. Almost all bug fixes or new language additions should come with some additional code samples. Just drop them under [`samples/`](https://github.com/github/linguist/tree/master/samples) in the correct subdirectory and our test suite will automatically test them. In most cases you shouldn't need to add any new assertions. -To update the samples.json after adding new files to [`samples/`](https://github.com/github/linguist/tree/master/samples): +To update the `samples.json` after adding new files to [`samples/`](https://github.com/github/linguist/tree/master/samples): bundle exec rake samples ### Testing -Sometimes getting the tests running can be too much work, especially if you don't have much Ruby experience. It's okay, be lazy and let our build bot [Travis](http://travis-ci.org/#!/github/linguist) run the tests for you. Just open a pull request and the bot will start cranking away. +Sometimes getting the tests running can be too much work, especially if you don't have much Ruby experience. It's okay: be lazy and let our build bot [Travis](http://travis-ci.org/#!/github/linguist) run the tests for you. Just open a pull request and the bot will start cranking away. Here's our current build status, which is hopefully green: [![Build Status](https://secure.travis-ci.org/github/linguist.png?branch=master)](http://travis-ci.org/github/linguist) From 74775b2e0afb4d5428ce2f5512704745e430f46a Mon Sep 17 00:00:00 2001 From: Jos van Egmond Date: Thu, 14 Nov 2013 11:15:38 +0100 Subject: [PATCH 21/24] Added AutoIt Language website: http://autoitscript.com Example project on GitHub: https://github.com/jvanegmond/au3-minecraft-monitor --- lib/linguist/languages.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/linguist/languages.yml b/lib/linguist/languages.yml index 014c5304..7b70f8cb 100644 --- a/lib/linguist/languages.yml +++ b/lib/linguist/languages.yml @@ -121,6 +121,15 @@ AutoHotkey: aliases: - ahk primary_extension: .ahk + +AutoIt: + type: programming + color: "#36699B" + aliases: + - au3 + - AutoIt3 + - AutoItScript + primary_extension: .au3 Awk: type: programming From 4f656c200b2e5127b4a6bc7ad7b97cd20f5cb77d Mon Sep 17 00:00:00 2001 From: Ted Nyman Date: Fri, 15 Nov 2013 18:42:53 -0800 Subject: [PATCH 22/24] Minor docs/naming --- lib/linguist/classifier.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/linguist/classifier.rb b/lib/linguist/classifier.rb index a9707b28..195087d8 100644 --- a/lib/linguist/classifier.rb +++ b/lib/linguist/classifier.rb @@ -15,8 +15,8 @@ module Linguist # # Returns nothing. # - # Set LINGUIST_DEBUG=1 or =2 to see probabilities per-token, - # per-language. See also dump_all_tokens, below. + # Set LINGUIST_DEBUG=1 or =2 to see probabilities per-token or + # per-language. See also #dump_all_tokens, below. def self.train!(db, language, data) tokens = Tokenizer.tokenize(data) @@ -151,10 +151,10 @@ module Linguist printf "%#{maxlen}s", "" puts " #" + languages.map { |lang| sprintf("%10s", lang) }.join - tokmap = Hash.new(0) - tokens.each { |tok| tokmap[tok] += 1 } + token_map = Hash.new(0) + tokens.each { |tok| token_map[tok] += 1 } - tokmap.sort.each { |tok, count| + token_map.sort.each { |tok, count| arr = languages.map { |lang| [lang, token_probability(tok, lang)] } min = arr.map { |a,b| b }.min minlog = Math.log(min) From 183c280263006668ec9b07916f1a0575e17d07ba Mon Sep 17 00:00:00 2001 From: Ted Nyman Date: Sat, 16 Nov 2013 12:28:42 -0800 Subject: [PATCH 23/24] Better lexer --- lib/linguist/languages.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/linguist/languages.yml b/lib/linguist/languages.yml index 45209099..daef0e24 100644 --- a/lib/linguist/languages.yml +++ b/lib/linguist/languages.yml @@ -28,13 +28,13 @@ ABAP: type: programming lexer: ABAP primary_extension: .abap - + ANTLR: type: programming color: "#9DC3FF" lexer: ANTLR primary_extension: .g4 - + ASP: type: programming color: "#6a40fd" @@ -121,7 +121,7 @@ AutoHotkey: aliases: - ahk primary_extension: .ahk - + AutoIt: type: programming color: "#36699B" @@ -375,7 +375,7 @@ D-ObjDump: type: data lexer: d-objdump primary_extension: .d-objdump - + DM: type: programming color: "#075ff1" @@ -412,7 +412,7 @@ DCPU-16 ASM: - .dasm aliases: - dasm16 - + Diff: primary_extension: .diff @@ -461,7 +461,7 @@ Emacs Lisp: - elisp - emacs primary_extension: .el - filenames: + filenames: - .emacs extensions: - .emacs @@ -1532,7 +1532,7 @@ Unified Parallel C: UnrealScript: type: programming color: "#a54c4d" - lexer: JavaScript + lexer: Java primary_extension: .uc VHDL: From 6e4e5e78add1dab1ab81d373c9a02961c9fed23e Mon Sep 17 00:00:00 2001 From: Ted Nyman Date: Sat, 16 Nov 2013 12:29:25 -0800 Subject: [PATCH 24/24] Regenerate samples.json --- lib/linguist/samples.json | 531 +++++++++++++++++++++++++++++++++++++- 1 file changed, 528 insertions(+), 3 deletions(-) diff --git a/lib/linguist/samples.json b/lib/linguist/samples.json index f7b0d2e1..ed8b4a33 100644 --- a/lib/linguist/samples.json +++ b/lib/linguist/samples.json @@ -216,6 +216,9 @@ "Nemerle": [ ".n" ], + "NetLogo": [ + ".nlogo" + ], "Nimrod": [ ".nim" ], @@ -377,6 +380,9 @@ "TypeScript": [ ".ts" ], + "UnrealScript": [ + ".uc" + ], "Verilog": [ ".v" ], @@ -471,8 +477,8 @@ ".gemrc" ] }, - "tokens_total": 420318, - "languages_total": 483, + "tokens_total": 423434, + "languages_total": 486, "tokens": { "ABAP": { "*/**": 1, @@ -28665,6 +28671,96 @@ "WriteLine": 1, "}": 2 }, + "NetLogo": { + "patches": 7, + "-": 28, + "own": 1, + "[": 17, + "living": 6, + ";": 12, + "indicates": 1, + "if": 2, + "the": 6, + "cell": 10, + "is": 1, + "live": 4, + "neighbors": 5, + "counts": 1, + "how": 1, + "many": 1, + "neighboring": 1, + "cells": 2, + "are": 1, + "alive": 1, + "]": 17, + "to": 6, + "setup": 2, + "blank": 1, + "clear": 2, + "all": 5, + "ask": 6, + "death": 5, + "reset": 2, + "ticks": 2, + "end": 6, + "random": 2, + "ifelse": 3, + "float": 1, + "<": 1, + "initial": 1, + "density": 1, + "birth": 4, + "set": 5, + "true": 1, + "pcolor": 2, + "fgcolor": 1, + "false": 1, + "bgcolor": 1, + "go": 1, + "count": 1, + "with": 2, + "Starting": 1, + "a": 1, + "new": 1, + "here": 1, + "ensures": 1, + "that": 1, + "finish": 1, + "executing": 2, + "first": 1, + "before": 1, + "any": 1, + "of": 2, + "them": 1, + "start": 1, + "second": 1, + "ask.": 1, + "This": 1, + "keeps": 1, + "in": 2, + "synch": 1, + "each": 2, + "other": 1, + "so": 1, + "births": 1, + "and": 1, + "deaths": 1, + "at": 1, + "generation": 1, + "happen": 1, + "lockstep.": 1, + "tick": 1, + "draw": 1, + "let": 1, + "erasing": 2, + "patch": 2, + "mouse": 5, + "xcor": 2, + "ycor": 2, + "while": 1, + "down": 1, + "display": 1 + }, "Nginx": { "user": 1, "www": 2, @@ -40508,6 +40604,431 @@ "tom.move": 1, "console.log": 1 }, + "UnrealScript": { + "//": 5, + "-": 220, + "class": 18, + "MutU2Weapons": 1, + "extends": 2, + "Mutator": 1, + "config": 18, + "(": 189, + "U2Weapons": 1, + ")": 189, + ";": 295, + "var": 30, + "string": 25, + "ReplacedWeaponClassNames0": 1, + "ReplacedWeaponClassNames1": 1, + "ReplacedWeaponClassNames2": 1, + "ReplacedWeaponClassNames3": 1, + "ReplacedWeaponClassNames4": 1, + "ReplacedWeaponClassNames5": 1, + "ReplacedWeaponClassNames6": 1, + "ReplacedWeaponClassNames7": 1, + "ReplacedWeaponClassNames8": 1, + "ReplacedWeaponClassNames9": 1, + "ReplacedWeaponClassNames10": 1, + "ReplacedWeaponClassNames11": 1, + "ReplacedWeaponClassNames12": 1, + "bool": 18, + "bConfigUseU2Weapon0": 1, + "bConfigUseU2Weapon1": 1, + "bConfigUseU2Weapon2": 1, + "bConfigUseU2Weapon3": 1, + "bConfigUseU2Weapon4": 1, + "bConfigUseU2Weapon5": 1, + "bConfigUseU2Weapon6": 1, + "bConfigUseU2Weapon7": 1, + "bConfigUseU2Weapon8": 1, + "bConfigUseU2Weapon9": 1, + "bConfigUseU2Weapon10": 1, + "bConfigUseU2Weapon11": 1, + "bConfigUseU2Weapon12": 1, + "//var": 8, + "byte": 4, + "bUseU2Weapon": 1, + "[": 125, + "]": 125, + "": 7, + "ReplacedWeaponClasses": 3, + "": 2, + "ReplacedWeaponPickupClasses": 1, + "": 3, + "ReplacedAmmoPickupClasses": 1, + "U2WeaponClasses": 2, + "//GE": 17, + "For": 3, + "default": 12, + "properties": 3, + "ONLY": 3, + "U2WeaponPickupClassNames": 1, + "U2AmmoPickupClassNames": 2, + "bIsVehicle": 4, + "bNotVehicle": 3, + "localized": 2, + "U2WeaponDisplayText": 1, + "U2WeaponDescText": 1, + "GUISelectOptions": 1, + "int": 10, + "FirePowerMode": 1, + "bExperimental": 3, + "bUseFieldGenerator": 2, + "bUseProximitySensor": 2, + "bIntegrateShieldReward": 2, + "IterationNum": 8, + "Weapons.Length": 1, + "const": 1, + "DamageMultiplier": 28, + "DamagePercentage": 3, + "bUseXMPFeel": 4, + "FlashbangModeString": 1, + "struct": 1, + "WeaponInfo": 2, + "{": 28, + "ReplacedWeaponClass": 1, + "Generated": 4, + "from": 6, + "ReplacedWeaponClassName.": 2, + "This": 3, + "is": 6, + "what": 1, + "we": 3, + "replace.": 1, + "ReplacedWeaponPickupClass": 1, + "UNUSED": 1, + "ReplacedAmmoPickupClass": 1, + "WeaponClass": 1, + "the": 31, + "weapon": 10, + "are": 1, + "going": 1, + "to": 4, + "put": 1, + "inside": 1, + "world.": 1, + "WeaponPickupClassName": 1, + "WeponClass.": 1, + "AmmoPickupClassName": 1, + "WeaponClass.": 1, + "bEnabled": 1, + "Structs": 1, + "can": 2, + "d": 1, + "thus": 1, + "still": 1, + "require": 1, + "bConfigUseU2WeaponX": 1, + "indicates": 1, + "that": 3, + "spawns": 1, + "a": 2, + "vehicle": 3, + "deployable": 1, + "turrets": 1, + ".": 2, + "These": 1, + "only": 2, + "work": 1, + "in": 4, + "gametypes": 1, + "duh.": 1, + "Opposite": 1, + "of": 1, + "works": 1, + "non": 1, + "gametypes.": 2, + "Think": 1, + "shotgun.": 1, + "}": 27, + "Weapons": 31, + "function": 5, + "PostBeginPlay": 1, + "local": 8, + "FireMode": 8, + "x": 65, + "//local": 3, + "ReplacedWeaponPickupClassName": 1, + "//IterationNum": 1, + "ArrayCount": 2, + "Level.Game.bAllowVehicles": 4, + "He": 1, + "he": 1, + "neat": 1, + "way": 1, + "get": 1, + "required": 1, + "number.": 1, + "for": 11, + "<": 9, + "+": 18, + ".bEnabled": 3, + "GetPropertyText": 5, + "needed": 1, + "use": 1, + "variables": 1, + "an": 1, + "array": 2, + "like": 1, + "fashion.": 1, + "//bUseU2Weapon": 1, + ".ReplacedWeaponClass": 5, + "DynamicLoadObject": 2, + "//ReplacedWeaponClasses": 1, + "//ReplacedWeaponPickupClassName": 1, + ".default.PickupClass": 1, + "if": 55, + ".ReplacedWeaponClass.default.FireModeClass": 4, + "None": 10, + "&&": 15, + ".default.AmmoClass": 1, + ".default.AmmoClass.default.PickupClass": 2, + ".ReplacedAmmoPickupClass": 2, + "break": 1, + ".WeaponClass": 7, + ".WeaponPickupClassName": 1, + ".WeaponClass.default.PickupClass": 1, + ".AmmoPickupClassName": 2, + ".bIsVehicle": 2, + ".bNotVehicle": 2, + "Super.PostBeginPlay": 1, + "ValidReplacement": 6, + "return": 47, + "CheckReplacement": 1, + "Actor": 1, + "Other": 23, + "out": 2, + "bSuperRelevant": 3, + "i": 12, + "WeaponLocker": 3, + "L": 2, + "xWeaponBase": 3, + ".WeaponType": 2, + "false": 3, + "true": 5, + "Weapon": 1, + "Other.IsA": 2, + "Other.Class": 2, + "Ammo": 1, + "ReplaceWith": 1, + "L.Weapons.Length": 1, + "L.Weapons": 2, + "//STARTING": 1, + "WEAPON": 1, + "xPawn": 6, + ".RequiredEquipment": 3, + "True": 2, + "Special": 1, + "handling": 1, + "Shield": 2, + "Reward": 2, + "integration": 1, + "ShieldPack": 7, + ".SetStaticMesh": 1, + "StaticMesh": 1, + ".Skins": 1, + "Shader": 2, + ".RepSkin": 1, + ".SetDrawScale": 1, + ".SetCollisionSize": 1, + ".PickupMessage": 1, + ".PickupSound": 1, + "Sound": 1, + "Super.CheckReplacement": 1, + "GetInventoryClassOverride": 1, + "InventoryClassName": 3, + "Super.GetInventoryClassOverride": 1, + "static": 2, + "FillPlayInfo": 1, + "PlayInfo": 3, + "": 1, + "Recs": 4, + "WeaponOptions": 17, + "Super.FillPlayInfo": 1, + ".static.GetWeaponList": 1, + "Recs.Length": 1, + ".ClassName": 1, + ".FriendlyName": 1, + "PlayInfo.AddSetting": 33, + "default.RulesGroup": 33, + "default.U2WeaponDisplayText": 33, + "event": 3, + "GetDescriptionText": 1, + "PropName": 35, + "default.U2WeaponDescText": 33, + "Super.GetDescriptionText": 1, + "PreBeginPlay": 1, + "float": 3, + "k": 29, + "Multiplier.": 1, + "Super.PreBeginPlay": 1, + "/100.0": 1, + "//log": 1, + "@k": 1, + "//Sets": 1, + "various": 1, + "settings": 1, + "match": 1, + "different": 1, + "games": 1, + ".default.DamagePercentage": 1, + "//Original": 1, + "U2": 3, + "compensate": 1, + "division": 1, + "errors": 1, + "Class": 105, + ".default.DamageMin": 12, + "*": 54, + ".default.DamageMax": 12, + ".default.Damage": 27, + ".default.myDamage": 4, + "//Dampened": 1, + "already": 1, + "no": 2, + "need": 1, + "rewrite": 1, + "else": 1, + "//General": 2, + "XMP": 4, + ".default.Spread": 1, + ".default.MaxAmmo": 7, + ".default.Speed": 8, + ".default.MomentumTransfer": 4, + ".default.ClipSize": 4, + ".default.FireLastReloadTime": 3, + ".default.DamageRadius": 4, + ".default.LifeSpan": 4, + ".default.ShakeRadius": 1, + ".default.ShakeMagnitude": 1, + ".default.MaxSpeed": 5, + ".default.FireRate": 3, + ".default.ReloadTime": 3, + "//3200": 1, + "too": 1, + "much": 1, + ".default.VehicleDamageScaling": 2, + "*k": 28, + "//Experimental": 1, + "options": 1, + "lets": 1, + "you": 2, + "Unuse": 1, + "EMPimp": 1, + "projectile": 1, + "and": 3, + "fire": 1, + "two": 1, + "CAR": 1, + "barrels": 1, + "//CAR": 1, + "nothing": 1, + "U2Weapons.U2AssaultRifleFire": 1, + "U2Weapons.U2AssaultRifleAltFire": 1, + "U2ProjectileConcussionGrenade": 1, + "U2Weapons.U2AssaultRifleInv": 1, + "U2Weapons.U2WeaponEnergyRifle": 1, + "U2Weapons.U2WeaponFlameThrower": 1, + "U2Weapons.U2WeaponPistol": 1, + "U2Weapons.U2AutoTurretDeploy": 1, + "U2Weapons.U2WeaponRocketLauncher": 1, + "U2Weapons.U2WeaponGrenadeLauncher": 1, + "U2Weapons.U2WeaponSniper": 2, + "U2Weapons.U2WeaponRocketTurret": 1, + "U2Weapons.U2WeaponLandMine": 1, + "U2Weapons.U2WeaponLaserTripMine": 1, + "U2Weapons.U2WeaponShotgun": 1, + "s": 7, + "Minigun.": 1, + "Enable": 5, + "Shock": 1, + "Lance": 1, + "Energy": 2, + "Rifle": 3, + "What": 7, + "should": 7, + "be": 8, + "replaced": 8, + "with": 9, + "Rifle.": 3, + "By": 7, + "it": 7, + "Bio": 1, + "Magnum": 2, + "Pistol": 1, + "Pistol.": 1, + "Onslaught": 1, + "Grenade": 1, + "Launcher.": 2, + "Shark": 2, + "Rocket": 4, + "Launcher": 1, + "Flak": 1, + "Cannon.": 1, + "Should": 1, + "Lightning": 1, + "Gun": 2, + "Widowmaker": 2, + "Sniper": 3, + "Classic": 1, + "here.": 1, + "Turret": 2, + "delpoyable": 1, + "deployable.": 1, + "Redeemer.": 1, + "Laser": 2, + "Trip": 2, + "Mine": 1, + "Mine.": 1, + "t": 2, + "replace": 1, + "Link": 1, + "matches": 1, + "vehicles.": 1, + "Crowd": 1, + "Pleaser": 1, + "Shotgun.": 1, + "have": 1, + "shields": 1, + "or": 2, + "damage": 1, + "filtering.": 1, + "If": 1, + "checked": 1, + "mutator": 1, + "produces": 1, + "Unreal": 4, + "II": 4, + "shield": 1, + "pickups.": 1, + "Choose": 1, + "between": 2, + "white": 1, + "overlay": 3, + "depending": 2, + "on": 2, + "player": 2, + "view": 1, + "style": 1, + "distance": 1, + "foolproof": 1, + "FM_DistanceBased": 1, + "Arena": 1, + "Add": 1, + "weapons": 1, + "other": 1, + "Fully": 1, + "customisable": 1, + "choose": 1, + "behaviour.": 1, + "US3HelloWorld": 1, + "GameInfo": 1, + "InitGame": 1, + "Options": 1, + "Error": 1, + "log": 1, + "defaultproperties": 1 + }, "Verilog": { "////////////////////////////////////////////////////////////////////////////////": 14, "//": 117, @@ -42879,6 +43400,7 @@ "Monkey": 207, "MoonScript": 1718, "Nemerle": 17, + "NetLogo": 243, "Nginx": 179, "Nimrod": 1, "NSIS": 725, @@ -42924,6 +43446,7 @@ "Turing": 44, "TXL": 213, "TypeScript": 109, + "UnrealScript": 2873, "Verilog": 3778, "VHDL": 42, "VimL": 20, @@ -43003,6 +43526,7 @@ "Monkey": 1, "MoonScript": 1, "Nemerle": 1, + "NetLogo": 1, "Nginx": 1, "Nimrod": 1, "NSIS": 2, @@ -43048,6 +43572,7 @@ "Turing": 1, "TXL": 1, "TypeScript": 3, + "UnrealScript": 2, "Verilog": 13, "VHDL": 1, "VimL": 2, @@ -43062,5 +43587,5 @@ "Xtend": 2, "YAML": 1 }, - "md5": "f407022fe8de91114d556ad933c9acc2" + "md5": "f5d636f1516c9c1a636654b1cf314eb0" } \ No newline at end of file