33 lines
1000 B
C#
33 lines
1000 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace GameModel
|
|
{
|
|
public record PinThrow(int PlayerId, PinPicture PicPicture, bool IsBell, bool IsSink)
|
|
{
|
|
public bool IsCircle => !IsSink && PicPicture.DownCount == 8 && (PicPicture[5] == PinState.Up);
|
|
|
|
public bool IsNinePins => !IsSink && PinCount == 9;
|
|
|
|
/// <summary>
|
|
/// Count of hit pins with this throw
|
|
/// </summary>
|
|
public int PinCount => IsSink ? 0 : PicPicture.DownCount;
|
|
|
|
public bool IsNoWood => PicPicture.DownCount == 0 && !IsSink;
|
|
|
|
public static PinThrow Create(int PlayerId, PinPicture PicPicture, bool IsBell, bool IsSink)
|
|
{
|
|
return new PinThrow(PlayerId, PicPicture, IsBell, IsSink);
|
|
}
|
|
|
|
public static PinThrow Create(PinPicture PicPicture, bool IsBell, bool IsSink)
|
|
{
|
|
return Create(1, PicPicture, IsBell, IsSink);
|
|
}
|
|
}
|
|
}
|