WPF Tic-Tac-Toe With Script.NET AI
Friday, April 4th, 2008Today I published a Sample game application featuring several ideas:- Windows Presentation Foundation (WPF) UI,- Script.NET language to provide AI,- Min-max algorithm for playing Tic-Tac-Toe.The purpose of the sample is to demonstrate Script.NET language as a part of more complex .NET application. These toy application implements two players (user and computer) Tic-Tac-Toe game.The design of example is preatty simple:UI interface was created with Visual Studio 2008 Express using WPF designer.The game’s logic (AI) is provided by external algorithm executed with Script.NET engine. This algorithm is implemented in AI.SDN file (this file should be located in the same dir as exe file).It may be modified and improved in certain way without recompiling the application. This may be a good excercise.The .NET application provides Script.NET Engine with reference to the UI interface, so it is able to modify a view state. It is implemented via single function SetPoint( index ). The example show interaction between .NET code and Script.NET engine via shared variables (references) and IInvokable interface.Prerequesties to run the application:- Windows XP or higher- .NET framework 2.0 and 3.5