418383/418587 ภาคปลาย 2553/คะแนนการบ้าน 1

จาก Theory Wiki
ไปยังการนำทาง ไปยังการค้นหา

คะแนน

คนที่ไม่ได้ 0 คะแนน

  • 47180278 ได้ 90 คะแนน
    • +10 (ระบบเสียง)
    • -10 (ส่งงานไม่สมบูรณ์ ไม่มีไฟล์ .sln และคอมไพล์ไม่ได้)
    • -5 (แสดงเวลาเป็น msec แทนที่จะแสดงเป็นนาที/วินาที)
    • -5 (ไม่มี background ใน Tetris board)
  • 51180198 ได้ 110 คะแนน
    • +10 (ระบบเสียง)
  • 51180248 ได้ 105 คะแนน
    • +10 (ระบบเสียง)
    • -5 (เช็คเลเวลไม่ถูกต้อง)
  • 5210400425 ได้ 95 คะแนน
    • -5 (เช็คเลเวลไม่ถูกต้อง)
  • 5210400514 ได้ 85 คะแนน
    • -5 (ไม่แสดง high score เวลา game over)
    • -5 (แสดงเวลาเป็นวินาที แทนที่จะเป็นนาที/วินาที)
    • -5 (ไม่มี background ใน Tetris board)

คนที่ได้ 0 คะแนนเพราะลอกเพื่อนหรือให้เพื่อนลอก

  • 51180537
  • 51180628
  • 51180644
  • 51180727
  • 5210400433
  • 5210404803
  • 5210404889
  • 5210404897
  • 5210405036
  • 5210450040
  • 5210450058
  • 5210450104
  • 5210450147
  • 5210450562
  • 5210450597
  • 5210450937


การลอกกันที่ผมจับได้

โค้ดอ่านไฟล์ใน PlayScreen.cs (Pattern 1)

51180537 51180628 51180644 51180727

<geshi lang="C#">

                           string[] score2 = new string[10];
                           StreamReader sr = new StreamReader("Score.txt");
                           int i = 0;
                           string str;
                           while ((str = sr.ReadLine()) != null)
                           {
                               score2[i] = str;
                               i++;
                           }
                           sr.Close();


                           for (i = 0; i < 10; i++)
                           {


                               if (scoreNumLabel.Text.CompareTo(score2[i]) > 0)
                               {
                                   for (int j = 10 - 1; j > i; j--)
                                       score2[j] = score2[j - 1];
                                   score2[i] = scoreNumLabel.Text;
                                   break;
                               }
                           }
                           var writer = new StreamWriter("Score.txt");
                           for (i = 0; i < 10; i++)
                               writer.WriteLine(score2[i]);
                           writer.Close();

</geshi>

<geshi lang="C#">

                           string[] s2 = new string[10];
                           StreamReader sr = new StreamReader("lvscore.txt");
                           int i = 0;
                           string str;
                           while ((str = sr.ReadLine()) != null)
                           {
                               s2[i] = str;
                               i++;
                           }
                           sr.Close();
                           for (i = 0; i < 10; i++)
                           {
                               if (scoreNumLabel.Text.CompareTo(s2[i]) > 0)
                               {
                                   for (int j = 10 - 1; j > i; j--)
                                       s2[j] = s2[j - 1];
                                   s2[i] = scoreNumLabel.Text;
                                   break;
                               }
                           }
                           var writer = new StreamWriter("lvscore.txt");
                           for (i = 0; i < 10; i++)
                               writer.WriteLine(s2[i]);
                           writer.Close();

</geshi>

<geshi lang="C#">

                          int[] score2 = new int[10] ;
                           lvcount = 1000;
                           lvup = 1;
                           var write = new StreamWriter("last.txt");
                        
                               write.WriteLine(score);
                           write.Close();
                           StreamReader sr = new StreamReader("data.txt");
                           int i = 0;
                           string str;
                           while ((str = sr.ReadLine()) != null)
                           {
                               score2[i] = int.Parse(str) ;
                               i++;
                           }
                           sr.Close();
                 
                       
                           for (i = 0; i < 10; i++)
                           {
                              
                               if (score>=score2[i])
                               {
                                   for (int j = 10 - 1; j > i; j--)
                                       score2[j] = score2[j - 1];
                                   score2[i] = score;
                                   break;
                               }
                           }
                           var writer = new StreamWriter("data.txt");
                           for (i = 0; i < 10; i++)
                               writer.WriteLine(score2[i]);
                           writer.Close();

</geshi>

<geshi lang="C#">

                           string[] time2 = new string[10];
                           StreamReader sr = new StreamReader("data.txt");
                           int i = 0;
                           string str;
                           while ((str = sr.ReadLine()) != null)
                           {
                               time2[i] = str;
                               i++;
                           }
                           sr.Close();


                           for (i = 0; i < 10; i++)
                           {


                               if (scoreNumLabel.Text.CompareTo(time2[i]) > 0)
                               {
                                   for (int j = 10 - 1; j > i; j--)
                                       time2[j] = time2[j - 1];
                                   time2[i] = scoreNumLabel.Text;
                                   break;
                               }
                           }
                           var writer = new StreamWriter("data.txt");
                           for (i = 0; i < 10; i++)
                               writer.WriteLine(time2[i]);
                           writer.Close();

</geshi>

โค้ดอ่านไฟล์ใน PlayScreen.cs (Pattern 2)

5210400433 521040889 521040897

<geshi lang="C#">

                           int i = 10, j;
                           StreamReader streamReader = new StreamReader("high-scores.txt");
                           string text = streamReader.ReadToEnd();
                           string[] scores = text.Split('\n');
                           int NowScore = int.Parse(scores[i]);
                           while ((score > NowScore) && (i > 0))
                           {
                               i--;
                               if (i > 0)
                                   NowScore = int.Parse(scores[i]);
                           }
                           for (j = 10; j > i + 1; j--)
                           {
                               scores[j] = scores[j - 1];
                               while (scores[j].Length < 6)
                                   scores[j] = "0" + scores[j];
                           }
                           if (i < 10)
                           {
                               scores[j] = score.ToString();
                               while (scores[j].Length < 6)
                                   scores[j] = "0" + scores[j];
                           }
                           streamReader.Close();
                           StreamWriter streamWriter = new StreamWriter("high-scores.txt");
                           for (i = 0; i < 11; i++) streamWriter.WriteLine(scores[i]);
                           streamWriter.Close();

</geshi>

<geshi lang="C#">

                           //////////////////////High Scores [Condition3]///////////////////////////////
                           /////////////// Read File //////////////
                           int i = 10, j;
                           StreamReader streamReader = new StreamReader("high-scores.txt");
                           string text = streamReader.ReadToEnd();
                           string[] scores = text.Split('\n');
                           int NowScore = int.Parse(scores[i]);
                           while ((score > NowScore) && (i > 0))
                           {
                               i--;
                               if (i > 0) 
                                   NowScore = int.Parse(scores[i]);
                           }
                           for (j = 10; j > i + 1; j--)
                           {
                               scores[j] = scores[j - 1];
                               while (scores[j].Length < 6) 
                                     scores[j] = "0" + scores[j];
                           }
                           if (i < 10)
                           {
                               scores[j] = score.ToString();
                               while (scores[j].Length < 6) 
                                     scores[j] = "0" + scores[j];
                           }
                           streamReader.Close();
                           
                           ////////Write New Record/////////
                           StreamWriter streamWriter = new StreamWriter("high-scores.txt");
                           for (i = 0; i < 11; i++) streamWriter.WriteLine(scores[i]);
                           streamWriter.Close();
                           ///////////////

</geshi>

<geshi lang="C#"> int i=10,j;

                           StreamReader streamReader = new StreamReader("../../../../TetrisContent/high-scores.txt");
                           string text = streamReader.ReadToEnd();
                           string[] scores = text.Split('\n');
                           int nowScore = int.Parse(scores[i]);
                           while((score > nowScore)&&(i>0))
                           {
                               i--;
                               if(i>0)nowScore = int.Parse(scores[i]);
                           }
                           for (j = 10; j > i+1; j--)
                           {
                               scores[j] = scores[j - 1];
                               while (scores[j].Length < 6) scores[j] = "0" + scores[j];
                           }
                           if (i < 10)
                           {
                               scores[j] = score.ToString();
                               while (scores[j].Length < 6) scores[j] = "0" + scores[j];
                           }
                           streamReader.Close();
                           StreamWriter streamWriter = new StreamWriter("../../../../TetrisContent/high-scores.txt");
                           for (i = 0; i < 22; i++) streamWriter.WriteLine(scores[i]);
                           streamWriter.Close();
                           Game.SwitchScreen("GameOverPlay");

</geshi>

โค้ดอ่านไฟล์ที่ถูกเอาไปใส่ใน GameLib (Pattern 1)

5210404803 5210405036

<geshi lang="C#">

   public class ReadWrite
   {
       public static string[] readAll()
       {   TextWriter tw;
           TextReader tr;
           string[] score = new string[20];
           try
           {
               tr = new StreamReader("high.txt");
           }
           catch
           {
               tw = new StreamWriter("high.txt");
               tw.WriteLine("nomal");
               for (int i = 0; i < 10;i++ )
                   tw.WriteLine("0");
               tw.WriteLine("time");
               for (int i = 0; i < 10; i++)
                   tw.WriteLine(int.MaxValue);
               tw.Close();
               tr = new StreamReader("high.txt");
           }
           tr.ReadLine();
           for(int i = 0;i<10;i++)
           {
              
               score[i] = tr.ReadLine();
           }
           tr.ReadLine();
           for (int i = 10; i < 20; i++)
           {
               score[i] = tr.ReadLine();
           }
           
           tr.Close();
           return score;
       }
       public static bool IsNormalTopTen(int score)
       {
           string[] scoretime = readAll();
           for (int i = 0; i < 10;i++ )
           {
               if (score > int.Parse(scoretime[i]))
                       return true;
           } 
           return false;
       }

</geshi>

<geshi lang="C#">

   public class CalScore
   {
       public static string[] readAll()
       {
           StreamWriter stw;
           StreamReader str;
           string[] score = new string[20];
           try
           {
               str = new StreamReader("high-scores.txt");
           }
           catch
           {
               stw = new StreamWriter("high-scores.txt");
               
               stw.WriteLine("nomal");
               
               for (int i = 0; i < 10; i++)
               {
                   stw.WriteLine("00000");
               }
               
               stw.WriteLine("time");
               
               for (int i = 0; i < 10; i++)
               {
                   stw.WriteLine(59940);
               }
               stw.Close();
               
               str = new StreamReader("high-scores.txt");
           }
           str.ReadLine();
           
           for (int i = 0; i < 10; i++)
           {
               score[i] = str.ReadLine();
           }
           str.ReadLine();
           
           for (int i = 10; i < 20; i++)
           {
               score[i] = str.ReadLine();
           }
           str.Close();
           
           return score;
       }
       public static bool IsNormalTopTen(int score)
       {
           string[] scoretime = readAll();
           
           for (int i = 0; i < 10; i++)
           {
               if (score > int.Parse(scoretime[i]))
                   return true;
           }
           return false;
       }

</geshi>

โค้ดอ่านไฟล์ที่ถูกเอาไปใส่ใน GameLib (Pattern 2)

5210450562 5210450040 5210450058 5210450104 5210450597 5210450937 5210450147

<geshi lang="C#">

           public HighScore()
           {
           }
           string mydocpath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
       
           StringBuilder sb = new StringBuilder();
       
           public void sortPlayScore(string nowScore,string name)
           {
               sb.Clear();
               List<int> scoreSort = new List<int>();
               List<string> score = new List<string>();
               List<string> time = new List<string>();
               string path = mydocpath + @"\High-Scores.Zilo";
               score.Clear();
               score = read();
               if (name == "play")
               {
                   scoreSort.Add(Convert.ToInt32(nowScore));
               
                   for (int i = 0; i < 10; i++)
                   {
                       scoreSort.Add(Convert.ToInt32(score[i]));
                   }
                   scoreSort.Sort();
                   for (int i = 9; i >= 0; i--)
                   {
                       score[9 - i] = GetNumStringWithLeadingZeros(scoreSort[i + 1]);
                   }
               }
               else
               {
                   if (nowScore == "--:--:--")
                       nowScore = "99:99:99";
                   time.Add(nowScore);
               
                   for (int i = 10; i < 20; i++)
                   {
                       time.Add(score[i]);
                   }
                   time.Sort();
                   for (int i = 10; i < 20; i++)
                   {
                       score[i] = time[i - 10];
                   }
               }
           
           
               using (StreamWriter outfile = new StreamWriter(path))
               {
                   for (int i = 0; i < 20; i++)
                   {
                       sb.AppendLine(score[i]);
                   }
                   if (nowScore == "99:99:99")
                       nowScore = "--:--:--";
               
                   sb.AppendLine(nowScore);
                   outfile.Write(sb.ToString());
               }
          
           }

</geshi>

<geshi lang="C#">

           public HighScore()
           {
           }
           string mydocpath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
       
           StringBuilder sb = new StringBuilder();
       
           public void sortPlayScore(string nowScore,string name)
           {
               sb.Clear();
               List<int> scoreSort = new List<int>();
               List<string> score = new List<string>();
               List<string> time = new List<string>();
               string path = mydocpath + @"Hi-Score.tetris";
               // Score by Bank_Zilo
               score.Clear();
               score = read();
               if (name == "play")
               {
                   scoreSort.Add(Convert.ToInt32(nowScore));
               
                   for (int i = 0; i < 10; i++)
                   {
                       scoreSort.Add(Convert.ToInt32(score[i]));
                   }
                   scoreSort.Sort();
                   for (int i = 9; i >= 0; i--)
                   {
                       score[9 - i] = GetNumStringWithLeadingZeros(scoreSort[i + 1]);
                   }
               }
               else
               {
                   if (nowScore == "--:--:--")
                       nowScore = "99:99:99";
                   time.Add(nowScore);
               
                   for (int i = 10; i < 20; i++)
                   {
                       time.Add(score[i]);
                   }
                   time.Sort();
                   for (int i = 10; i < 20; i++)
                   {
                       score[i] = time[i - 10];
                   }
               }
           
           
               using (StreamWriter outfile = new StreamWriter(path))
               {
                   for (int i = 0; i < 20; i++)
                   {
                       sb.AppendLine(score[i]);
                   }
                   if (nowScore == "99:99:99")
                       nowScore = "--:--:--";
               
                   sb.AppendLine(nowScore);
                   outfile.Write(sb.ToString());
               }
          
           }

</geshi>

<geshi lang="C#">

       public HighScore()
       {
       }
       string mydocpath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
       StringBuilder sb = new StringBuilder();


       public void sortPlayScore(string nowScore, string name)
       {
           sb.Clear();
           List<int> scoreSort = new List<int>();
           List<string> score = new List<string>();
           List<string> time = new List<string>();
           string path = mydocpath + @"\High-Scores.Beatrix";
           score.Clear();
           score = read();
           if (name == "play")
           {
               scoreSort.Add(Convert.ToInt32(nowScore));
               for (int i = 0; i < 10; i++)
               {
                   scoreSort.Add(Convert.ToInt32(score[i]));
               }
               scoreSort.Sort();
               for (int i = 9; i >= 0; i--)
               {
                   score[9 - i] = GetNumStringWithLeadingZeros(scoreSort[i + 1]);
               }
           }
           else
           {
               if (nowScore == "--:--:--")
                   nowScore = "99:99:99";
               time.Add(nowScore);
               for (int i = 10; i < 20; i++)
               {
                   time.Add(score[i]);
               }
               time.Sort();
               for (int i = 10; i < 20; i++)
               {
                   score[i] = time[i - 10];
               }
           }


           using (StreamWriter outfile = new StreamWriter(path))
           {
               for (int i = 0; i < 20; i++)
               {
                   sb.AppendLine(score[i]);
               }
               if (nowScore == "99:99:99")
                   nowScore = "--:--:--";
               sb.AppendLine(nowScore);
               outfile.Write(sb.ToString());
           }
       }

</geshi>

<geshi lang="C#">

       public HighScore()
       {
       }
       string workpath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
       StringBuilder sb = new StringBuilder();


       public void sortPlayScore(string nowScore, string name)
       {
           sb.Clear();
           List<int> scoreSort = new List<int>();
           List<string> score = new List<string>();
           List<string> time = new List<string>();
           string path = workpath + @"\High-Scores.Zilo";
           score.Clear();
           score = getscore();
           if (name == "play")
           {
               scoreSort.Add(Convert.ToInt32(nowScore));
               for (int i = 0; i < 10; i++)
               {
                   scoreSort.Add(Convert.ToInt32(score[i]));
               }
               scoreSort.Sort();
               for (int i = 9; i >= 0; i--)
               {
                   score[9 - i] = GetNum(scoreSort[i + 1]);
               }
           }
           else
           {
               if (nowScore == "--:--:--")
                   nowScore = "99:99:99";
               time.Add(nowScore);
               for (int i = 10; i < 20; i++)
               {
                   time.Add(score[i]);
               }
               time.Sort();
               for (int i = 10; i < 20; i++)
               {
                   score[i] = time[i - 10];
               }
           }


           using (StreamWriter outfile = new StreamWriter(path))
           {
               for (int i = 0; i < 20; i++)
               {
                   sb.AppendLine(score[i]);
               }
               if (nowScore == "99:99:99")
                   nowScore = "--:--:--";
               sb.AppendLine(nowScore);
               outfile.Write(sb.ToString());
           }
       }

</geshi>

<geshi lang="C#">

       public HighScore()
       {
       }
       string mydocpath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
       StringBuilder sb = new StringBuilder();


       public void sortPlayScore(string nowScore, string name)
       {
           sb.Clear();
           List<int> scoreSort = new List<int>();
           List<string> score = new List<string>();
           List<string> time = new List<string>();
           string path = mydocpath + @"\High-Scores.dan";
           score.Clear();
           score = read();
           if (name == "play")
           {
               scoreSort.Add(Convert.ToInt32(nowScore));
               for (int i = 0; i < 10; i++)
               {
                   scoreSort.Add(Convert.ToInt32(score[i]));
               }
               scoreSort.Sort();
               for (int i = 9; i >= 0; i--)
               {
                   score[9 - i] = GetNumStringWithLeadingZeros(scoreSort[i + 1]);
               }
           }
           else
           {
               if (nowScore == "--:--:--")
                   nowScore = "99:99:99";
               time.Add(nowScore);
               for (int i = 10; i < 20; i++)
               {
                   time.Add(score[i]);
               }
               time.Sort();
               for (int i = 10; i < 20; i++)
               {
                   score[i] = time[i - 10];
               }
           }


           using (StreamWriter outfile = new StreamWriter(path))
           {
               for (int i = 0; i < 20; i++)
               {
                   sb.AppendLine(score[i]);
               }
               if (nowScore == "99:99:99")
                   nowScore = "--:--:--";
               sb.AppendLine(nowScore);
               outfile.Write(sb.ToString());
           }
       }

</geshi>

<geshi lang="C#">

       public HighScore()
       {
       }
       string mydocpath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
       StringBuilder sb = new StringBuilder();


       public void sortPlayScore(string nowScore, string name)
       {
           sb.Clear();
           List<int> scoreSort = new List<int>();
           List<string> score = new List<string>();
           List<string> time = new List<string>();
           string path = mydocpath + @"\High-Scores.ZzZ";
           score.Clear();
           score = read();
           if (name == "play")
           {
               scoreSort.Add(Convert.ToInt32(nowScore));
               for (int i = 0; i < 10; i++)
               {
                   scoreSort.Add(Convert.ToInt32(score[i]));
               }
               scoreSort.Sort();
               for (int i = 9; i >= 0; i--)
               {
                   score[9 - i] = GetNumStringWithLeadingZeros(scoreSort[i + 1]);
               }
           }
           else
           {
               if (nowScore == "--:--:--")
                   nowScore = "99:99:99";
               time.Add(nowScore);
               for (int i = 10; i < 20; i++)
               {
                   time.Add(score[i]);
               }
               time.Sort();
               for (int i = 10; i < 20; i++)
               {
                   score[i] = time[i - 10];
               }
           }


           using (StreamWriter outfile = new StreamWriter(path))
           {
               for (int i = 0; i < 20; i++)
               {
                   sb.AppendLine(score[i]);
               }
               if (nowScore == "99:99:99")
                   nowScore = "--:--:--";
               sb.AppendLine(nowScore);
               outfile.Write(sb.ToString());
           }
       }

</geshi>

<geshi lang="C#">

       public HighScore()
       {
       
       }
       string savefile = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
       StringBuilder cre = new StringBuilder();


       public void sortPlayScore(string nowScore, string name)
       {
          
           cre.Clear();
           List<int> scoreSort = new List<int>();
           List<string> score = new List<string>();
           List<string> time = new List<string>();
           string path = savefile + @"\High-Scores.haza";
           score.Clear();
           score = getFile();
           
           if (name == "Play")
           {
               Console.WriteLine("14");
               scoreSort.Add(Convert.ToInt16(nowScore));
               
               for (int i = 0; i < 10; i++)
               {
                   scoreSort.Add(Convert.ToInt16(score[i]));
               }
               
               scoreSort.Sort();
               
               for (int i = 9; i >= 0; i--)
               {
                   
                   score[9 - i] = Zero(scoreSort[i + 1]);
               }
               
           }
           else
           {
               if (nowScore == "--:--:--")
                   nowScore = "99:99:99";
               time.Add(nowScore);
               for (int i = 10; i < 20; i++)
               {
                   time.Add(score[i]);
               }
               time.Sort();
               for (int i = 10; i < 20; i++)
               {
                   score[i] = time[i - 10];
               }
           }
           
           using (StreamWriter outfile = new StreamWriter(path))
           {
               
               for (int i = 0; i < 20; i++)
               {
                   cre.AppendLine(score[i]);
               }
               
               if (nowScore == "99:99:99")
                   nowScore = "--:--:--";
               cre.AppendLine(nowScore);
               outfile.Write(cre.ToString());
           }
       }

</geshi>