Loading ...
Sorry, an error occurred while loading the content.
 

Re: [netlogo-users] a problem

Expand Messages
  • Esther Verreau
    Hi Tatiana - In 3.1 agentsets are always in random order, so when you are reading in the data the order in which the patches set typeLU will always be
    Message 1 of 3 , Jul 31, 2006
      Hi Tatiana -

      In 3.1 agentsets are always in random order, so when you are reading in
      the data the order in which the patches set typeLU will always be
      different. if you need the patches to do something in order I suggest you
      do something like this:

      file-open "LU-town.txt"
      foreach sort patches
      [
      ask ? [ typeLU file-read ]
      ]
      file-close

      sort has been overloaded to sort patches from left to right top to bottom
      and turtles by who number.

      you can find more information about the transition between 3.0 and 3.1
      here:

      http://ccl.northwestern.edu/netlogo/docs/faq.html#31transition

      I hope this helps.

      esther

      >
      > ============
      >
      > to setup-patches
      > ask patches [
      > file-open "LU-town.txt"
      > set typeLU file-read
      > file-close
      > ]
      >
      > ask patches with [typeLU = 0] ; open space
      > [set pcolor white]
      > ask patches with [typeLU = 1] ; area under water
      > [set pcolor blue]
      > ask patches with [typeLU = 2] ; hotels
      > [set pcolor black]
      > ask patches with [typeLU = 3] ; other buildings
      > [set pcolor brown]
      > ask patches with [typeLU = 5] ; train station
      > [set pcolor green]
      >
      > end
      >
      >
      >
      >
      >
      >
      > Yahoo! Groups Links
      >
      >
      >
      >
      >
      >
      >
      >
    • Sudhira H S
      Hi, Just make these modifications given. Also check out the Grand Canyon model under Sample Models Earth Science Grand Canyon for reference. Regards,
      Message 2 of 3 , Jul 31, 2006
        Hi,

        Just make these modifications given. Also check out the Grand Canyon model under "Sample Models >> Earth Science >> Grand Canyon" for reference.

        Regards,
        Sudhira

        =====
        patches-own [  typeLU ]

        to setup-patches
           file-open "LU-town.txt"
             let patch-typeLU file-read  ;; note that you are using "let" instead of "set"
           file-close
         
          ( foreach sort patches patch-typeLU
                 [ set typeLU-of ?1 ?2 ] )

              ask patches with [typeLU = 0]      ; open space
                [set pcolor white]
              ask patches with [typeLU = 1]      ; area under water
                [set pcolor blue]
              ask patches with [typeLU = 2]      ; hotels
                [set pcolor black]
              ask patches with [typeLU = 3]      ; other buildings
                [set pcolor brown]
              ask patches with [typeLU = 5]      ; train station
                [set pcolor green]

        end



        On 7/31/06, Esenia <tatiana_f@...> wrote:
        Hello everybody,

        I am trying to read a map as an ASCII file in NetLogo 3.1.1 In version 3.0.2 everything worked perfect (when I used the standard way to work with maps as described in the discussion list). But after I have installed version 3.1.1 neither  file-read" works properly nor  set pcolor" for patches. The program just attaches values and colors at random. Please find my peace of code at the end of the message.
        Any ideas how to fix it and where might the problem rise from?
        Thank you in advance,

        Best regards,
        Tatiana



        ============

        to setup-patches
          ask patches [
            file-open "LU-town.txt "
             set typeLU file-read
           file-close
          ]

              ask patches with [typeLU = 0]      ; open space
                [set pcolor white]
              ask patches with [typeLU = 1]      ; area under water
                [set pcolor blue]
              ask patches with [typeLU = 2]      ; hotels
                [set pcolor black]
              ask patches with [typeLU = 3]      ; other buildings
                [set pcolor brown]
              ask patches with [typeLU = 5]      ; train station
                [set pcolor green]

        end

      Your message has been successfully submitted and would be delivered to recipients shortly.