예제 #1
0
        /// <summary>
        /// Equals override
        /// </summary>
        /// <param name="obj">Object to compare</param>
        /// <returns>True if objects are the same</returns>
        public override bool Equals(object obj)
        {
            if (!(obj is TicTacToeImpl))
            {
                return(false);
            }

            TicTacToeImpl other = (TicTacToeImpl)obj;

            if (other.guidId.Equals(this.guidId))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #2
0
        /// <summary>
        /// Clone implementation
        /// </summary>
        public object Clone()
        {
            TicTacToeImpl resp = new TicTacToeImpl(Guid.Parse(this.guidId.ToString()));

            resp.Id      = this.Id;
            resp.players = new Dictionary <CellPlayer, Player>();

            if (players.Count > 0)
            {
                foreach (KeyValuePair <CellPlayer, Player> item in players)
                {
                    resp.players.Add(item.Key, (Player)item.Value.Clone());
                }
            }

            resp.grid = this.grid;

            return(resp);
        }