Esempio n. 1
0
    private Seed winner(int position)
    {
        // Checks if we have a winner
        Seed winner = Seed.EMPTY;

        // Get current row and column.
        int row = getRow(position);
        int col = getCol(position);

        // Check if the row is complete
        if ((row == 0) && (Cells[0] == Cells[1] && Cells[1] == Cells[2]))
        {
            winner    = Cells[0];
            winnerBar = barType.ROW_1;
        }
        else if ((row == 1) && (Cells[3] == Cells[4] && Cells[4] == Cells[5]))
        {
            winner    = Cells[3];
            winnerBar = barType.ROW_2;
        }
        else if ((row == 2) && (Cells[6] == Cells[7] && Cells[7] == Cells[8]))
        {
            winner    = Cells[6];
            winnerBar = barType.ROW_3;
        }

        // Now check columns
        if ((col == 0) && (Cells[0] == Cells[3] && Cells[3] == Cells[6]))
        {
            winner    = Cells[0];
            winnerBar = barType.COL_1;
        }
        else if ((col == 1) && (Cells[1] == Cells[4] && Cells[4] == Cells[7]))
        {
            winner    = Cells[1];
            winnerBar = barType.COL_2;
        }
        else if ((col == 2) && (Cells[2] == Cells[5] && Cells[5] == Cells[8]))
        {
            winner    = Cells[2];
            winnerBar = barType.COL_3;
        }

        // Diagonals
        if ((position == 0 || position == 4 || position == 8) &&
            (Cells[0] == Cells[4]) && (Cells[4] == Cells[8]))
        {
            winner    = Cells[0];
            winnerBar = barType.DIAG_1;
        }
        else if ((position == 2 || position == 4 || position == 6) &&
                 (Cells[2] == Cells[4]) && (Cells[4] == Cells[6]))
        {
            winner    = Cells[2];
            winnerBar = barType.DIAG_2;
        }

        return(winner);
    }
Esempio n. 2
0
 : FailResult(barType, anomalyList, bars[0].Timestamp, bars[^ 1].Timestamp));
Esempio n. 3
0
 public historicalRequest(Contract contract, DateTime datetime, TimeSpan t1, TimeSpan t2, barType b, int i1, int i2)
 {
     this.contract = contract;
     this.datetime = datetime;
     this.t1       = t1;
     this.t2       = t2;
     this.b        = b;
     this.i1       = i1;
     this.i2       = i2;
 }
Esempio n. 4
0
 public request(Contract contract, DateTime endDatetime, TimeSpan duration, TimeSpan barSize, barType type, int useRTH, int formatDate)
 {
     this.contract    = contract;
     this.endDatetime = endDatetime;
     this.duration    = duration;
     this.barSize     = barSize;
     this.type        = type;
     this.useRTH      = useRTH;
     this.formatDate  = formatDate;
 }