Jump to content

opinions on my text based adventure game(WIP and first game)

themaniac

I'm working on my first game its a text based adventure game and was wonder if you guys could try it out and tell me what your opinions are due remember this is really early into the development so theres not much, also with the ending I only put it in so there could just be an ending for now.

 

this is being made in Visual Studio with C#. just click the shortcut and it should run(I hope)

 

 

 

also heres the code so far, is there any thing I can do to make it easier or more streamlined or a habit I should get into?

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp_1
{
    class Program
    {
        static void Main(string[] args)
        {


            //Sex question and answer
            string SEXquestion = "The Creator: Hello, are you male or female?";

            Console.WriteLine(SEXquestion);
            SEXanswer:
            string SEXanswer = Console.ReadLine();


            if (SEXanswer.ToLower() == "male")
            {
                Console.WriteLine("???: I am " + SEXanswer + ".");
                Console.WriteLine("The Creator: Hello young man, what is your name?");
            }
            else if (SEXanswer.ToLower() == "female")
            {
                Console.WriteLine("???: I am " + SEXanswer + ".");
                Console.WriteLine("The Creator: Hello young lady, what is your name?");
            }
            else
            {
                Console.WriteLine("???: I am " + SEXanswer + ".");
                Console.WriteLine("The Creator: Sorry, didn't catch that could you repeat whether you're a boy or girl?");
                goto SEXanswer;
            };
            

            //Name Question and answer
            string NameAnswer = Console.ReadLine();
            Console.WriteLine(NameAnswer + ": " + "My name is " + NameAnswer + ".");
            Console.WriteLine("The Creator: Hello " + NameAnswer + ", nice to meet you, do you want to go on an adventure? Yes or No.");


            //Adventure question and answer
            string MC = NameAnswer + ": ";
            AdventureAnswer:
            string AdventureAnswer = Console.ReadLine();

            if (AdventureAnswer.ToLower() == "yes")
            {
                Console.WriteLine(MC + AdventureAnswer + ", I would like to go on an adventure.");
                Console.WriteLine("The Creator: Very well, let me transport you to a mysterious land. Just remember to keep your origins a secret.");
            }
            else if(AdventureAnswer == "no")
            {
                Console.WriteLine(MC + AdventureAnswer + ", I don't want to go on an adventure, can i go home?.");
                Console.WriteLine("The Creator: Very well, I shall transport you back to your world, Bye.");
                Console.ReadLine();
                return;
            }
            else
            {
                Console.WriteLine(MC + AdventureAnswer + ".");
                Console.WriteLine("The Creator: Sorry, I couldn't here you could you repeat whether you said Yes or No.");
                goto AdventureAnswer;
            }

            //Adventure Start
            //Part 1 The Forest

            string Narrator = "Narrator: ";
            string Partner = "nothing";
            string PartnerCompliment = "nothing";
            string PartnerTitle = "nothing";

            if(SEXanswer == "male")
            {
                Partner = "Jessica";
                PartnerTitle = "Jessica: ";
                PartnerCompliment = "beautiful young lady";
            }
            else if(SEXanswer == "female")
            {
                Partner = "Rapheal";
                PartnerTitle = "Rapheal: ";
                PartnerCompliment = "handsome young man";
            }

            Console.WriteLine(Narrator + "You open your eyes and see you are on a cliff surrounded by a beautiful, lush, and green forest.");
            Console.WriteLine(MC + "Wow! This is amazing!");
            Console.WriteLine(Narrator + "You here a sound in the bush's behind you. Do you");
            Console.WriteLine("Investigate the sound = 1 or Explore the forest elsewhere = 2");

            string BushSound = Console.ReadLine();

            if(BushSound == "1")
            {
                Console.WriteLine(Narrator + "You investigate the sound only to find a pack of wolves eating a deer.");
                Console.WriteLine(MC + "Holy ****!");
                Console.WriteLine(Narrator + "The wolves notice you. You try to run away but to no avail, they catch you.");
                Console.WriteLine(Narrator + "As you are screaming and fighting for your life the wolves are shot by arrows");
                Console.WriteLine(Narrator + "Before your eyes go black, you see a " + PartnerCompliment + "." + " You have died of blood loss.");
                Console.ReadLine();
                return;
            }
            if(BushSound == "2")
            {
                Console.WriteLine(Narrator + "You explore the forest elsewhere.");
                Console.WriteLine(Narrator + "As you are exploring the forest, you see a group of deers in front of you, they are surrounding something.");
                Console.WriteLine(Narrator + "Does your curiosity get the better of you = 1 or do you leave them alone = 2");

                string DeerGroup = Console.ReadLine();

                if(DeerGroup == "1")
                {
                    Console.WriteLine(Narrator + "You move in slowly and quietly to see what they are surrounding and see a doe giving birth");
                    Console.WriteLine(MC + "Well thats a first for me, guess I should leave before I'm noticed and get in the way.");

                }
                if(DeerGroup == "2")
                {
                    Console.WriteLine(MC + "I should probably leave them alone, as to not bother them.");

                }


                Console.WriteLine(Narrator + "As you turn around you see a" + PartnerCompliment + ", she asks you");
                Console.WriteLine(PartnerTitle + "What are you doing this deep in the forest?");
                Console.WriteLine(Narrator + "You pause unable to think of answer.");
                Console.WriteLine(PartnerTitle + "Well? Not gonna answer me?");
                Console.WriteLine(Narrator + "All of a sudden you here a stampeding sound, you turn around only to see the group of deers behind you run off in a hurry.");
                Console.WriteLine(Narrator + "You turn back to the " + PartnerCompliment + " and see a sasquatch behind her.");
                Console.WriteLine(Narrator + "You struggle to warn her.");
                Console.WriteLine(MC + "B-b-b-behind you!");
                Console.WriteLine(Narrator + "She turns around, only to be hit by the sasquatch, she flies off into the forest.");
                Console.WriteLine(Narrator + "You watch her get flung off into the forest and notice a knife fall out of her sheath.");
                Console.WriteLine(Narrator + "You unconsiously run towards the knife, you pick up the knife, turn around, and prepare to fight.");
                Console.WriteLine(Narrator + "The sasquatch is about to punch you. Do you try to dodge the punch = 1 or do you rush in to stab the sasquatch = 2?");

                string Sasquatch = Console.ReadLine();

                if(Sasquatch == "1")
                {
                    Console.WriteLine(Narrator + "You try to dodge the punch only to be tripped by a branch on the ground");
                }
                if(Sasquatch == "2")
                {
                    Console.WriteLine(Narrator + "You rush in and stab the sasquatch, the sasquatch grabs you and breaks your neck.");
                }
            }


            Console.ReadLine();



        }
    }
}

 

 

EDIT: here is the published version you should be able to play it now ConsoleApp_1.zip

 

 

Spoiler

My system is the Dell Inspiron 15 5559 Microsoft Signature Edition

                         The Austrailian king of LTT said that I'm awesome and a funny guy. the greatest psu list known to man DDR3 ram guide

                                                                                                               i got 477 posts in my first 30 days on LinusTechTips.com

 

Link to comment
Share on other sites

Link to post
Share on other sites

10 minutes ago, themaniac said:

snip

Why don't you just use ClickOnce to create binaries?

 

I can't run the text adventure game as it is.

 

Also 10/10,  your current download contains all the source code.

Judge a product on its own merits AND the company that made it.

How to setup MSI Afterburner OSD | How to make your AMD Radeon GPU more efficient with Radeon Chill | (Probably) Why LMG Merch shipping to the EU is expensive

Oneplus 6 (Early 2023 to present) | HP Envy 15" x360 R7 5700U (Mid 2021 to present) | Steam Deck (Late 2022 to present)

 

Mid 2023 AlTech Desktop Refresh - AMD R7 5800X (Mid 2023), XFX Radeon RX 6700XT MBA (Mid 2021), MSI X370 Gaming Pro Carbon (Early 2018), 32GB DDR4-3200 (16GB x2) (Mid 2022

Noctua NH-D15 (Early 2021), Corsair MP510 1.92TB NVMe SSD (Mid 2020), beQuiet Pure Wings 2 140mm x2 & 120mm x1 (Mid 2023),

Link to comment
Share on other sites

Link to post
Share on other sites

1 minute ago, AluminiumTech said:

Why don't you just use ClickOnce to create binaries?

 

I can't run the text adventure game as it is.

 

Also 10/10,  your current download contains all the source code.

I haven't heard of that command and I also don't know what creating binaries would do

Spoiler

My system is the Dell Inspiron 15 5559 Microsoft Signature Edition

                         The Austrailian king of LTT said that I'm awesome and a funny guy. the greatest psu list known to man DDR3 ram guide

                                                                                                               i got 477 posts in my first 30 days on LinusTechTips.com

 

Link to comment
Share on other sites

Link to post
Share on other sites

10 minutes ago, themaniac said:

I haven't heard of that command and I also don't know what creating binaries would do

what happened to other in the genders? nowadays people will get angry over things like that

Link to comment
Share on other sites

Link to post
Share on other sites

15 minutes ago, themaniac said:

 

I haven't heard of that command and I also don't know what creating binaries would do

In Visual Studio (assuming you selected ClickOnce tools on setup) you can turn your program into binary .exe files for people to be able to run the game.

 

You just need to create a temporary authentication key.

 

These images are crude but you should get the point.

 

Double click on properties in your project.

 

security.PNG

 

security2.PNG

 

 

publish.PNG

Judge a product on its own merits AND the company that made it.

How to setup MSI Afterburner OSD | How to make your AMD Radeon GPU more efficient with Radeon Chill | (Probably) Why LMG Merch shipping to the EU is expensive

Oneplus 6 (Early 2023 to present) | HP Envy 15" x360 R7 5700U (Mid 2021 to present) | Steam Deck (Late 2022 to present)

 

Mid 2023 AlTech Desktop Refresh - AMD R7 5800X (Mid 2023), XFX Radeon RX 6700XT MBA (Mid 2021), MSI X370 Gaming Pro Carbon (Early 2018), 32GB DDR4-3200 (16GB x2) (Mid 2022

Noctua NH-D15 (Early 2021), Corsair MP510 1.92TB NVMe SSD (Mid 2020), beQuiet Pure Wings 2 140mm x2 & 120mm x1 (Mid 2023),

Link to comment
Share on other sites

Link to post
Share on other sites

10 hours ago, gtx1060=value said:

what happened to other in the genders? nowadays people will get angry over things like that

i'd rather not spend my whole life typing in gender options so I went with asking your sex

 

10 hours ago, AluminiumTech said:

In Visual Studio (assuming you selected ClickOnce tools on setup) you can turn your program into binary .exe files for people to be able to run the game.

 

You just need to create a temporary authentication key.

 

These images are crude but you should get the point.

 

Double click on properties in your project.

 

-snip-

 

thanks, I had no idea about that

Spoiler

My system is the Dell Inspiron 15 5559 Microsoft Signature Edition

                         The Austrailian king of LTT said that I'm awesome and a funny guy. the greatest psu list known to man DDR3 ram guide

                                                                                                               i got 477 posts in my first 30 days on LinusTechTips.com

 

Link to comment
Share on other sites

Link to post
Share on other sites

I have edited the OP with the download to the published version

Spoiler

My system is the Dell Inspiron 15 5559 Microsoft Signature Edition

                         The Austrailian king of LTT said that I'm awesome and a funny guy. the greatest psu list known to man DDR3 ram guide

                                                                                                               i got 477 posts in my first 30 days on LinusTechTips.com

 

Link to comment
Share on other sites

Link to post
Share on other sites

I just gave it a quick read and seems cool, however, those goto aren't really good practices, on the long run (and if you collaborate in the project with other people) is more convenient to use do{ } while().

Other than that, I look forward to see your progress

The best way to measure the quality of a piece of code is "Oh F*** "s per line

Link to comment
Share on other sites

Link to post
Share on other sites

7 minutes ago, espurritado said:

I just gave it a quick read and seems cool, however, those goto aren't really good practices, on the long run (and if you collaborate in the project with other people) is more convenient to use do{ } while().

Other than that, I look forward to see your progress

I originally tried to use while() but couldn't figure out how to get it to work

Spoiler

My system is the Dell Inspiron 15 5559 Microsoft Signature Edition

                         The Austrailian king of LTT said that I'm awesome and a funny guy. the greatest psu list known to man DDR3 ram guide

                                                                                                               i got 477 posts in my first 30 days on LinusTechTips.com

 

Link to comment
Share on other sites

Link to post
Share on other sites

Just now, themaniac said:

I originally tried to use while() but couldn't figure out how to get it to work

it's easy, for the sex question, for example it would be

do{
    string SEXanswer = Console.ReadLine();
    bool rightAnswer = false;
    if (SEXanswer.ToLower() == "male")
        {
         Console.WriteLine("???: I am " + SEXanswer + ".");
         Console.WriteLine("The Creator: Hello young man, what is your name?");
         rightAnswer = true;
        }
    else if (SEXanswer.ToLower() == "female")
        {
         Console.WriteLine("???: I am " + SEXanswer + ".");
         Console.WriteLine("The Creator: Hello young lady, what is your name?");
         rightAnswer = true;
        }
    else
        {
         Console.WriteLine("???: I am " + SEXanswer + ".");
         Console.WriteLine("The Creator: Sorry, didn't catch that could you repeat whether you're a boy or girl?");
         }
}while(!rightAnswer)

 

The best way to measure the quality of a piece of code is "Oh F*** "s per line

Link to comment
Share on other sites

Link to post
Share on other sites

3 minutes ago, espurritado said:

it's easy, for the sex question, for example it would be


do{
    string SEXanswer = Console.ReadLine();
    bool rightAnswer = false;
    if (SEXanswer.ToLower() == "male")
        {
         Console.WriteLine("???: I am " + SEXanswer + ".");
         Console.WriteLine("The Creator: Hello young man, what is your name?");
         rightAnswer = true;
        }
    else if (SEXanswer.ToLower() == "female")
        {
         Console.WriteLine("???: I am " + SEXanswer + ".");
         Console.WriteLine("The Creator: Hello young lady, what is your name?");
         rightAnswer = true;
        }
    else
        {
         Console.WriteLine("???: I am " + SEXanswer + ".");
         Console.WriteLine("The Creator: Sorry, didn't catch that could you repeat whether you're a boy or girl?");
         }
}while(!rightAnswer)

 

thanks

Spoiler

My system is the Dell Inspiron 15 5559 Microsoft Signature Edition

                         The Austrailian king of LTT said that I'm awesome and a funny guy. the greatest psu list known to man DDR3 ram guide

                                                                                                               i got 477 posts in my first 30 days on LinusTechTips.com

 

Link to comment
Share on other sites

Link to post
Share on other sites

1 hour ago, espurritado said:

it's easy, for the sex question, for example it would be


do{
    string SEXanswer = Console.ReadLine();
    bool rightAnswer = false;
    if (SEXanswer.ToLower() == "male")
        {
         Console.WriteLine("???: I am " + SEXanswer + ".");
         Console.WriteLine("The Creator: Hello young man, what is your name?");
         rightAnswer = true;
        }
    else if (SEXanswer.ToLower() == "female")
        {
         Console.WriteLine("???: I am " + SEXanswer + ".");
         Console.WriteLine("The Creator: Hello young lady, what is your name?");
         rightAnswer = true;
        }
    else
        {
         Console.WriteLine("???: I am " + SEXanswer + ".");
         Console.WriteLine("The Creator: Sorry, didn't catch that could you repeat whether you're a boy or girl?");
         }
}while(!rightAnswer)

 

for some reason it causes an infinite loop, I somehow managed to fix the sex question one(don't know how) but I cant figure out how to fix the go on an adventure one

 

sex question

string SEXanswer = Console.ReadLine();
bool RightSEXanswer = false;

do
{
	if (SEXanswer.ToLower() == "male")
	{
		Console.WriteLine("???: I am " + SEXanswer + ".");
		Console.WriteLine("The Creator: Hello young man, what is your name?");
		RightSEXanswer = true;
	}
	else if (SEXanswer.ToLower() == "female")
	{
		Console.WriteLine("???: I am " + SEXanswer + ".");
		Console.WriteLine("The Creator: Hello young lady, what is your name?");
		RightSEXanswer = true;
	}
	else
	{
		Console.WriteLine("???: I am " + SEXanswer + ".");
		Console.WriteLine("The Creator: Sorry, didn't catch that could you repeat whether you're male or female?");
	}
} while (!RightSEXanswer);

adventure question

string AdventureAnswer = Console.ReadLine();
bool RightAdventureAnswer = false;

do
{
	if (AdventureAnswer.ToLower() == "yes")
	{
		Console.WriteLine(MC + AdventureAnswer + ", I would like to go on an adventure.");
		Console.WriteLine("The Creator: Very well, let me transport you to a mysterious land. Just remember to keep your origins a secret.");
		RightAdventureAnswer = true;
	}
	else if (AdventureAnswer == "no")
	{
		Console.WriteLine(MC + AdventureAnswer + ", I don't want to go on an adventure, can i go home?.");
		Console.WriteLine("The Creator: Very well, I shall transport you back to your world, Bye.");
		Console.ReadLine();
		return;
	}
	else
	{
		Console.WriteLine(MC + AdventureAnswer + ".");
		Console.WriteLine("The Creator: Sorry, I couldn't hear you could you repeat whether you said Yes or No.");
	}
} while (!RightAdventureAnswer);

 

 

EDIT: nevermind the sex question one is also an infinite loop now

Spoiler

My system is the Dell Inspiron 15 5559 Microsoft Signature Edition

                         The Austrailian king of LTT said that I'm awesome and a funny guy. the greatest psu list known to man DDR3 ram guide

                                                                                                               i got 477 posts in my first 30 days on LinusTechTips.com

 

Link to comment
Share on other sites

Link to post
Share on other sites

9 minutes ago, themaniac said:

for some reason it causes an infinite loop, I somehow managed to fix the sex question one(don't know how) but I cant figure out how to fix the go on an adventure one

 

 

my mistake, sorry, the readLine has to be inside the loop, however the control variable (rightSexAnswer/rightAdventureAnswer) has to be outside the loop.

 

just move the readLine to right after the do{

 

also, another bit of common practices, variable names start with lower case  and use what is called camel case (the first letter of every word after the first is uppercase). Classes names start with upper case and use camel case

The best way to measure the quality of a piece of code is "Oh F*** "s per line

Link to comment
Share on other sites

Link to post
Share on other sites

2 minutes ago, espurritado said:

my mistake, sorry, the readLine has to be inside the loop, however the control variable (rightSexAnswer/rightAdventureAnswer) has to be outside the loop.

 

just move the readLine to right after the do{

 

also, another bit of common practices, variable names start with lower case  and use what is called camel case (the first letter of every word after the first is uppercase). Classes names start with upper case and use camel case

ok, thanks

Spoiler

My system is the Dell Inspiron 15 5559 Microsoft Signature Edition

                         The Austrailian king of LTT said that I'm awesome and a funny guy. the greatest psu list known to man DDR3 ram guide

                                                                                                               i got 477 posts in my first 30 days on LinusTechTips.com

 

Link to comment
Share on other sites

Link to post
Share on other sites

On 17/01/2017 at 2:51 AM, themaniac said:

is there any thing I can do to make it easier or more streamlined or a habit I should get into?

No offence but your code is a rats nest... but that's alright given your stage. One of the most glaringly obvious problems with your code is the Cyclomatic Complexity i.e. that mess of if else if statements. Another more trivial problem is the use of magic numbers and literals; one should prefer constants with a meaningful and descriptive name and indeed a clear reason for ever existing in the first place. Lastly I'd say that you need to ensure that you are consistent in the use of variable names (also adhering to language naming conventions) and especially spacing.

 

I would suggest that you make a start by having a look at Single Responsibility, Open-Closed, Liskov Substitution, Interface Segregation and Dependency Inversion (SOLID) and Design Patterns, also be aware of other programming paradigms.

The single biggest problem in communication is the illusion that it has taken place.

Link to comment
Share on other sites

Link to post
Share on other sites

19 minutes ago, Nuluvius said:

No offence but your code is a rats nest... but that's alright given your stage. One of the most glaringly obvious problems with your code is the Cyclomatic Complexity i.e. that mess of if else if statements.

not sure I understand(haven't read the whole article yet) by that do you mean that some(one) of the if else if statements don't matter?

 

25 minutes ago, Nuluvius said:

Another more trivial problem is the use of magic numbers and literals; one should prefer constants with a meaningful and descriptive name and indeed a clear reason for ever existing in the first case. .

I'm guessing you are talking about the partnertitle variable and probably a few other's as well like the one about the deers?

 

and thanks. 

 

Spoiler

My system is the Dell Inspiron 15 5559 Microsoft Signature Edition

                         The Austrailian king of LTT said that I'm awesome and a funny guy. the greatest psu list known to man DDR3 ram guide

                                                                                                               i got 477 posts in my first 30 days on LinusTechTips.com

 

Link to comment
Share on other sites

Link to post
Share on other sites

20 hours ago, themaniac said:

not sure I understand(haven't read the whole article yet) by that do you mean that some(one) of the if else if statements don't matter?

I'm saying that with the right design you may not even need any branching logic at all.

20 hours ago, themaniac said:

I'm guessing you are talking about the partnertitle variable and probably a few other's as well like the one about the deers?

I'm looking at nothing specific just the overall impression.

 

Your most heinous crime is the use of goto:

goto SEXanswer;

Magic numbers and literals:

if(BushSound == "2")
if (AdventureAnswer.ToLower() == "yes")

Inconsistent spacing:

                }
            }


            Console.ReadLine();



        }

You should be using string interpolation:

Console.WriteLine(Narrator + "You rush in and stab the sasquatch, the sasquatch grabs you and breaks your neck.");

You should be using implicitly typed local variables:

string SEXanswer = Console.ReadLine();

I'm less concerned over the style of the variables (in contrast to everything else) but I would strongly suggest that you adhere to the conventions for the specific language that you are working in; they can be different and there can be further idiosyncrasies due to teams/companies. Consistency is what is most important. Certainly in this case look at the de facto standard.

The single biggest problem in communication is the illusion that it has taken place.

Link to comment
Share on other sites

Link to post
Share on other sites

13 hours ago, Nuluvius said:

No offence but your code is a rats nest...

You used to call some of my code really bad.....

 

Fortunately I've gotten a little better (if you want I can PM you a link to my GitHub page to see some source code which is more recent).

13 hours ago, Nuluvius said:

but that's alright given your stage. One of the most glaringly obvious problems with your code is the Cyclomatic Complexity i.e. that mess of if else if statements.

To be fair, many tutorials or instructors really hammer the idea of IF and ELSE statements and use them religiously.

 

Judge a product on its own merits AND the company that made it.

How to setup MSI Afterburner OSD | How to make your AMD Radeon GPU more efficient with Radeon Chill | (Probably) Why LMG Merch shipping to the EU is expensive

Oneplus 6 (Early 2023 to present) | HP Envy 15" x360 R7 5700U (Mid 2021 to present) | Steam Deck (Late 2022 to present)

 

Mid 2023 AlTech Desktop Refresh - AMD R7 5800X (Mid 2023), XFX Radeon RX 6700XT MBA (Mid 2021), MSI X370 Gaming Pro Carbon (Early 2018), 32GB DDR4-3200 (16GB x2) (Mid 2022

Noctua NH-D15 (Early 2021), Corsair MP510 1.92TB NVMe SSD (Mid 2020), beQuiet Pure Wings 2 140mm x2 & 120mm x1 (Mid 2023),

Link to comment
Share on other sites

Link to post
Share on other sites

2 hours ago, AluminiumTech said:

You used to call some of my code really bad.....

Indeed I did xD

2 hours ago, AluminiumTech said:

Fortunately I've gotten a little better (if you want I can PM you a link to my GitHub page to see some source code which is more recent).

Are you asking me if I will donate some of my time to review your code?

2 hours ago, AluminiumTech said:

To be fair, many tutorials or instructors really hammer the idea of IF and ELSE statements and use them religiously.

And hopefully by now you are starting to realise why that's really bad.

The single biggest problem in communication is the illusion that it has taken place.

Link to comment
Share on other sites

Link to post
Share on other sites

38 minutes ago, Nuluvius said:

Indeed I did xD

And rightfully so.

38 minutes ago, Nuluvius said:

Are you asking me if I will donate some of my time to review your code?

I was proposing in case you wanted to. I won't feel bad or treat you any differently if you don't look at it.

 

It was just more if you wanted to.

38 minutes ago, Nuluvius said:

And hopefully by now you are starting to realise why that's really bad.

Yes I do. Branch prediction issues.......

 

Overusing IF and ELSE are bad. Using Arrays are better sometimes.

Judge a product on its own merits AND the company that made it.

How to setup MSI Afterburner OSD | How to make your AMD Radeon GPU more efficient with Radeon Chill | (Probably) Why LMG Merch shipping to the EU is expensive

Oneplus 6 (Early 2023 to present) | HP Envy 15" x360 R7 5700U (Mid 2021 to present) | Steam Deck (Late 2022 to present)

 

Mid 2023 AlTech Desktop Refresh - AMD R7 5800X (Mid 2023), XFX Radeon RX 6700XT MBA (Mid 2021), MSI X370 Gaming Pro Carbon (Early 2018), 32GB DDR4-3200 (16GB x2) (Mid 2022

Noctua NH-D15 (Early 2021), Corsair MP510 1.92TB NVMe SSD (Mid 2020), beQuiet Pure Wings 2 140mm x2 & 120mm x1 (Mid 2023),

Link to comment
Share on other sites

Link to post
Share on other sites

4 hours ago, AluminiumTech said:

I was proposing in case you wanted to.

Oh so now you're proposing to me are you? xD Sure send your link and I'll try to find the time at some point.

4 hours ago, AluminiumTech said:

Overusing IF and ELSE are bad. Using Arrays are better sometimes.

A common approach to actually replacing the conditionals altogether is to use the Command Pattern; which is what I was specifically thinking about in the OPs case. Essentially the behaviour in those conditional blocks would instead be encapsulated within objects or lambdas that were then stored in a dictionary.

The single biggest problem in communication is the illusion that it has taken place.

Link to comment
Share on other sites

Link to post
Share on other sites

@AluminiumTech @Nuluvius reminds me of the time my interviewer went through my github.

                     ¸„»°'´¸„»°'´ Vorticalbox `'°«„¸`'°«„¸
`'°«„¸¸„»°'´¸„»°'´`'°«„¸Scientia Potentia est  ¸„»°'´`'°«„¸`'°«„¸¸„»°'´

Link to comment
Share on other sites

Link to post
Share on other sites

On ‎1‎/‎18‎/‎2017 at 3:23 AM, Nuluvius said:

I'm saying that with the right design you may not even need any branching logic at all.

I'm looking at nothing specific just the overall impression.

 

Your most heinous crime is the use of goto:


goto SEXanswer;

 

I only used goto because I couldn't figure out how to use while but thanks to @espurritado I have figured it out(or at least part of it) and got rid of goto

 

On ‎1‎/‎18‎/‎2017 at 3:23 AM, Nuluvius said:

 

Magic numbers and literals:


if(BushSound == "2")

if (AdventureAnswer.ToLower() == "yes")

 

so basically unneeded variables right? Or am I missing something?

 

On ‎1‎/‎18‎/‎2017 at 3:23 AM, Nuluvius said:

You should be using string interpolation:


Console.WriteLine(Narrator + "You rush in and stab the sasquatch, the sasquatch grabs you and breaks your neck.");

 

I'll work on that(currently trying to wrap my head around it)

 

On ‎1‎/‎18‎/‎2017 at 3:23 AM, Nuluvius said:

You should be using implicitly typed local variables:


string SEXanswer = Console.ReadLine();

I'm less concerned over the style of the variables (in contrast to everything else) but I would strongly suggest that you adhere to the conventions for the specific language that you are working in; they can be different and there can be further idiosyncrasies due to teams/companies. Consistency is what is most important. Certainly in this case look at the de facto standard.

so basically I should use use var instead of string(and others) whenever possible?

Spoiler

My system is the Dell Inspiron 15 5559 Microsoft Signature Edition

                         The Austrailian king of LTT said that I'm awesome and a funny guy. the greatest psu list known to man DDR3 ram guide

                                                                                                               i got 477 posts in my first 30 days on LinusTechTips.com

 

Link to comment
Share on other sites

Link to post
Share on other sites

13 hours ago, themaniac said:

so basically unneeded variables right? Or am I missing something?

Well there shouldn't be any unneeded variables at all. But that's not really what magic numbers and literals refer to. It's anywhere in your code that you declare some kind of string or number in place such as an if statement for example. What you should instead be doing is promoting these to constants with meaningful and descriptive names, even then you should have a really good reason for doing so. Otherwise you are going to come back to the code in 6 months time and wonder what the hell it all means; the same goes for anyone trying to read your code i.e. it's very difficult to understand and maintain.

13 hours ago, themaniac said:

so basically I should use use var instead of string(and others) whenever possible?

Yes although you may wish to bear in mind that people may argue that this is subjective. I do not; I argue that if by making use of implicit typing your code becomes less readable and intuitive then you are doing something wrong.

The single biggest problem in communication is the illusion that it has taken place.

Link to comment
Share on other sites

Link to post
Share on other sites

3 hours ago, Nuluvius said:

Well there shouldn't be any unneeded variables at all. But that's not really what magic numbers and literals refer to. It's anywhere in your code that you declare some kind of string or number in place such as an if statement for example. What you should instead be doing is promoting these to constants with meaningful and descriptive names, even then you should have a really good reason for doing so. Otherwise you are going to come back to the code in 6 months time and wonder what the hell it all means; the same goes for anyone trying to read your code i.e. it's very difficult to understand and maintain.

I'm having a bit of a hard time understanding, could you give an example of it using part of my code, if you don't mind?

Spoiler

My system is the Dell Inspiron 15 5559 Microsoft Signature Edition

                         The Austrailian king of LTT said that I'm awesome and a funny guy. the greatest psu list known to man DDR3 ram guide

                                                                                                               i got 477 posts in my first 30 days on LinusTechTips.com

 

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×