ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/public/Qzhteln/trunk/TELTest/Gamemodes/Kbmio.cs
Revision: 2
Committed: Wed Feb 11 13:07:01 2026 UTC (8 weeks, 4 days ago) by figdor32
File size: 2922 byte(s)
Log Message:
Initial check-in

File Contents

# Content
1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
5 using System.Threading.Tasks;
6
7 namespace TELTest.Gamemodes {
8 public class Kbmio : QuizGamemode {
9 public Kbmio() {
10 }
11 public Kbmio(QuizContainer container, BaseQuizContext context) : base(container, context) {
12 }
13 public override QuizGamemode CreateInstance(QuizContainer quiz, BaseQuizContext context) => new Kbmio(quiz, context);
14
15 public override String Name => "Kbmio";
16
17 public override String SystemName => "Kbmio";
18
19 public override String Description => "Tryb kbmio za kazda serie poprawnych odpowiedzi dodaje 2 razy wiecej punktow po kazdym pytaniu, ale zabiera po 2 razy wiecej punktow za niepoprawne odpowiedzi, t.j. 2, 4, 8, 16, itd.";
20
21 public override async Task Begin() {
22 int score = 0;
23 await WriteLine("Tytul quizu: " + Quiz.Title);
24 await WriteLine("Autor quizu: " + Quiz.Author);
25 await WriteLine("Rozpocznij...");
26 await ReadKey();
27 await Flush();
28 await Clear();
29 int streak = 1;
30 int wrong = 1;
31 for (int i = 0; i < Quiz.Questions.Length; i++) {
32 await Clear();
33 await WriteLine(score + " " + Utilities.OdmianaPL(score) +
34 " [ +" + streak + " / -" + wrong + " ]\r\n"
35 );
36 await WriteLine((i + 1) + ". " + Quiz.Questions[i].Content);
37 string correct = "";
38 for (int j = 0; j < Quiz.Questions[i].Answers.Length; j++) {
39 var itm = Quiz.Questions[i].Answers[j];
40 await WriteLine("{0}. {1}", Utilities.NumberToLetter(j).ToLower(), itm.Content);
41 if (itm.Correct) correct += Utilities.NumberToLetter(j).ToUpper()[0];
42 }
43 await Write("Twoja odpowiedz: ");
44 char ans = await ReadUppercaseKey();
45 await Flush();
46 await WriteLine();
47 if (correct.Contains(ans)) {
48 await WriteLine("Dobrze! Zdobywasz " + (streak != 1 ? streak + " " : "") + Utilities.OdmianaPL(streak));
49 score+= streak;
50 streak <<= 1;
51 } else {
52 await WriteLine("Zle! Poprawna odpowiedz to: {0}. Tracisz {1}", correct, (wrong == 1? "": wrong + " ") + Utilities.OdmianaPL(wrong));
53 wrong <<= 1;
54 score -= wrong;
55 streak = 1;
56 }
57 await Write("\r\n\r\n");
58 await Pause();
59 }
60 await WriteLine("Twoj wynik: {0}/{1}", score, Quiz.Questions.Length);
61 await Pause();
62
63 await DoScoreSubmission(score);
64 }
65
66 }
67 }