Logic Bug need getting rid of

protected int block(int indexOne, int indexTwo)     //to determine the win value if blocking
  {                         //return 0 if the move is a block, -1 if block failed
    int[][] tempBoard = new int[3][3];
    int winValue;
    for(int i = 0; i < 3 ; i++)
      for(int b = 0; b < 3; b++)
        tempBoard[i] = ticTacToeBoard;
tempBoard[indexOne][indexTwo] = 2;
for(int i = 0; i < 8; i++)
int one = tempBoard[winGameChecks[i][0][0]][winGameChecks[i][0][1]];
int two = tempBoard[winGameChecks[i][1][0]][winGameChecks[i][1][1]];
int three = tempBoard[winGameChecks[i][2][0]][winGameChecks[i][2][1]];
if(one != 0 && one == 1 && two == 1 && three == 2)
{return 0;}
if(one != 0 && three == 1 && two == 1 && one == 2)
{return 0;}
if(one != 0 && one == 1 && three == 1 && two == 2)
{return 0;}
return -1;
Part of my tic tac toe program, Ive narrowed down my logic problem to here. I am using a minimax algorithm and the block method is the only one that can set the my winValue for the minimax to 0, after the first 2 times this thing is called, it does what its supposed to do and check for the positions that a computer can use to block, now a problem arises when the third time it is called, all my winValues for all the moves are set to 0 and the computer doesn't think like it should and just makes a random move, same thing happens with moves beyond 3. The block method is called through a forloop and is called the same was it is called the first 2 times so it has to be somewhere in the method itself where the error is occurring. If someone can help point it out, Id be most appreciative. Ill look on my own as well and see if I can find it

it goes to see if it can find a win and if it can a -1 appears as the win value of that move
I have a tree worth of nodes which each hold a different move, to determine the effectiveness of that node, the winvalue is determine for each node first then chosen in the order of negative numbers to positive numbers. The computer doesn't know which move to take yet, so it makes a children worth of nodes which contains all the possible moves the computer can make. It assigns each a winValue and it takes the -1 if there is one. Then it takes the 0 if there is one and then it takes the +1 if there is one. If there is more than one of each, a random number is generated and a random one is picked. The problem is that when 2 X's are adjacent, the winValue for everything that should be a +1 or a 0 is turned into a 0 and when the computer really should block, it picks a random move instead since all the winvalues become 0.

Similar Messages

  • Upload file - get rid of Content-Disposition: form-data;

    Hello,there.I just want to know if somebody had succesfully solved problem of getting rid of rows
    at uploaded file
    -----------------------------7d23c05be8
    Content-Disposition: form-data; name="fromflr"; filename="C:\WINDOWS\Desktop\Clock"
    Content-Type: text/plain
    "Some Data"
    -----------------------------7d23c05be8
    Content-Disposition: form-data; name="toflr"
    HARGAL
    I just need get rid of rows like
    -----------------------------7d23c05be8
    Content-Disposition: form-data; name="toflr"
    HARGAL
    and leave only "Some Data" in uploaded file.
    Any suggestion would be appreciate.

    See for example Upload taglib from Coldtags suite:
    http://www.servletsuite.com/jsp.htm

  • How to get rid of bugs in MBP?

    Greetings all,
    My daughter's boyfriend has a 2012 MacBook Pro with a bug (yes, real insects) infestation. They live in a tropical climate and the insects are more adaptable than they are in, like, California. Anyway, the insects have gotten to the point where they actually prevented the machine from starting up. The boyfriend took the machine to his local Apple store where they were able to get the machine to boot up but they refused to do anything else with the machine (ie. get rid of the bugs) because they were afraid that the bugs would get loose and infect the other machines in the store.
    Obviously, we're looking for a solution. So far, I have double bagged the machine with a No Pest strip. I opened the bag yesterday and found one or two bugs kinda flailing around in there but not much else.
    Any thoughts?
    Regards,
    Peter

    those two links were hardly advice from Dstore...., they were a comedy bit about bed bugs.
    The OP here is likely talking about tiny ants, ..living in the tropics same as the OP comment, thats most likely what shes referring to.
    Also Dstore in that thread claims:
    They are attracted to heat and CO2, the MBP makes a nice cozy nest..
    When in fact the ants / bugs are attracted to the EM of the low voltage DC running accross the logic board the critters are attracted to.
    No one is yet ready to offer a theory. But biologist Dr. William P. MacKay of the University of Texas at El Paso and entomologist Professor S. Bradleigh Vinson of Texas A&M have succeeded in eliminating a number of possible factors.
    They have found fire ant behavior does not correlate with a-c frequencies, or with the presence of ozone, electromagnetic or magnetic fields. Nor is the type of insulation used on wiring a factor. In tests up to 140V a-c and 350V d-c, both attracted almost the same number of ants at the same voltage and distance. However, they did find that when electricity was turned off, ants attracted to d-c power dispersed more rapidly than those who had been experiencing the nirvana of an a-c source.
    While the Texas researchers still don’t understand the reasons why the ants have a fatal attraction to electric fields, they have been able to devise successful control techniques. Based on their studies, they recommend using terminal cap protectors to prevent bridging, and denying entrance to the insects by enclosing mechanical relays in metal or plastic cases and sealing them, as well as all entrances to padmounted equipment, with epoxy cement. In laboratory tests, silicone rubber sealants and roofing cement proved ineffective.
    why insects are attracted to laptops etc:
    https://www.youtube.com/watch?v=3vVUh-194vU

  • Upgrading from Logic 7 to 9 - can't get rid of XSKey

    I have Logic Pro 7 Retail full version (not Academic) and bought Logic Studio 2 Upgrade partly so I could get rid of the XSKey dongle. I had to switch to Re**er for mobile recording because I couldn't count on remembering to pack the dongle with a thousand other peices of gear.
    I did a regular clean install of Logic Studio upgrade with the dongle plugged in. When I try to restart without the dongle it asks for the Upgrade serial, and then on the next popup it says "Please enter your original serial number, or insert your Logic XSKey."
    I've found a couple of anwers on discussion boards that say "The SN is on the front of your Logic 7 'Installing Your Software' booklet." I've entered both numbers that are there and neither one works. One is an MPN, presumably manufacturer's part number, the other is Support ID, presumably just a Support ID, not a SN. I also tried entering the XSKey ID, and that doesn't work either.
    Help!

    Download the "XSKey Updater" http://support.apple.com/downloads/XSKey_Updater and and run it. It will display the serial number of your XSKey. This is the "original serial number" you need to enter (15 digits). If you keep that, you no longer have to enter the XSKey to authorize a fresh install of Logic.

  • Help... My macbook pro is full of bugs! It has gone really slow only had it 18 months, just downloaded MacKeeper and it says I have over 1000 bugs, I have no idea how to get rid of them! :/

    Please help me bug fix my mac, I'm not very tech savvy and need to get rid of these bugs, just downloaded MacKeeper but it only cleared up 98 bugs of thousands

    The biggest bug on your computer right now is MacKeeper. Remove it ASAP:
    The Safe Mac » Beware MacKeeper
    How to Remove MacKeeper

  • If i reset my ipad can i install paye games for free if i sign back into my apple ID. Please i need help because i need to update my games but i need to put in this billing thing and i want to get rid of it so then i cant buy games with my credit card

    If i reset my ipad can i install paye games for free if i sign back into my apple ID. Please i need help because i need to update my games but i need to put in this billing thing and i want to get rid of it so then i cant buy games with my credit card

    Hello,
    As frustrating as it seems, your best to post any frustrations about the iPhone in the  iPhone discussion here:
    https://discussions.apple.com/community/iphone/using_iphone
    As this discussion is for iBook laptops.
    Best of Luck.

  • A UK calendar has appeared on my phone. I live in New Zealand and don't need a reminder of the Battle of the Boyne! How do I get rid of it (why is it there)? There is no option to delete.

    A UK calendar has appeared on my iPhone 5s. I live in New Zealand and don't need a reminder of the anniversary of the Battle of the Boyne!. It just appeared after the last update. No option to remove it in edit. How can I get rid of it? A New Zealand holiday calendar would be a help instead!

    Set the home page to http://www.google.co.nz/
    *https://support.mozilla.com/kb/How+to+set+the+home+page

  • I have 2 apple ID and I need to get rid of one to use icloud on my iphone and ipad. any suggestion?

    I have 2 apple ID and I need to get rid of one to use icloud on my iphone and my ipad. Any suggestion?

    Hi Pierre,
    There's no way to merge them yet, so all you can do now is make 1 of them the master ID for iCloud. You have to continue to use the other for previous iTunes, Mac App Store updates. Have you read:
    Apple IDs and iCloud
    Al

  • I just updated my iTunes, and I need to delete photos from my iPod 4, and there is a Photo Library that synced to my iPod when i plugged it into my computer, and now it doesnt have the option to delete them off my iPod. How do I get rid of these photos?

    I just updated my iTunes, and I need to delete photos from my iPod 4, and there is a Photo Library that synced to my iPod when i plugged it into my computer, and now it doesnt have the option to delete them off my iPod. How do I get rid of these photos? I have read other questions that say to plug the iPod into the computer and like un-sync it, but I downloaded the new iTunes and it doesnt have a photos tab. Does anyone know how to solve my problem? Please and Thank You, Megan!

    Just what did you do to the computer?
    It sounds like the iPodf is seening the iTunes libary as a new libary.

  • I have 40 cents in my iTunes account that i need to spend in order to change my country but nothing is 40 cents, how can i get rid/spend this 40c.????Some one please help.

    hey everyone, so i accidently changed my country, i don't know how but i  did and now i want to change it back but in order to do that i need to spend all of my lef over money... thats the problem i only have 40 cents left nd nothing is 40 cents. Can anyone tell tell me how to get rid/spend 40 cents please??, someone please help

    See:
    How to manage unused iTunes Gift Card and Gift Certificate balances

  • How to get rid of the banner in the middle that tells me the email is from/to, etc, I don't need that to take up space

    I don't need to know who the email is from - again. It tells me that in the list of messages. I certainly don't need to be told that it came to me. In fact, none of that information is relevant. If I tag it I can tell by the colour where/what it is. All that info is reduntant, I can put the controls in the control bar but with that wide band in the middle, I lose the screen space for either list of messages or the actual message. Before the last edition I could get rid of it but not now to my knowledge.
    BTW, the uploading of screenshot doesn't seem to work. The .jpg is 111kb, which doesn't seem to be big but maybe it is.

    If you are talking about the header bar of the Message Pane the only way to get rid of it completely is to close the message pane by pressing F8.
    There is a add on called Compact Header that will let you make it smaller.
    https://addons.mozilla.org/en-US/thunderbird/addon/compactheader/?src=ss
    I do not think this forum lets you post an image on the original post. I have not tried it but lots of people have trouble doing it.

  • I bought my I phone 4 from a pawn shop and I need to know how to get rid of the old owners apple ID and use mine

    I need to know how can I get rid of the old owners apple ID so that I can use mine to be able to down load stuff from I tunes and get rid of his / hers apps
    Please can someone help me I bought this phone from a pawnshop.

    Restore the iphone.
    http://support.apple.com/kb/ht1414

  • TS3112 I tried using sudo rm to get rid of remote desktops but the terminal responded as needing password and yet would not let me type in anything.  help please.

    I tried to type in details but unable to do so.  we lived in a gated apt buildings in Hi with 24-hour security guards and cameras.  This false sense of security led us to foolishly leave the computer on all the time, not log off even when out shopping.  Never expect people would open our locks (three locks) and walked into our apt while we were out.  We have dishes, clothes and corning vision cookwares missing.  We have all our important docs including computer serial numbers.  We noticed our computer not respond and files and applications move around.  We know they are not done by themselves and looked into console log list.  The person who remotely logs or links with our computer thought that we are old folks and knew little about how to discover their act. Tried many times to get rid of it but was not successful.  Finally today we hauled our  imac to the apple store and explained the need to get rid of remote desktop.  All went well and we thought our computer is at a factory installed state.   We forgot to start firewall, probably did not disconnect third party help status (apple store third party).  Forgot to write down cable provider IP and resulted in using wi fi.  Look into system log list and other diagnostics messages and found an mac book pro and went back to see if I can write down the entire message but this time it went blank.  system log blank, library logs blank and /var/logs blank and so is user log.  Activity monitor froze would not open.  We had it clean up in apple store today november 18, 2013.  We have an Imac and don't know anyone who owns mac book pro with log message dated on oct 22.  The question is how it still hangs around after reset at the apple store and how to get rid of it and if it is possible?  greatly appreciated. 

    The Terminal is letting you type it in. It just doesn't display anything when you do.
    (92983)

  • Help! Need to get rid of MacKeeper and Spinning Wheel!

    Hello Apple Community,
    I have a problem that has been solved by one member of the community, however, I am still having the same problem.  I thought I knew my mac pretty well however, I was one of those stupid people who installed MacKeeper in hopes of cleaning up my macbook pro and get the spinning "wheel of death" to STOP!
    I have read the posts and the comments from previous threads.  One in particular was posted by "uvistr" requesting help with the same problem I am having.  The community member, "etresoft", provided a great solution.  However, I tried to follow the directions to re-install mackeeper and then un-install, but I could not find any information in my logs with anything related to mackeeper. When I went to the mackeeper site, the only way I could re-load it was to buy it again!  I feel like I am going in circles!
    I thought I had deleted, dumped, trashed MacKeeper, but I still have the white screen on my desktop that says "unistall mackeeper". Only the GREEN light is available to use and of course I only just get a bigger screen!  Nothing is on the screen and there are no options in the finder (that I have found) to delete this white screen.
    I do know that I didn't un-install it correctly based on the information from "etresoft".  I am at the point of getting rid of everything on my macbook and then re-install everything.  I have everything backed up on an external hard drive. 
    Once I get MacKeeper off of my machine, will the spinning wheel stop?  OR does anyone think there is another problem that is causing it to constantly spin?  I have checked with Comcast and am running at their top speed.  I have the latest upgrade of OSX Lion and have deleted all pictures and movies from my hard drive.  Any thoughts?
    Thanks for any help that can be provided.....

    No, you do not need MacKeeper.  Removing MacKeeper will help.
    If your Mac runs slowly
    http://support.apple.com/kb/PH10798
    Start up in Safe Mode
    http://support.apple.com/kb/PH11212
    Repair Disk
    Steps 1 through 7
    http://support.apple.com/kb/PH5836
    Increase Disk space
    http://support.apple.com/kb/PH10677?viewlocale=en_US
    Reset SMC.     http://support.apple.com/kb/HT3964
    Choose the method for:
    "Resetting SMC on portables with a battery you should not remove on your own".
    Reinstall OS X
    http://support.apple.com/kb/PH10763?viewlocale=en_US
    Best.

  • There is  Red Icon at the top bar and it says I have a virus and things keep popping up saying I have a virus and need to do a scan and pay for some sort of software to complete the scan, someone told me that this is a virus in. How do I get rid of it?

    There is  Red Icon at the top bar and it says I have a virus and things keep popping up saying I have a virus and need to do a scan and pay for some sort of software to complete the scan, someone told me that this is a virus in. How do I get rid of it?

    This could well be the notorious Mac Defender - which is an annoying program that tricks you into thinking that your Mac is infected with a virus, when the only infection is Mac Defender itself.
    When surfing the web never EVER click on a link that says "Free anti-virus scan" or "Scan now" - they are nearly always scams which will end up infecting your computer.  Although Macs are resistant to viruses, they're not resistant to user stupidity.
    If you Google "Mac defender" then you'll find plenty of sites with instructions on how to remove this minor nuisance.  Take this as a warning that you need to be more careful in your surfing habits.
    Bob

Maybe you are looking for