Oddly enough, my improvements seems to make the game worse...?
Excellent
Above Average
Average
Below Average
Terrible
Oddly enough, my improvements seems to make the game worse...?
i have a suggestion for this.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 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
hmm, that's almost more confusing than actual code....i'll try some real code too, lolCode: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
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 guessCode: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!
IM me if you're still confused
I hope this helps!
error.....one hit away too, damit
guns dont kill people, abortion clinics kill people.
hmmm...it is in the game forum.Originally posted by Perspective
you would probably get more comments if you posted this in the game forum....
Away.
it got moved to the game forum, it was in the c++ forum.Originally posted by blackrat364
hmmm...it is in the game forum.
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?)
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
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.