public override void SetEnablePositions(ISituation situation, out Positions enableMovein, out Positions enableCapture) { enableCapture = new Positions(); enableMovein = new Positions(); Position aPos = this.Position.ShiftWestNorth(); Position bPos = this.Position.ShiftEastNorth(); Position cPos = this.Position.ShiftWestSouth(); Position dPos = this.Position.ShiftEastSouth(); if (aPos != Position.Empty) { Position.Shift(this.GameSide, situation, aPos.ShiftNorth(), enableMovein, enableCapture); Position.Shift(this.GameSide, situation, aPos.ShiftWest(), enableMovein, enableCapture); } if (bPos != Position.Empty) { Position.Shift(this.GameSide, situation, bPos.ShiftNorth(), enableMovein, enableCapture); Position.Shift(this.GameSide, situation, bPos.ShiftEast(), enableMovein, enableCapture); } if (cPos != Position.Empty) { Position.Shift(this.GameSide, situation, cPos.ShiftWest(), enableMovein, enableCapture); Position.Shift(this.GameSide, situation, cPos.ShiftSouth(), enableMovein, enableCapture); } if (dPos != Position.Empty) { Position.Shift(this.GameSide, situation, dPos.ShiftEast(), enableMovein, enableCapture); Position.Shift(this.GameSide, situation, dPos.ShiftSouth(), enableMovein, enableCapture); } }
/// <summary> /// 车的基本路线(即横平竖直) /// </summary> internal static void RookShift( Enums.GameSide side, ISituation situation, Position position, Positions moveInPs, Positions capturePs) { bool canContine = true; Position tgtPos = Position.Empty; canContine = true; tgtPos = position; while (canContine) { tgtPos = tgtPos.ShiftEast(); canContine = Position.Shift(side, situation, tgtPos, moveInPs, capturePs); } canContine = true; tgtPos = position; while (canContine) { tgtPos = tgtPos.ShiftSouth(); canContine = Position.Shift(side, situation, tgtPos, moveInPs, capturePs); } canContine = true; tgtPos = position; while (canContine) { tgtPos = tgtPos.ShiftWest(); canContine = Position.Shift(side, situation, tgtPos, moveInPs, capturePs); } canContine = true; tgtPos = position; while (canContine) { tgtPos = tgtPos.ShiftNorth(); canContine = Position.Shift(side, situation, tgtPos, moveInPs, capturePs); } }