Dimensional Quantities and Units

//get indexes of all open positions var openPositions = brd.Board .Zip(Enumerable.Range(0, 9), (mv, i) => Tuple.Create(mv, i)) //number all positions .Where(pr => pr.Item1 == GameBoard.Move.Sp) //get positions that are a space and place them in an array .Select(pr => pr.Item2).ToArray(); //randomly choose an open position from array of positions return new GameMove(player, openPositions[rng.Next(openPositions.Count())]); } public override string ToString() { return String.Format(" {0} at position {1}", player.ToString("G"), position); } }

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.