Exemple #1
0
        /// <summary>
        /// 删除
        /// </summary>
        public override void EntityDelete()
        {
            BoardRule rule   = new BoardRule();
            Board     entity = EntityGet();

            rule.RDelete(entity);
        }
Exemple #2
0
        /// <summary>
        /// 绑定Grid
        /// </summary>
        public override void BindGrid()
        {
            BoardRule rule = new BoardRule();

            gridView1.GridControl.DataSource = rule.RShow(HTDataConditionStr, ProcessGrid.GetQueryField(gridView1));
            gridView1.GridControl.Show();
        }
Exemple #3
0
        /// <summary>
        /// 新增
        /// </summary>
        public override int EntityAdd()
        {
            BoardRule rule   = new BoardRule();
            Board     entity = EntityGet();

            rule.RAdd(entity);
            return(entity.ID);
        }
Exemple #4
0
        public void StartGame()
        {
            string caseSensitiveCommands = ConfigurationManager.AppSettings["caseSensitiveCommands"];
            string commandFile           = ConfigurationManager.AppSettings["commandFile"];
            bool   caseSensitiveCommand  = Convert.ToBoolean(caseSensitiveCommands);



            IToy            toy                     = new Robot();
            IInputCommand   inputCommands           = new TextFileInputCommand(commandFile);
            IList <string>  inputCommandString      = inputCommands.GetInputCommands();
            IBoard          board                   = new BoardImpl(4, 4); // Max x = 4(inclusive), max y = 4 (Inclusive)
            IBoardRule      boardRule               = new BoardRule();
            IGameRule       placeAsFirstCommandRule = new PlaceAsFirstCommandRule();
            List <ICommand> inputCommand            = new List <ICommand>();

            foreach (var item in inputCommandString)
            {
                inputCommand.Add(CommandService.Execute(item, caseSensitiveCommand));
            }
            IList <ICommand> commandsToExecute = placeAsFirstCommandRule.GetCommandsToExecute(inputCommand);

            foreach (var cmd in commandsToExecute)
            {
                IPosition pos       = cmd.Execute(toy);
                string    error_msg = string.Empty;
                if (boardRule.IsValidPosition(pos, board, out error_msg) == true)
                {
                    toy.UpdateToNewPosition(pos);
                }
                else
                {
                    // The error_msg will give details
                    // No updates to toy position or facing direction
                }
            }
        }
 public ThermometerBoardSet(BoardRule rules)
 {
     this.Rules        = rules;
     this.Thermometers = new List <Thermometer>();
 }
Exemple #6
0
 public UniqueValuesAreaBoardSet(BoardRule rules)
 {
     this.Rules = rules;
     this.Areas = new List <UniqueValuesArea>();
 }