Example #1
0
    public ControlBlocks Execute(IMoveControlBlocksService moveService, int playerId, ControlBlocks controlBlocks)
    {
        var movedControlBlocks = moveService.Execute(controlBlocks);

        if (PutControlBlocksService.Execute(movedControlBlocks))
        {
            EraseLineService.Execute();
            if (Board.IsGameOver())
            {
                GameOverEvent.EmitGameOver();
            }
            else
            {
                var newControlBlocks = GetNextControlBlocksService.Execute(playerId);
                return(newControlBlocks);
            }
        }
        var adjustedControlBlocks = Adjuster.AdjustBlocksByPutBlocks(movedControlBlocks);

        ControlBlocksPresenter.ChangeControlBlocks(adjustedControlBlocks);
        return(adjustedControlBlocks);
    }