コード例 #1
0
 protected abstract void fillInCell(Cell currentCell, Cell cellAbove,
                                    Cell cellToLeft, Cell cellAboveLeft);
コード例 #2
0
        public void printScoreTable()
        {
            ensureTableIsFilledIn();
            for (int i = 0; i < sequence2.Length + 2; i++)
            {
                for (int j = 0; j < sequence1.Length + 2; j++)
                {
                    if (i == 0)
                    {
                        if (j == 0 || j == 1)
                        {
                            Console.Write("  ");
                        }
                        else
                        {
                            if (j == 2)
                            {
                                Console.Write("     ");
                            }
                            else
                            {
                                Console.Write("   ");
                            }
                            Console.Write(sequence1[j - 2]);
                        }
                    }
                    else if (j == 0)
                    {
                        if (i == 1)
                        {
                            Console.Write("  ");
                        }
                        else
                        {
                            Console.Write(" " + sequence2[i - 2]);
                        }
                    }
                    else
                    {
                        String toPrint;
                        Cell   currentCell = scoreTable[i - 1, j - 1];
                        Cell   prevCell    = currentCell.getPrevCell();
                        if (prevCell != null)
                        {
                            if (currentCell.getCol() == prevCell.getCol() + 1 &&
                                currentCell.getRow() == prevCell.getRow() + 1)
                            {
                                toPrint = "\\";
                            }
                            else if (currentCell.getCol() == prevCell.getCol() + 1)
                            {
                                toPrint = "-";
                            }
                            else
                            {
                                toPrint = "|";
                            }
                        }
                        else
                        {
                            toPrint = " ";
                        }
                        int    score = currentCell.getScore();
                        String s     = score.ToString().PadLeft(3, '0');
                        toPrint += s;
                        Console.Write(toPrint);
                    }

                    Console.Write(' ');
                }
                Console.WriteLine();
            }
        }