Example #1
0
        /// <summary>
        /// Places a tile in the specified cell, given coordinates.
        /// If the cell already contains a tile it will not place the new one.
        /// This method is custom for the use with the Scrabble Referee system.
        /// </summary>
        /// <param name="player">The player.</param>
        /// <param name="letter">The letter.</param>
        /// <param name="x">The x.</param>
        /// <param name="y">The y.</param>
        /// <param name="width">The width.</param>
        /// <param name="height">The height.</param>
        /// <param name="rect">The rect.</param>
        /// <remarks></remarks>
        public void PlaceTile(Player player, string letter, float x, float y, float width, float height, Rectangle rect)
        {
            Cell cell = GetCellAt(x, y, width, height);

            if (!cell.IsEmpty && cell.contents.IsPlaced) 
                return;

            if (!cell.IsEmpty && cell.contents.Rect.Width * cell.contents.Rect.Height > rect.Width * rect.Height) 
                return;

            Tile t = new Tile(letter, player);
            t.Rect = rect;
            cell.Place(t);
        }
Example #2
0
 /// <summary>
 /// Places a tile in the specified cell, given row and column.
 /// </summary>
 /// <param name="player">The player.</param>
 /// <param name="letter">The letter.</param>
 /// <param name="col">The col.</param>
 /// <param name="row">The row.</param>
 /// <remarks></remarks>
 public void PlaceTile(Player player, string letter, int col, int row)
 {
     Cell cell = Cells[col, row];
     cell.Place(new Tile(letter, player));
 }
Example #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Tile"/> struct.
 /// </summary>
 /// <param name="letter">The letter.</param>
 /// <param name="player">The player.</param>
 /// <remarks></remarks>
 public Tile(string letter, Player player)
 {
     this.letter = letter;
     this.points = TileBag.Points(letter);
     this.player = player;
     this.isPlaced = false;
     this.isHighlight = false;
     this.rect = new Rectangle(0, 0, 0, 0);
 }
Example #4
0
 /// <summary>
 /// Places a tile in the specified cell.
 /// </summary>
 /// <param name="player">The player.</param>
 /// <param name="letter">The letter.</param>
 /// <param name="cell">The cell.</param>
 /// <remarks></remarks>
 public void PlaceTile(Player player, string letter, Cell cell)
 {
     cell.Place(new Tile(letter, player));
 }
Example #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Word"/> class.
 /// </summary>
 /// <param name="player">The player.</param>
 /// <remarks></remarks>
 public Word(Player player)
 {
     this.player = player;
     cells = new List<Cell>();
     corrected = false;
 }