You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
1.0 KiB
47 lines
1.0 KiB
using MiniGames.Shared.Models;
|
|
|
|
namespace MiniGames.Client.ViewModel
|
|
{
|
|
public class TicTacToe : ITicTacToe
|
|
{
|
|
TicTacToeModel Model;
|
|
|
|
public TicTacToe(TicTacToeModel model)
|
|
{
|
|
this.Model = model;
|
|
}
|
|
|
|
public TicTacToeBrett Brett
|
|
{
|
|
get { return Model.Brett; }
|
|
set { Model.Brett = value; }
|
|
}
|
|
|
|
public int AktiverSpielerIndex
|
|
{
|
|
get { return Model.AktiverSpielerIndex; }
|
|
set { Model.AktiverSpielerIndex = value; }
|
|
}
|
|
|
|
public int GewinnerIndex
|
|
{
|
|
get { return Model.GewinnerIndex; }
|
|
set { Model.GewinnerIndex = value; }
|
|
}
|
|
|
|
public void SpielerInput(int posIndex)
|
|
{
|
|
if (Brett.Set(posIndex, AktiverSpielerIndex))
|
|
{
|
|
SpielerWechsel();
|
|
}
|
|
|
|
GewinnerIndex = Brett.Gewinner();
|
|
}
|
|
|
|
public void SpielerWechsel()
|
|
{
|
|
AktiverSpielerIndex = 1 - AktiverSpielerIndex;
|
|
}
|
|
}
|
|
}
|