Click here to Skip to main content
15,894,017 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
C#
private int NegaMax(int p) {
        int End = GameOver();
        if (End != 0)
            return End;

        int best_value = (p == 1) ? 512 : 2048;
        for (int b = 1; b <= 256; b = b << 1) {
            int move = (~(X | O) & b);
            if (move != 0) {
                put(p * move);
                int s = NegaMax(-p);
                best_value = p * (s & 0xfffffe00) > p
                        * (best_value & 0xfffffe00) ? ((s & 0xfffffe00) | move)
                        : best_value;
                clear(move);
            }

        }
        return best_value;
    }
Posted
Updated 12-Jan-15 2:13am
v2
Comments
OriginalGriff 12-Jan-15 4:27am    
What process?
That's just a large code dump - and you didn't even bother to format it so it was easy for us to read!
That's rude, twice: the first time for just dumping "your" code on us, and teh second for not even trying to make things easier for us to help.

So edit that, cut it down to just the relevant bits, explain what your problem is in English, and help us to help you!

Use the "Improve question" widget to edit your question and provide better information.
Member 11269238 12-Jan-15 7:43am    
Oops, I'm so sorry. i don't know how to ask questions properly here.
Member 11269238 12-Jan-15 7:44am    
Will do. Thanks
Member 11269238 12-Jan-15 7:43am    
Thanks! I'm sorry.

1 solution

There isn't enough information to know for sure what it is. The best thing to do is run the code and step through it. It does appear to be for a game and may have something to do with the AI of the game deciding where to move.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900