Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
@RazorSh4rk yea and I chose C# I'm not a C# wizard I just started and wanted to practice?
-
nocgod17588yUse common c# code styling.
The braces should be on new lines.
The if with a do..While where you count down attempts and then taunt the player. Compare with IgnoreCase if you don't care for about the case.
Encapsulate questions and answers in a separate class, then you'll be able to load all questions using Assembly, it will simplify the insertion of new questions.
Create a taunt factory with good taunts. -
I do code reviews everyday but I can't do a short reply here. There is too much wrong with your code. Not bad for a beginner though but it needs a lot of work.
Make yourself familiar with object orientation, exception handling, SOLID principles. Separate concerns.
I do like your coding style which looks good so I would say you are on the right track. -
Or do an array of questions and correct answers, then loop though them. Look up Dictionary, then have an array of possible answers as the value, the key could be the question. Probably a horrible idea but that's how I'd do it xD
-
@RhysOC write a method with a Question object as the parameter, then create a Question object linked list (so you can add more to it), read qouestion-answer pairs from a txt to the constructors of the objects, randomly choose questions to appear
-
Use \n instead of Console.WriteLine("");
Also if you want to write Console.WriteLine("");
You could omit [""]. -
I think you should check for strings equality like this
StringVariableName.Equals("START", StringComparsion.OrdinalIgnoreCase); -
Use \n for a new line instead of Console.WriteLine(); and maybe add a while loop around it so the player can play again. Otherwise it's good!
-
No functions, no OOP, no structure and no reusability. What if you want to use something other than logging to console?
-
@negative-byte yea I was aware it's kind of pointless I just thought I start somewhere.
-
I would have created a Question class with a string for the question a book for the answer and created a List with questions and keep going from there, and yeah, in 10 mints. But what you did is good.
-
bikeshead opinion = new bikeshead();
@michalpiekarski not logic gets confusing; I set the if condition based on either 1) the most common path or 2) the correct path.
if (bool run_A)
{
// A
}
else
{
// B
}
Or
if (bool run_B)
{
// B
}
else
{
// A
}
When you use a method it can get confusing
if (GetSomeString().Length > 0)
For "fall through" code it's fine, but with additional classes and methods the structure will have to be reworked. -
Is a binary tree quiz game a bad idea? I just thought of that and i wanna implement it
Related Rants
Does anyone want to criticize my c# code for a quiz game I made in like 10 minutes?
undefined
test
c#
programming
visual studio