# [closed] 3.22 - orientation 2

 1 1 I didn't get why N = 1000 p = [] for i in range(N): x = robot() x.set_noise(0.05, 0.05, 5.0) p.append(x)  Isn't part of the 'setup' section of the code. If this is run twice, doesn't it reset te values of 'p'? I thought you should run the code once (finish with an array of 'p'), and then run it again using the previous 'p' as a starting point. asked 06 Mar '12, 23:21 Gian Carlo M... 1.5k●2●19●48 accept rate: 30% Also, I tried creating a function that starts like this: def run_filter(): p2 = [] for i in range(N): p2.append(p[i].move(0.1, 5.0)) p = p2 I get an error: UnboundLocalError: local variable 'p' referenced before assignment This didn't make any sense to me. Isn't 'p' a global variable? (06 Mar '12, 23:24) Gian Carlo M...

### The question has been closed for the following reason "The question is answered, right answer was accepted" by Gian Carlo Martinelli 10 Mar '12, 20:10

 1 I was just watching the answer video to this quiz, and he specifically doesn't include this stuff in the loop. "This is all initialization over here so you shouldn't touch it..." as he circled his pen over that code. The move and sense function calls were moved below the initializations so they could be rerun along with finding p2, w and p3. answered 10 Mar '12, 00:07 Sandy Cannady 103●4 absolutelly right.... i feel stupid right now (10 Mar '12, 20:10) Gian Carlo M... Don't feel stupid. I coded it wrong, including the initialization in the loop :p We all make mistakes. The only stupid mistake is one you don't learn from. (10 Mar '12, 21:16) Sandy Cannady
 0 Same question here! Anyone? Additionally I would like to confirm: to I understand correctly that in current interpretation the robot does its first move, senses, does particle stuff and then for the next time step the robot does not move, but instead stops. The second loop can be interpreted as the sensing and particle loop that is done after the robot stopped moving? answered 09 Mar '12, 08:01 Roland Pihlakas 24●2●5
 0 bump? anyone? answered 09 Mar '12, 19:59 Gian Carlo M... 1.5k●2●19●48

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• image?![alt text](/path/img.jpg "Title")
• numbered list: 1. Foo 2. Bar
• to add a line break simply add two spaces to where you would like the new line to be.
• basic HTML tags are also supported

×5,188
×46
×12