コード例 #1
0
ファイル: TurnLeft.cs プロジェクト: guyvdn/AdventOfCode2020
        public override void Execute(CurrentPosition currentPosition, WayPoint wayPoint)
        {
            var currentWayPoint = wayPoint.Clone();

            switch (Units)
            {
            case 90:
            {
                wayPoint.NorthSouth = -currentWayPoint.EastWest;
                wayPoint.EastWest   = currentWayPoint.NorthSouth;
                break;
            }

            case 180:
            {
                wayPoint.NorthSouth = -currentWayPoint.NorthSouth;
                wayPoint.EastWest   = -currentWayPoint.EastWest;
                break;
            }

            case 270:
            {
                wayPoint.NorthSouth = currentWayPoint.EastWest;
                wayPoint.EastWest   = -currentWayPoint.NorthSouth;
                break;
            }
            }
        }