-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathsecond.py~
More file actions
44 lines (30 loc) · 931 Bytes
/
second.py~
File metadata and controls
44 lines (30 loc) · 931 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import math
class Vector:
def __init__(self,vect):
self.vect = vect
def add(self,other):
for ind,val in enumerate(other):
self.vect[ind] = self.vect[ind] + val
class Vehicle:
def __init__(self,n,x,y):
brain = Perceptron(n,0.001)
self.location = [x,y]
self.velocity = [0,0]
self.acceleration = [0,0]
self.maxforce = 0.1
self.maxspeed = 4
def update():
def add(self,first,second):
summa = 0
for ind,val in enumerate(first):
summa += second[ind] + val
return summa
def scalar_mult(self,n,vector):
def limit(self,vector,limit):
if self.magnitude(vector) > limit:
self
def magnitude(self,vector):
summa = 0
for elem in vector:
summa += (elem**2)
return math.sqrt(summa)