Homebrew, open source, repurposed, hacked, software defined, open hardware

Wednesday, 31 March 2021

How to play the Snake game on your PCB layout in pcb-rnd with a user script

This is a screen capture of a user script in pcb-rnd being used to play the classic game "snake" on the top copper layer of a compact step attenuator PCB layout...


 
The video of the snake game script demonstrates how a script written by the user can 
  • draw on the printed circuit board in real-time
  • receive keyboard commands
  • create menus, and
  • run a simple simulation
 
It implements the classic snake game, played on the currently selected layer group on the currently loaded board.
 
If the snake collides with itself or any copper feature, the game ends.
 
At the end of the video the snake is made to deliberately perform a 180 degree turn, which causes the snake to collide with its own body and end the game.

The video is a screen capture, and may have the odd broken frame, but in practice, the script ran smoothly, without artifacts on the screen and felt like a fully immersive, first person real-time snake experience!

To run this, you'll need
 
  • pcb-rnd 2.3.2 (or latest HEAD version of trunk from svn), and
  • game_snake from http://edakrill.repo.hu found at http://repo.hu/cgi-bin/edakrill.cgi?cmd=show&krill=igor2/script/pcb-rnd/game_snake.krill
 
Note: when loading as a live script, the 'persistent' checkbox must be activated. 

Disclaimer: the script is a demonstration of what is possible with user scripting -  it doesn't pretend to implement things that are useful in production but shows how the various scripting features of pcb-rnd can be used.

No comments:

Post a Comment