I will be using this GitHub repo to keep track of what I have done each day. It will have pseudocode, debugging, and program ideas. I have made the program in C#. You can download and run the code Here
What is the purpose of your quiz and what is it?
My quiz has been made so that other people can create, share, and play quizzes that they create with the program. This means that you can use the same program, but get different quizzes. All of the questions are stored in an external JSON file so that people who know how to write json can add their own questions in there. There is also a more user-friendly quiz genrator inside the program.
- Load questions from the JSON.
- Create questions and save in the JSON
- Remove questions from the JSON
- Write Pseudocode
- Refactor all code before exporting to exe
- Started creation on project.
- I made
CentreTextmethod, and started to work on theArrowMenumethod.
- Made
JSON,Menus,utils,gameclasses
- Deleted version 1 and started again from scratch. Everything got really complicated for no reason. I also decided to make the new game in a different style because it was going to take too long to write the pseudocode and log every single little error and change.
- Created project
- Made
Program,Game, andUtilsclasses. - Improved
CentreTextmethod to allow multiple lines using the\nescape sequence - Started to work on improved
ArrowMenumethod that would be in the centre
- Made a successful working
ArrowMenufunction in the centre of the screen. - Made main menu for the game
- Created
./data.jsonfile and wrote some test questions - Relearnt how to use
Newtonsoft.JsonLibrary. Made a way to deserialize./data.jsonand createdJson.cswhich stores the outline of the json in two classes.Root, andQuestions. - Created the main game in a method called
PlayGame. It would loop through all questions in the JSON file then print them out using theArrowMenumethod.
- Removed
Gameclass because it was unneeded. Moved everything intoProgramclass instead. - Made a
Linefunction that would create a simple line across the screen. - Made an
Aboutmethod that just gave some info about the game and the ncea stuff. - Switched encoding to
UTF-8so that I can use emojis and special characters. (Need to use a terminal such as WT to run now) - Learnt the basics of how to use GitHub and uploaded all current code.
- Fixed stuff like spelling and grammar in the code😳
- Added a link to the GitHub, and a simple controls menu in the
Aboutmethod. - Decided to switch to
System.Text.Json(stj) because it is faster, and seems like a more modern way to handle JSON. - Removed all newtonsoft code
- Started to learn about
System.Text.JSonin another test program.
- Added a new method called
GetJsoninto theUtilsclass that gives the Deserialized JSON quicker so I don't need to write it every time. - Remade the entire
PlayGamemethod. You can now select a quiz and play through it. After you finish a question it will wait for you to press a key then pass you onto the next question. - Started working on the
MakeGamemethod so that people can make their own quiz. - Made
SetJsonfunction that quickly serializes the JSON back into the file. - Removed a random
WriteLinethat printed theindexfrom theArrowMenumethod. - Started to tes the
MakeGamemethod. - Added the ability to use the
tabkey to cycle throughArrowMenu.
- Made a quick prototype of the
MakeGamefunction, then started to rewrite it. - Added a
GetTextInputmethod that gets quick console input. - Added a
GetNumberInputfunction that lets you get quick console input returned as an integer. - Started to make a
CentreInputmethod that will let you type something in the middle of the screen. Might remove. - Made a
RemoveGamemethod that lets the user remove a quiz that they have made or don't like. - Added
ClearLinefunction to clear a single line from the console instead of the entire console.
- Added an optional parameter to have a custom "cursor" icon in the
ArrowMenumethod. Needed to change where the title parameter was declared. - Finished the
RemoveGamemethod. - Removed
ClearLinemethod because it wasn't being used. - Started to improve
CentreInputmethod, but thinking of removing it because there isn't really any point and it looks really strange.
- Added a small part that tells you a custom message if you get all of the questions correct, or if you got none of the questions correct.
- Created
pseudocode.mdso that I can start writing pseudocode. - Started to write pseudocode for
Program.cs
- Added background music that loops
- Removed the background music because it didn't suit the style of the game
- Remade the pseudocode file because I was making it too complicated for no reason
- Removed the
CentreInputmethod because it wasn't used - Found everywhere where
json.ToArray().Lengthwas used and changed it tojson.Count - Finished the
Program.cspseudocode - Started the
JSON.cspseudocode - Finished the
JSON.cspseudocode - Started
Utils.cspseudocode - Removed the feature to print half a line in
Utils.Linebecause it's never used - Finised the
Utils.cspseudocode
- Added error testing
- Deleted all code and started to remake in Scratch🤣🤣🤣
- Changed
utils.Lineto make a new line after and have better character - Game now checks for if there is a valid
data.jsonfile in current directory - Switched order of removing quiz
- Removed the feature to check for if there is valid json file.
- Made it so that you can't delete a quiz if there is only one
- Removed ability to have a custom cursor on
ArrowMenu()menu because it was messing with the spacing
- Removed all emojis as they only really work if you are using Windows Terminal and its not default installed on the school computers because they are still on Windows 10
| Error | Problem | Fix |
|---|---|---|
; expected |
Forgot to add a semicolon | Added the semicolon |
Cannot implicitly convert type List<T> to string[] |
Tried to use a List as a String | Used .ToArray() |
| IndexOutOfRange | I accadentally added to the array instead of removing | Chaneged the + to a - |
; expected |
Forgot to add a semicolon | Added the semicolon |
i does not exist in the current context |
Used i instead of index |
Switched i for index |
Can not convert type char to string |
Used single quotes instead of double quotes | Used double quotes |
Menu input in ArrowMenu is backwards |
Down arrow makes the menu go up, and up arrow make sit go down | Switched what each key does |
data.json is being used by another process |
Another process is trying to use the JSON file | Removed un used File.Create() |
I have followed C# programming conventions in this program. Here are the conventions that I followed:
- Naming conventions
- Commenting conventions
- Layout conventions
- Knowing when to use data types
- Using the new opperator
Here are some examples of the conventions: Naming conventions
// Print text in the centre of the screen
public void CentreText(string text)int longestItem = title.Length;Utils utils = new Utils();List<string> questionAnswers = new List<string>();int menuInput = utils.ArrowMenu(new[] { "Play Quiz", "Create Quiz", "Remove Quiz", "About", "Exit" }, "Please Select an option");| Enterd data | Expected output | Output | Correct |
|---|---|---|---|
"test" |
"Please use a number" will be returned |
"Please use a number" |
✅ |
ConsoleKey.DownArrow |
Menu index will increase | Menu index decreased | ❌ |
ConsoleKey.UpArrow |
Menu index will decrease | Menu index increased | ❌ |
ConsoleKey.DownArrow |
Menu index will decrease | Menu index increased | ✅ |
ConsoleKey.UpArrow |
Menu index will increase | Menu index decreased | ✅ |
ConsoleKey.Enter |
Index should be returned | Index is too high | ❌ |
ConsoleKey.Enter |
Index should be returned | Correct index | ✅ |
12 |
12 will be returned |
12 |
✅ |
"Test" |
"test" will be returned |
"test" |
✅ |
