/// <summary>
 /// return the String representation of a mark
 /// </summary>
 /// <param name="c">mark</param>
 /// <returns>String</returns>
 public static string ToString(mark c)
 {
     switch (c)
     {
         case mark.PLUS: return "+";
         case mark.MINUS: return "-";
         case mark.HASH: return "#";
         default : throw new Exception("Unexpected mark type");
     }
 }
Ejemplo n.º 2
0
        private void материToolStripMenuItem_Click(object sender, EventArgs e)
        {
            mark addForm1 = new mark();

            addForm1.ShowDialog(this);
        }
Ejemplo n.º 3
0
 public bool CheckForWin(mark who)
 {
     //check rows & cols
     for (int i = 0, l = gridSize; i < l; i++)
     {
         int rowCounter = 0, colCounter = 0;
         for (int j = 0; j < l; j++)
         {
             if (grid[i, j] == who)
             {
                 rowCounter++;
             }
             else
             {
                 rowCounter = 0;
             }
             if (grid[j, i] == who)
             {
                 colCounter++;
             }
             else
             {
                 colCounter = 0;
             }
             if (rowCounter >= winCondition || colCounter >= winCondition)
             {
                 return(true);
             }
         }
     }
     //diagonals
     for (int i, j, row = winCondition - 1, col = 0, l = gridSize; //from bottom left corner
          col <= l - winCondition;)
     {
         i = row;
         j = col;
         int counter = 0;
         while (i >= 0 && j < l)
         {
             if (grid[i--, j++] == who)
             {
                 counter++;
             }
             else
             {
                 counter = 0;
             }
             if (counter >= winCondition)
             {
                 return(true);
             }
         }
         if (row < l - 1)
         {
             row++;
         }
         else
         {
             col++;
         }
     }
     for (int i, j, l = gridSize, row = l - winCondition, col = 0; //from top left corner
          col <= l - winCondition;)
     {
         i = row;
         j = col;
         int counter = 0;
         while (i < l && j < l)
         {
             if (grid[i++, j++] == who)
             {
                 counter++;
             }
             else
             {
                 counter = 0;
             }
             if (counter >= winCondition)
             {
                 return(true);
             }
         }
         if (row > 0)
         {
             row--;
         }
         else
         {
             col++;
         }
     }
     return(false);
 }
Ejemplo n.º 4
0
 public bool insertuserandmarks(marks_users insertMarks)
 {
     onlinetestingEntities4 tests = new onlinetestingEntities4();
     mark newuser = new mark();
     newuser.id = insertMarks.ID;
     newuser.test_id = insertMarks.Test_ID;
     newuser.Name = insertMarks.Name;
     newuser.Email = insertMarks.Email;
     newuser.sch_colg = insertMarks.School_Colg;
     newuser.obtained_marks = insertMarks.Obtained_Marks;
     tests.marks.Add(newuser);
     tests.SaveChanges();
     return true;
 }