From 653e88990edfddc012e247a10e78e5093ed7f8c5 Mon Sep 17 00:00:00 2001
From: Velaga Abijith <cb.en.u4cse16260@cb.students.amrita.edu>
Date: Wed, 2 Jan 2019 13:03:52 +0530
Subject: [PATCH] creation of the maze

---
 cse16260_ex4_q1.py | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)
 create mode 100644 cse16260_ex4_q1.py

diff --git a/cse16260_ex4_q1.py b/cse16260_ex4_q1.py
new file mode 100644
index 0000000..34226ee
--- /dev/null
+++ b/cse16260_ex4_q1.py
@@ -0,0 +1,36 @@
+from vpython import *
+#GlowScript 2.7 VPython
+ball = sphere(pos=vector(-5,0,0), radius=0.5,
+ color=color.cyan, make_trail=True)
+wallR = box(pos=vector(6,0,0), size=vector(0.2,12,12), color=color.green)
+wallL = box(pos=vector(-6,0,0), size=vector(0.2,12,12), color=color.green)
+wallU = box(pos=vector(0,6,0), size=vector(12,0.2,12), color=color.green)
+wallD = box(pos=vector(0,-6,0), size=vector(12,0.2,12), color=color.green)
+wallB = box(pos=vector(0,0,-6), size=vector(12,12,0.2), color=color.green)
+#wallF = box(pos=vector(0,0,6), size=vector(12,12,0.2), color=color.green)
+
+
+ball.velocity = vector(25,5,10)
+deltat = 0.005
+t = 0
+ev=scene.waitfor('keydown')
+
+ball.pos = ball.pos + ball.velocity*deltat
+vscale = 0.1
+varr = arrow(pos=ball.pos, axis=vscale*ball.velocity, color=color.yellow) 
+#scene.autoscale = False 
+while t < 3:
+ rate(100)
+ if ball.pos.x > wallR.pos.x or ball.pos.x<wallL.pos.x:
+    ball.velocity.x = -ball.velocity.x
+ if ball.pos.y > wallU.pos.y or ball.pos.y<wallD.pos.y:
+    ball.velocity.y = -ball.velocity.y
+ if ball.pos.z<wallB.pos.z:
+    ball.velocity.z = -ball.velocity.z
+ ball.pos = ball.pos + ball.velocity*deltat
+ varr.axis=vscale*ball.velocity
+ varr.pos=ball.pos
+ t = t + deltat 
+
+
+
-- 
GitLab