Home | Community | Message Board

Avalon Magic Plants
This site includes paid links. Please support our sponsors.


Welcome to the Shroomery Message Board! You are experiencing a small sample of what the site has to offer. Please login or register to post messages and view our exclusive members-only content. You'll gain access to additional forums, file attachments, board customizations, encrypted private messages, and much more!

Jump to first unread post Pages: 1
Invisiblekoraks
Registered: 06/02/03
Posts: 26,667
Re: Ive been doing c++ coding challenges [Re: SleepyE]
    #28630587 - 01/22/24 12:58 AM (5 days, 21 hours ago)

Quote:

SleepyE said:
When i finally finished the code I posted it into chatgpt and ask it to explain/summarize my code and this is what it had to say!




:needssalt:

Goes to show that ChatGTP isn't very useful in evaluating assignments etc.

I haven't looked at everything, but a quick peek suggests that there are far more elegant solutions than the proliferation of highly redundant functions you define in CheckerBoard.h lines 41-73.

It also looks like you haven't leveraged the use of arrays, lists or other types of containers yet, going by a quick peek at CheckerBoard.cpp, which is also rich in highly redundant and repetitive code.

What's the point in having two identical classes (PlayerPiece & PlayerPiece2)?

Here's a suggestion: when making a new function and you find yourself copying an existing function and adjusting a few bits here and there, you're creating redundancy in your code and probably overlooking a more elegant solution. Mind you, highly redundant code is sometimes preferable for performance issues, but in this type of application and the type of exercise you're doing, it certainly isn't.


Extras: Unfilter Print Post Top
Invisiblekoraks
Registered: 06/02/03
Posts: 26,667
Re: Ive been doing c++ coding challenges [Re: SleepyE] * 1
    #28630605 - 01/22/24 02:01 AM (5 days, 20 hours ago)

Quote:

SleepyE said:
yeah i definitely have to simplify my code. I was more concerned with getting it working. the simplifying of repetitive code has to come after. I think it will be a good exercise though!



Sure. It's good to make both things go hand in hand though. After the first handful of exercises, you really need to be able to solve the problem in an efficient way. If you don't, you'll be stuck with a high level of redundancy and that will stand in the way of doing more complex programs. You hit that wall pretty quickly.


Extras: Unfilter Print Post Top
Invisiblekoraks
Registered: 06/02/03
Posts: 26,667
Re: Ive been doing c++ coding challenges [Re: SleepyE] * 1
    #28630613 - 01/22/24 02:20 AM (5 days, 20 hours ago)

Two things will make a major difference:

1: Arrays and other containers (https://en.cppreference.com/w/cpp/container)

2: Finite state machines (e.g. https://www.aleksandrhovhannisyan.com/blog/implementing-a-finite-state-machine-in-cpp/)


Extras: Unfilter Print Post Top
Jump to top Pages: 1


Similar ThreadsPosterViewsRepliesLast post
* Go to the store and name your price! with re-code.com
( 1 2 all )
Lana 4,329 39 06/03/03 10:22 AM
by Raadt
* Coding Theory HighTek 581 2 03/11/09 04:42 PM
by HighTek
* Why is coding cool?
( 1 2 all )
Epigallo 1,477 20 02/11/09 04:42 PM
by PlayDoh
* . dr_gonz 1,027 12 04/13/05 12:36 PM
by lackobreath
* Microsoft Office Key Code Banez 1,126 5 05/12/07 04:25 AM
by Banez
* spaghettification of code...
( 1 2 all )
Annapurna1 2,442 34 10/08/08 04:12 PM
by ExplosiveMango
* Designing Codes, Possible to make undecipherable?
( 1 2 all )
HagbardCeline 4,182 20 08/31/03 07:49 PM
by Mal_Fenderson
* Crack this code! It should be easy!
( 1 2 all )
gir 2,404 22 06/06/03 03:12 AM
by SHiZNO

Extra information
You cannot start new topics / You cannot reply to topics
HTML is disabled / BBCode is enabled
Moderator: trendal, automan, Northerner
69 topic views. 0 members, 0 guests and 2 web crawlers are browsing this forum.
[ Show Images Only | Sort by Score | Print Topic ]
Search this thread:

Copyright 1997-2024 Mind Media. Some rights reserved.

Generated in 0.022 seconds spending 0.005 seconds on 15 queries.