pls healp deal or no deal

This is a discussion on pls healp deal or no deal within the C Programming forums, part of the General Programming Boards category; can someone add my program to get 6 briefcase then compute 4 offer base on philipppine deal or no deal ...

  1. #1
    Registered User
    Join Date
    Aug 2008
    Posts
    19

    pls healp deal or no deal

    can someone add my program to get 6 briefcase then compute 4 offer

    base on philipppine deal or no deal that's is why the amount looks like that
    Code:
    #include <stdio.h>
    #include <conio.h>
    #include <stdlib.h>
    
    long int a[26]={1,5,10,25,50,75,100,150,200,250,300,400,500
    ,1000,2500,5000,10000,25000,50000,75000,100000,250000,500000,1000000
    ,2000000,3000000};
    long int b[26];
    int player;
    
    main(){
    	int ctr,ctr2;
    	clrscr();
    	srand(time(NULL));
    	for(ctr=0;ctr<26;ctr++){
    	       again:
    	       b[ctr]=a[random(26)];
    	       for(ctr2=ctr-1;ctr2>=0;ctr2--){
    	       if(b[ctr] == b[ctr2])
    	       goto again;
    	       }
    	}
    	printf("Choose one of the briefcase");
    	printf("\nThis will be your briefcase\n");
    	scanf("%d",&player);
    	printf("You have chosen your briefcase.");
    	getch();
    	printf("\nRound 1\nOpen 6 briefcases\n");
    	
    
    	getch();
    }

  2. #2
    Registered User whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    7,525
    I wouldn't recommend the use of goto at all in this simple program. Especially not in your shuffling of the briefcases (at least I think that's what you're doing). Something simple like this would work:

    Code:
    void shuffle ()
    {
        long int temp;
        int n = 0, rnd = 0;
    
        srand(time(NULL));
        while (n < 26) {
            rnd = rand() &#37; 26;
            temp = briefs[n];
            briefs[n] = briefs[rnd];
            briefs[rnd] = temp;
            n++;
        }
    }
    On the show, the banker usually takes the mean of the amounts left, but he gets really stingy after the bigger amounts are opened. So the offer is more like a weighted average in that bigger amounts count for more. You can calculate that, right?

  3. #3
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    If you look at the previous thread asking about how to calculate the banker's offer I think my points apply to your program as well. I would take the mean and multiply it by the probability of getting the larger valued cases available. Which is why the banker would get stingier since the coefficent will initially not make much change in the mean value.

    I have no exact algorthim and I have not watched the show much but there seems to be a random element to the show.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Deal or No Deal listbox prob
    By kryptkat in forum Windows Programming
    Replies: 5
    Last Post: 03-30-2009, 06:53 PM
  2. pls fix my deal or no deal program
    By llinocoe in forum C Programming
    Replies: 5
    Last Post: 09-23-2008, 11:37 AM
  3. i dont know what to do. pls. help!!!!
    By Unregistered in forum C++ Programming
    Replies: 14
    Last Post: 03-14-2002, 02:24 PM
  4. help me pls..... :(
    By mocha_frap024 in forum C++ Programming
    Replies: 2
    Last Post: 02-22-2002, 09:46 AM
  5. pls help me!!
    By hanseler in forum C++ Programming
    Replies: 1
    Last Post: 12-05-2001, 07:46 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21