?? step.cs
字號:
namespace Skyiv.Ben.PushBox.Common
{
enum Direction { None, East, South, West, North } // 方向: 無 東 南 西 北
public enum Action { None, Create, Edit, Delete } // 設計: 無 創建 編輯 刪除
/// <summary>
/// 走法步驟
/// </summary>
struct Step
{
Direction direct; // 前進方向
bool isBox; // 是否推著箱子一起前進
bool isStop; // “撤銷”時是否停留
public Direction Direct { get { return direct; } }
public bool IsBox { get { return isBox; } }
public bool IsStop { get { return isStop; } }
public Step(Direction direct, bool isBox, bool isStop)
{
this.direct = direct;
this.isBox = isBox;
this.isStop = isStop;
}
// isBox isStop None East South West North
// A B C D E
// x F G H I J
// x K L M N O
// x x P Q R S T
public static implicit operator char(Step step)
{
char c = "ABCDE"[step.direct - Direction.None];
if (step.isBox) c = (char)(c + 5);
if (step.isStop) c = (char)(c + 10);
return c;
}
public static implicit operator Step(char c)
{
int n = c - 'A';
return new Step((Direction)(n % 5), (n % 10 >= 5), (n >= 10));
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -