(save-name "tic-tac-toc-toe.scm")

(clear)

(desiredfps 30)
(show-fps 1)
(show-axis 0)

(define (grid0)
    (push)
    (scale (vector 0.33 0.33 0.33))
    (colour (vector 0 0 1 ))
    (opacity 0.33)
    (build-sphere 32 32)
    (pop)
)

(define (grid1 a)
    (grid0)
    (translate (vector 1 0 0))
    (if (< 1 a)
        (grid1 (- a 1))
    )
)

(define (grid2 a b)
    (push)
    (grid1 a)
    (pop)
    (translate (vector 0 1 0))
    (if (< 1 b)
        (grid2 a (- b 1))
    )
)

(define (grid3 a b c)
    (push)
    (grid2 a b)
    (pop)
    (translate (vector 0 0 1))
    (if (< 1 c)
        (grid3 a b (- c 1))
    )
)

(define (player1)
    (grab (mouse-over))
    (colour (vector 0 1 0))
    (opacity 1)
    (ungrab)
)

(define (player2)
    (grab (mouse-over))
    (colour (vector 1 0 0))
    (opacity 1)
    (ungrab)
)


(grid3 4 4 4)

(define (run-loop)
    (if (mouse-button 0)
        (player1)
        (player2)
    )
)

(every-frame "(run-loop)")


(start-framedump "test")
