
Introduction
Daadi (means ‘attack’ in Telugu Language) is an ancient strategy board game from India. It is also well known as Nine Men Morris or Mills in the western countries. This is a two player game.
This application is written in WPF and C# for a Windows 8 Desktop App.
Background
This is a game played by two members. Each player gets nine pawns. The goal is to form mills and knout out the opponent players pawns to reduce their count to two or block all the moves of the opponent.
Each player has 9 pawns which move among the available boards 24 spots.
The game starts with an empty board. The game starts by players placing their 9 pawns empty spots on the boards taking turns.
Once the all the pawns are placed on the board. Now the players take turns to move the pawns to the neighboring spots in an attempt to form a Mill. (A Mill is formed when three pawns of a same player are in a row on one of the board’s lines). On successful Mill formation, the player can remove an apposition player’s pawn from the board. A pawn once removed cannot be used again.
Players continue to play until the opponent pawn count reduced to 2 or blocking all the moves for the opponent player leaving him unable to play.
Screenshots


Using the code
On start, Main Window loads the Board intially and keeps track of location of each of the 24 spots on the board.
public MainWindow()
{
this.InitializeComponent();
Common.InstantiateMainWindow(this);
LoadBoard();
}
Player class that holds the details of a Player including score.
public class Player
{
public Player(int id, string name)
{
PlayerId = id;
PlayerName = name;
}
public int PlayerId;
public string PlayerName;
}
When a spot/pawn is selected, the following code handles all the rules and places/moves the pawn accordingly.
void PawnCanvas_MouseUp(object sender, MouseButtonEventArgs e)
{
Common.ShowMessage(string.Empty);
bool isPawnAvailable = IsPawnAvailable();
if (isPawnAvailable)
{
if (IsOccupied == false)
{
DisplaySelectUI(this);
Occupy(Common.CurrentPlayer);
}
}
else if (!isPawnAvailable)
{
if (IsOccupied == true)
{
if (Occupant.PlayerId == Common.CurrentPlayer.PlayerId) {
if (Common.SourcePawn == null)
{
Common.SourcePawn = this;
DisplaySelectUI(this);
if (PawnClicked != null)
PawnClicked(this, new PawnClickedEventArgs(null));
}
else if (Common.SourcePawn.Occupant.PlayerId == Common.CurrentPlayer.PlayerId)
{
Common.SourcePawn = this;
DisplaySelectUI(this);
}
}
else if (Common.SourcePawn != null) {
Common.ShowMessage("You can only move a pawn to an empty locataion.");
}
else {
Common.ShowMessage("Please select a " + GetPlayerPawnColor(Common.CurrentPlayer).ToString() + " Color pawn");
}
}
else
{
if (Common.SourcePawn != null) {
if (Common.IsNeighbor(Common.SourcePawn, this)) {
DisplaySelectUI(this);
Common.DestinationPawn = this;
Move();
}
else
{
Common.ShowMessage("You can only move a pawn to a neighboring location.");
}
}
else {
Common.ShowMessage("Please select a " + GetPlayerPawnColor(Common.CurrentPlayer).ToString() + " Color pawn");
}
}
}
}
public void Occupy(Player player)
{
Occupant = player;
if (Occupant.PlayerId == 1)
{
this.FillPawn(Common.PlayerAColor);
}
else
{
this.FillPawn(Common.PlayerBColor);
}
Common.CurrentPlayer = Common.SecondaryPlayer;
Common.SecondaryPlayer = Occupant;
if (PawnClicked != null)
PawnClicked(this, new PawnClickedEventArgs(Common.SecondaryPlayer));
}
public void Leave(Player player)
{
Occupant = null; ;
}
public void DisplaySelectUI(PawnUC myPawn)
{
foreach (UIElement element in Common.myMainWindow.myCanvas.Children)
{
if (element is PawnUC)
{
if ((PawnUC)element != myPawn)
{
((PawnUC)element).SelectedEllipse.Visibility = Visibility.Collapsed;
}
else
{
((PawnUC)element).SelectedEllipse.Visibility = Visibility.Visible;
}
}
}
}
public bool IsOccupied { get { return (Occupant != null); } }
public Player Occupant { get; private set;
private void Move()
{
if (Common.CurrentPlayer.PlayerId == 1)
{
Common.DestinationPawn.FillPawn(Common.PlayerAColor);
}
else
{
Common.DestinationPawn.FillPawn(Common.PlayerBColor);
}
Common.SourcePawn.FillPawn(Common.DefaultColor);
Common.SourcePawn = null;
Occupant = Common.CurrentPlayer;
Common.CurrentPlayer = Common.SecondaryPlayer;
Common.SecondaryPlayer = Occupant;
CheckForMills();
}
What's Next
- Validting the Mill formation, tracking the scores.
- Improving the User Interface.
- Adding the touch screen capatility.
- Animating the moves and more..
Points of Interest
When I was trying to find out more about ancient board games from India, I encounterd the following website. kreedaakaushalya.blogspot.in
It was very facinating to find out the history of various board games.
"Courtesy: Ramsons Kala Pratishtana. kreedaakaushalya.blogspot.in"