-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.rkt
35 lines (27 loc) · 1.05 KB
/
main.rkt
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
#lang racket
(require "declarations.rkt")
(require "drawing-routine.rkt")
(require "testcases.rkt")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; singlestep :: (Particle) -> (Particle)
(define (singlestep particles)
(let* ([initialArea (bounding-box particles)]
[tree (buildTree initialArea particles)]
[forces (calcForces initialArea tree particles)])
(moveparticles particles forces)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;main will send the current vectors for printing
;calculate new vectors and recurse
;;main :: (Particle) -> Action
(define (main ps)
(define (main-helper ps i)
(cond [(> i iter) (display "Done")]
[else (let*
([ps-next (singlestep ps)])
(if (= (remainder iter drawtime) 0)
(begin
(draw-particles ps)
(main-helper ps-next (+ i 1)))
(main-helper ps-next (+ i 1))))]))
(main-helper ps 0))
(main testList2)