Tuesday, April 21, 2009

John Conway's Game of Life in XAML/WPF using embedded Python

Daniel Paull has an implementation of John Conway's Game of Life (cellular automata) written with XAML/WPF (Windows Presentation Foundation - a Microsoft UI library built on top of DirectX) and using embedded Python scripts.
Following on from my series on embedding DLR scripts in XAML, I present an implementation of John Conway's Game of Life in XAML/WPF using embedded Python scripts. The game is loaded completely from loose XAML. Even the initial game state is defined in dynamically loaded XAML files!

The game is hosted in the very dynamic application described in a previous post.

The Game of Life is played by calculating successive generations of the board. We add a button to calculate the next generation. A simple implementation of the Game of Life is written in the Python script. The button's DataContext is bound to the board, allowing the script to retrieve the board from the button.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.