Page 3 of 4 FirstFirst 1234 LastLast
Results 21 to 30 of 36

Thread: Family Crossing a BRIDGE

  1. #21
    Join Date
    Sep 2004
    Posts
    1,905
    Rep Power
    21

    Default

    I agree that LOC code can be fast, and it is often so. icymint has broken the record here. But LOC is half of the pie. A good design is the other half. You can achieve improve performance with one as far as speed goes.

    it teaches you innovative ways to approach a problem and help you to think outside the box
    Well icymint has done this time and time again. He showed me ways that I never seen before in solving problems. But I can equally show different logical designs that solve a problem. My response "when a problem is solved it is solved. The only meaningful difference is its speed"

    So how about we try to change the competition a bit to a benchmarking competition. Say a program that finds the shortest time for the family when the familily size is large, and see whose program is the fastest. Mine in its current state would loose to icymint, so I would improve the design. This problem is very generic as it is, but I know there are still non-generic shortcuts in solving it. I will make my program compete with any non-generic solution and still have the generic features that I added. Its just a suggestion, I might try spend too much time on one problem though.
    Let's act on what we agree on now, and argue later on what we don't.
    Black men leave Barbeque alone if Barbeque don't trouble you

  2. #22
    Join Date
    Jul 2005
    Posts
    75
    Rep Power
    0

    Default

    Crosswire that is what i suggest earlier, that the solution should be generic. If you analyse the problem closer if the range of the numbers were closer it would not be efficient to bring over the 2 largest number together, instead the smallest and the largest would suffice.

    I agree with you and i would think icymint does too. He usually state that his small solutions are ugly and obfusicated (hope i get that word right).

    I can't lie i am usually overwhelmed by the LOC of your solution but they are usually the easiest to trace and understand. For that i give you props, and while i said it was a LOC again don't feel too pressured by that. Not even me pay the LOC think mind, cause i could have greatly reduced mine in "Crossing the River" but never bother with that.

    We cool and you the man. More mature than me and a way better analytic mind.
    "A computer once beat me at chess, but it was no match for me at kick boxing." - Emo Philips -

  3. #23
    Join Date
    Sep 2004
    Posts
    1,905
    Rep Power
    21

    Default

    We cool and you the man. More mature than me and a way better analytic mind.
    I disagree here. We are peers, we just think differently, sometimes
    Let's act on what we agree on now, and argue later on what we don't.
    Black men leave Barbeque alone if Barbeque don't trouble you

  4. #24
    Join Date
    Dec 2002
    Posts
    500
    Rep Power
    0

    Default

    let me cut in here, cause if onnu never just start apologise, den unnu woulda start cuss, and star and number sign up the people dem forum. any way it good u people did not kick off.

    anyway back to the challenge, it seems you people want to just accept defeat. dont do that, we are still just peers.

    any way mi dun tell unnu seh a A*search (di only star allowed in this forum ) mi a go fah, which basicaly means my solution wont even be remotely close to being short. i am a bit disturbed by the LOC limit as well. i dont appreciate people setting the bar(that high), especially when their solution(and reason for the limit) is not fast, generic, uses less space than anything else.

    Like i tell you the main idea behind my menu problem was actually to create a module that we could run each others solution and the "framework" would actually do a time calculation. we could then produce a neat table of results to show whose code performed. i will show you what i mean in a few.

    I want to steal this thread and in no uncertain terms tell you that the challenge is to create the most generic/time/space efficient solution you possibly can come up with. forget LOC. when we find a few good solutions then we open it and allow everyone to fiddle with the code and make it shorter( still keeping it generic/fast ).
    Cultured in Aggression and Koding like a Warrior!!
    “Common sense is instinct. Enough of it is genius.” - George Bernard Shaw.
    "The significant problems we face cannot be solved by the same level of thinking that created them." - Albert Einstein

  5. #25
    Join Date
    Sep 2004
    Posts
    1,905
    Rep Power
    21

    Default

    I am up for that.

    I want to start another thread with 'a guide to optimizing' where I would input all that I know and anyone can input theirs. We can run short codes that demonstrates the performance changes, and give our explanation, and even make inferences.
    Let's act on what we agree on now, and argue later on what we don't.
    Black men leave Barbeque alone if Barbeque don't trouble you

  6. #26
    Join Date
    Jul 2005
    Posts
    75
    Rep Power
    0

    Default

    Icymint i don't think me and Crosswire was going to argue. I agreed with him alot more than he intially realised.

    However while i don't want participants to be intimidated by the LOC you not permitted to change my challenge. Dat not cool that you trying to take over the show.

    People as i have said don't pay too much attentjion to the LOC limit, it just stops people from posting 1000 LOC solutions, especially since that would be overkill.
    "A computer once beat me at chess, but it was no match for me at kick boxing." - Emo Philips -

  7. #27
    Join Date
    Dec 2002
    Posts
    500
    Rep Power
    0

    Default

    O.K. mi dun procrastinate, mi tink mi si di pattern mi go code it now. mi write the algorithm on paper but it didnt work all the way down when mi dry run it. di algorithm stil right though.

    i am assuming the trivial soultion to the family crossing ploblem does not exist for one person. since there is no option, you cannot go wrong, the first move you make is right, and the first move solves it optimally.
    therefore if you submit only one time to my algorithm, you can expect smoke to come from your case, monitor and speakers.
    Cultured in Aggression and Koding like a Warrior!!
    “Common sense is instinct. Enough of it is genius.” - George Bernard Shaw.
    "The significant problems we face cannot be solved by the same level of thinking that created them." - Albert Einstein

  8. #28
    Join Date
    Sep 2004
    Posts
    1,905
    Rep Power
    21

    Default

    Would like to see your code. So I can be forced to shorten and correct mine. I started but then I parked.
    Let's act on what we agree on now, and argue later on what we don't.
    Black men leave Barbeque alone if Barbeque don't trouble you

  9. #29
    Join Date
    Dec 2002
    Posts
    500
    Rep Power
    0

    Default

    Here it is, sorry it took so long to post. i dont have all the resources i'd like to.

    Code:
    #include <iostream>
    
    enum Consts { LEFT, RIGHT, MAX = 100 };
    
    typedef const unsigned curef;
    
    inline void show(curef costs[], curef where[], curef num, curef cost)
    {
    	for(unsigned i = num; i--; ) if( !where[i] ) cout << costs[ i ] << " " ;
    	cout << " ................ ";
    	for(unsigned i = num; i--; ) if( where[i] ) cout << costs[ i ] << " " ;
    	cout << " : " << cost << endl;
    }
    
    void main()
    {
    	unsigned costs[MAX]={1,3,6,8,12}, where[MAX]={0,0,0,0,0}, numCosts=5, cost=0; 
    	const unsigned secMin = costs[1], secMinX2 = (secMin << 1) - costs[0];
    
    	show( costs, where, numCosts, cost );
    	for( unsigned numLeft = numCosts, maxIndex = numCosts - 1, minIndex ; ; --numLeft)
    	{
    		if( where[1] )                   // if second slowest is on RIGHT
    		{
    			where[ maxIndex ] = RIGHT;   // move over the slowest
    			cost+= costs[ maxIndex-- ];  // add cost and move to next slowest
    
    			// carry second slowest for the TRICK, or fastest for a normal play
    			where[ costs[ maxIndex ] > secMinX2 ? maxIndex-- : 0 ] = RIGHT;
    		}
    		else
    		{
    			where[0] = where[1] = RIGHT; // move 2 fastest to RIGHT side
    			cost+= secMin ;              // add cost of second fastest
    		}
    
    		show( costs, where, numCosts, cost );
    
    		if( numLeft == 2 ) break;        // if all persons have crossed then stop
    									     // the lamp returner code... when not complete
    		minIndex = !where[0];            // find the smallest cost on RIGHT side
    		where[ minIndex ] = LEFT;        // move person to the left side
    		cost+= costs[ minIndex ];        // add the cost of moving the person
    
    		show( costs, where, numCosts, cost );
    	}
    }
    Cultured in Aggression and Koding like a Warrior!!
    “Common sense is instinct. Enough of it is genius.” - George Bernard Shaw.
    "The significant problems we face cannot be solved by the same level of thinking that created them." - Albert Einstein

  10. #30
    Join Date
    Nov 2004
    Posts
    3,170
    Rep Power
    0

    Default

    I guess programming ability is needed for this eh?
    LOS-iX--ASROCKZ77 PRO4+||INTEL i5 3570K||2x CRUCIAL BALLISTIX 8GIG DDR3 1600Mhz ||ATI RADEON HD 5770 1GB GDDR5||BL-LG 16X DVDRW||XTECH 600WATT PSU||Seagate 120GIG SSD||24" RCA LCD TV/MONITOR||Seagate 160GIG SATA||
    Life an Eternal Mask of Illussion---->IGN: Triple6/ Techlos

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •