View Poll Results: What do you think of Battleship v1.3 Official?

Voters
19. You may not vote on this poll
  • Excellent

    2 10.53%
  • Above Average

    9 47.37%
  • Average

    3 15.79%
  • Below Average

    1 5.26%
  • Terrible

    4 21.05%
Like Tree1Likes

Battleship v1.3 Official

This is a discussion on Battleship v1.3 Official within the Game Programming forums, part of the General Programming Boards category; Oddly enough, my improvements seems to make the game worse...?...

  1. #16
    Registered User
    Join Date
    Feb 2003
    Posts
    51

    Hum... v1.2 seems to be more fun

    Oddly enough, my improvements seems to make the game worse...?

  2. #17
    Software Developer jverkoey's Avatar
    Join Date
    Feb 2003
    Location
    University of Waterloo
    Posts
    1,903
    Originally posted by luckygold6

    And about the computer hanging up, I can't seem to locate the error. I haven't yet, but then again, the computer seems to always beat me before I get pass six or seven rounds. I think the cause might be that the computer is randomizing attacks that are on ships or areas it has attacked before. This means that it will have to re-randomize until it has a valid attack. As less spots are available, it will take longer to strike a number because the probability of hitting blanks become less and less. I'm trying to implement a code to prevent this.
    i have a suggestion for this.

    i created a randomization program once (for the calc, but i ported it to the puter, and it's really simple) where you simply do this, i'll write it in pseudo code

    Code:
    create a boolean value and set it to false
    
    for loop count from 1 to the number of tries you want to do (IE: 4)
    do testing/random stuff to pick the positions
    if it was a spot that wasn't empty
        set the boolean value to true
        break to save time
    otherwise just keep continuing the loop
    
    once you are out of the loop:
    
    test if the boolean value is not true (meaning we didn't find a spot that hasn't been fired on yet)
        run a for loop through all the possible points until you hit the first empty one
        once you hit it, set those points to the x,y coords that you need to try
    hmm, that's almost more confusing than actual code....i'll try some real code too, lol

    Code:
    bool empty=false;	// Create the boolean variable
    COORD try;	// The testing coordinates
    
    for(int a=0;a<4;a++)
    {
    	try.X=rand()%5;	// 5 is the width of the level
    	try.Y=rand()%5;	// and again, 5 is the height
    
    	if(Map[try.Y] [try.X]>0)	// Test if the spot on your map matrix has been shot yet. I dont' know exactly how it works on your game, but i'm assuming that you are using a matrix.....
    	{
    		empty=true;	// Set the bool value to true
    		break;		// Break out of the loop to save time
    	}
    }
    
    if(!empty)	// If we couldn't find a spot.....
    {
    	for(int b=0;b<5;b++)	// Run through the whole map
    	{
    		for(int c=0;c<5;c++)
    		{
    			if(Map[b] [c]>0)
    			{
    				empty=true;
    				try.X=b;
    				try.Y=c;
    				break;
    			}
    		}
    	}
    	if(!empty)	// If we STILL haven't found a spot.....
    		// We have to have hit everything if we STILL haven't found a spot by now
    }
    
    // if we make it this far, then we're good to go, and you can just pass the try coordinate to whatever you use to test, and VOILA!
    so, in essence, what you do is you do a few random guesses, and if you can't find it within those few random guesses, then just do a loop through all the possible choices until you find a valid guess

    IM me if you're still confused

    I hope this helps!

  3. #18
    cereal killer dP munky's Avatar
    Join Date
    Nov 2002
    Posts
    655
    error.....one hit away too, damit
    Attached Images Attached Images  
    guns dont kill people, abortion clinics kill people.

  4. #19
    Pursuing knowledge confuted's Avatar
    Join Date
    Jun 2002
    Posts
    1,916
    Originally posted by Perspective
    you would probably get more comments if you posted this in the game forum....
    hmmm...it is in the game forum.
    Away.

  5. #20
    Crazy Fool Perspective's Avatar
    Join Date
    Jan 2003
    Location
    Canada
    Posts
    2,640
    Originally posted by blackrat364
    hmmm...it is in the game forum.
    it got moved to the game forum, it was in the c++ forum.

  6. #21
    Registered User
    Join Date
    Mar 2003
    Posts
    73
    Really cool game. Freezes on me too, seems like random times, but always when the enemy moves. I think it happens more when you have beeps turned on...

    Either way, I think it's good.

    (btw, why did you block out the people who helped you names out?)

  7. #22
    Registered User
    Join Date
    Mar 2003
    Posts
    17
    the ai isnt that good because it hit one of my ships and didnt even shoot where it could possibly be the next shot, when a person gets a hit they normally go above below or to either side not like a couple away. And there is too much text at begining, by looking at ur post u like to write essays but people playing games dont like to read essays so id say shorten the text at the top.
    Drink Yer Wilk

  8. #23
    Registered User
    Join Date
    Feb 2003
    Posts
    51

    Just Privacy

    I just blocked the names for privacy reasons. I didn't want them to get angry at me for posting them on the internet. If you want to know though, I'm sure they wouldn't mind. Especially me... hehe.

    Also, a note about the AI. I previously did create one that worked, however, I deleted it thinking that it was causing one of my errors. Later, I realized that one of my if() statements used the && instead of the ||, causing runtime errors. So currently, I'm implementing a very simple strategy. I'll improve it later on. Sorry about any inconvenience.

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Battleship program
    By swgh in forum C++ Programming
    Replies: 4
    Last Post: 04-07-2008, 10:02 AM
  2. Battleship Game (Win32 EXP Needed)
    By ElWhapo in forum Projects and Job Recruitment
    Replies: 2
    Last Post: 01-15-2005, 10:10 PM
  3. Battleship
    By mandingo in forum C++ Programming
    Replies: 7
    Last Post: 12-12-2004, 05:28 PM
  4. c++ battleship game
    By JTtheCPPgod in forum Game Programming
    Replies: 4
    Last Post: 01-05-2002, 11:12 AM
  5. Battleship
    By Unregistered in forum Game Programming
    Replies: 11
    Last Post: 11-29-2001, 04:35 AM

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