Jump to content

Lan Tournament program

Zeruel

Hello! I've created a small tournament program for just 8 players in a 1v1 situation. I've created both linux and windows versions for download. Tell me what you think!

 

I plan to add the dynamic ability to add more players, and some more functions. I also plan to move on from a text based GUI to a real GUI soon. 

 

Do please take a look and feel free to critique it.

 

Source Linux - https://drive.google.com/file/d/0BysX244ZHPdiazVQcldndERRMGs/edit?usp=sharing

 

Source Windows - https://drive.google.com/file/d/0BysX244ZHPdiTFIxdWJDcm14TDg/edit?usp=sharing 

[ Cruel Angel ]:     Exterior  -   BENQ XL2420T   |   SteelSeries MLG Sensei   |   Corsair K70 RED   |   Corsair 900D  |                                                                                                    CPU:    -   4.7Ghz @ 1.425v             |

                             Interior    -   i7 4770k   |    Maximus VI Formula    |   Corsair Vengeance Pro 16GB    |   ASUS GTX 980 Strix SLIx2  |  840 Pro 512Gb    |    WD Black 2TB  |           RAM:   -   2400Mhz OC @ 1.650v    |

                             Cooling   -   XSPC 120mm x7 Total Radiator Space   |   XSPC RayStorm    |    PrimoChill Tubing/Res  |                                                                                             GPU:   -   1000Mhz @ 1.158            |

Link to comment
Share on other sites

Link to post
Share on other sites

Nice! Will be using this for League.

Link to comment
Share on other sites

Link to post
Share on other sites

Nice! Will be using this for League.

Thanks! Be careful since I was too lazy to add any data correction input, so enter exact what you need to put in. Also the "Final" round is round "3". Different versions will be release soon.

[ Cruel Angel ]:     Exterior  -   BENQ XL2420T   |   SteelSeries MLG Sensei   |   Corsair K70 RED   |   Corsair 900D  |                                                                                                    CPU:    -   4.7Ghz @ 1.425v             |

                             Interior    -   i7 4770k   |    Maximus VI Formula    |   Corsair Vengeance Pro 16GB    |   ASUS GTX 980 Strix SLIx2  |  840 Pro 512Gb    |    WD Black 2TB  |           RAM:   -   2400Mhz OC @ 1.650v    |

                             Cooling   -   XSPC 120mm x7 Total Radiator Space   |   XSPC RayStorm    |    PrimoChill Tubing/Res  |                                                                                             GPU:   -   1000Mhz @ 1.158            |

Link to comment
Share on other sites

Link to post
Share on other sites

a quick look suggests that you could improve comments and modularity:

 

comments:

you accurately described/marked every opened and closed bracket, but it's not really that the point of brackets, indentation should be enough for understanding brackets

comments should be there to remember what the code is doing, to remind you what that specific part of code does, because a couple years from now you may need to use that code again, and you won't remember a single thing, i guarantee. so you will read comments hoping to get some clues, but comments will only tell you things that you already know

see clrscr() and getch() to see how you should comment your code

 

modularity:

when, writing code, you find yourself copypasting the same code because you need to do something many times in different parts of the program, that should light up something in your head and make you think about taking that block of code and making some sort of function out of it

this will bring you awesome advantages: your code will be easy and fast to debug and correct, and it will be much more clear and compact

so, i noticed that this snippet of code

                    case '1': // Bracket 1                    {                        cout << "\n\nSelect Winner for Round 1 Bracket 1\n";                        cout << players_layout[1][1] << " or " << players_layout[1][2] << "\nEnter: ";                        cin >> winner_select;                        if( winner_select == players_layout[1][1] )                        {                            cout << players_layout[1][1] << " is the winner!";                            players_layout[2][1] = players_layout[1][1];                        }                        else if( winner_select == players_layout[1][2] )                        {                            cout << players_layout[1][2] << " is the winner!";                            players_layout[2][1] = players_layout[1][2];                        }                        break;                    } // Bracket 1

is really really redundant: it's used 7 times in the code

it's 7 * 18 lines of code

if you use a function to do that same thing, you will lose 7 * 17 = 119 lines of code, and gain a lot of clearity

 

edit: alright, 18 lines inclueds blanks too, but hey the point is still valid

Link to comment
Share on other sites

Link to post
Share on other sites

a quick look suggests that you could improve comments and modularity:

 

comments:

you accurately described/marked every opened and closed bracket, but it's not really that the point of brackets, indentation should be enough for understanding brackets

comments should be there to remember what the code is doing, to remind you what that specific part of code does, because a couple years from now you may need to use that code again, and you won't remember a single thing, i guarantee. so you will read comments hoping to get some clues, but comments will only tell you things that you already know

see clrscr() and getch() to see how you should comment your code

 

modularity:

when, writing code, you find yourself copypasting the same code because you need to do something many times in different parts of the program, that should light up something in your head and make you think about taking that block of code and making some sort of function out of it

this will bring you awesome advantages: your code will be easy and fast to debug and correct, and it will be much more clear and compact

so, i noticed that this snippet of code

                    case '1': // Bracket 1                    {                        cout << "\n\nSelect Winner for Round 1 Bracket 1\n";                        cout << players_layout[1][1] << " or " << players_layout[1][2] << "\nEnter: ";                        cin >> winner_select;                        if( winner_select == players_layout[1][1] )                        {                            cout << players_layout[1][1] << " is the winner!";                            players_layout[2][1] = players_layout[1][1];                        }                        else if( winner_select == players_layout[1][2] )                        {                            cout << players_layout[1][2] << " is the winner!";                            players_layout[2][1] = players_layout[1][2];                        }                        break;                    } // Bracket 1

is really really redundant: it's used 7 times in the code

it's 7 * 18 lines of code

if you use a function to do that same thing, you will lose 7 * 17 = 119 lines of code, and gain a lot of clearity

 

edit: alright, 18 lines inclueds blanks too, but hey the point is still valid

 

Oh yes I fully understand the redundancy in this program. When I said "dynamically add more players" I plan to address this problem or else I would face a massive amount of switch "cases". More or less this program is just in its "concept" stage and this is to show what I wanted it to do. To reduce the chances of me getting lost in my switch statements I made my comments like so. Though... I have my comments as a bright colored blue and I like searching for certain areas of my code like that. :)

[ Cruel Angel ]:     Exterior  -   BENQ XL2420T   |   SteelSeries MLG Sensei   |   Corsair K70 RED   |   Corsair 900D  |                                                                                                    CPU:    -   4.7Ghz @ 1.425v             |

                             Interior    -   i7 4770k   |    Maximus VI Formula    |   Corsair Vengeance Pro 16GB    |   ASUS GTX 980 Strix SLIx2  |  840 Pro 512Gb    |    WD Black 2TB  |           RAM:   -   2400Mhz OC @ 1.650v    |

                             Cooling   -   XSPC 120mm x7 Total Radiator Space   |   XSPC RayStorm    |    PrimoChill Tubing/Res  |                                                                                             GPU:   -   1000Mhz @ 1.158            |

Link to comment
Share on other sites

Link to post
Share on other sites

Oh yes I fully understand the redundancy in this program. When I said "dynamically add more players" I plan to address this problem or else I would face a massive amount of switch "cases". More or less this program is just in its "concept" stage and this is to show what I wanted it to do. To reduce the chances of me getting lost in my switch statements I made my comments like so. Though... I have my comments as a bright colored blue and I like searching for certain areas of my code like that. :)

alright, got it

but it's also about good practise: doing things automatically good is a good thing, and doing them the right way even at this "concept stage" will not make you lose time fixing it once the project gets more complicated

 

stalking your profile, i see that the same "modularity" thing could be applied to the code that you're currently using as status (status? well, that)

so, see, this is why it's good to just get used to doing things right

if you act lazy saying "i'll do it better later", you will eventually end up with a ton of work, and a huge amount of spaghetti code that will be a pain to work with

Link to comment
Share on other sites

Link to post
Share on other sites

alright, got it

but it's also about good practise: doing things automatically good is a good thing, and doing them the right way even at this "concept stage" will not make you lose time fixing it once the project gets more complicated

 

stalking your profile, i see that the same "modularity" thing could be applied to the code that you're currently using as status (status? well, that)

so, see, this is why it's good to just get used to doing things right

if you act lazy saying "i'll do it better later", you will eventually end up with a ton of work, and a huge amount of spaghetti code that will be a pain to work with

STALKER!! jk :)

 

Yeah no more being lazy, but I still have school work to do( college ), so sometimes I have to just come back to my code when I do prioritize my work. I still want to practice my coding ( college alone wont teach you everything :) ) but I still have things to do, you can easily lose half day just coding something haha. Thank you for the modularity advice very much appreciated. I have spring break coming up soon so after all the partying ;) I'll be hard at work getting this program to be much more efficient. 

[ Cruel Angel ]:     Exterior  -   BENQ XL2420T   |   SteelSeries MLG Sensei   |   Corsair K70 RED   |   Corsair 900D  |                                                                                                    CPU:    -   4.7Ghz @ 1.425v             |

                             Interior    -   i7 4770k   |    Maximus VI Formula    |   Corsair Vengeance Pro 16GB    |   ASUS GTX 980 Strix SLIx2  |  840 Pro 512Gb    |    WD Black 2TB  |           RAM:   -   2400Mhz OC @ 1.650v    |

                             Cooling   -   XSPC 120mm x7 Total Radiator Space   |   XSPC RayStorm    |    PrimoChill Tubing/Res  |                                                                                             GPU:   -   1000Mhz @ 1.158            |

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

×