有人可以解释这个算法吗? [英] Can someone explain this algorithm ?

查看:154
本文介绍了有人可以解释这个算法吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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;
	}





我的尝试:



我不明白这个算法?

有人可以帮帮我吗?

提前谢谢。



What I have tried:

I don't understand this algorithm ?
Can someone help me please ?
Thanks in advance.

推荐答案

引用:

那么你能解释一下我的negamax算法吗?

So can you explain me the negamax algorithm in general please ?



维基百科可以: Negamax - 维基百科 [ ^ ]


这篇关于有人可以解释这个算法吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆