Snake Game

17 views
Skip to first unread message

Tom Berend

unread,
Jan 2, 2025, 3:19:59 PMJan 2
to JSXGraph
Hi Friends,

A bit of fun to start the New Year... a Snake Game in JSXGraph.


Using JSXGraph as a game engine is delightful.  This game was constructed with only two points, a circle, and a curve.  We should be promoting JSXGraph for emerging programmers.

I also tried to write a robot player using simple heuristics.  But playing Snake is harder than it seems.

Murray

unread,
Jan 14, 2025, 2:29:23 AMJan 14
to JSXGraph
Hi Tom

When you first posted this on 3 Jan it ran fine, but I went to have another look at it just now and it has an error, so just presents a blank JSXGraph board.

Regards
Murray

Tom Berend

unread,
Jan 14, 2025, 6:11:20 AMJan 14
to JSXGraph
Sorry.  Try this link...   https://communityreading.org/jsxgraph/playground/?script=Q36WWNMW

In an earlier version of the wrapper, i had an overlap with the board method 'addgrid()' with the object instantiator 'create('grid'...) which is allowed to have no parameters.  Both should  give similar results.   The snake game was using the wrong one, I had intended the board method. 

I've changed a few things on the playground.  

Tom
Reply all
Reply to author
Forward
0 new messages