井字棋:如何填充决策树? [英] Tic-Tac-Toe: How to populate decision tree?

查看:546
本文介绍了井字棋:如何填充决策树?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在做一个井字棋程序。我打算使用极小它。我做了一个树空间所有可能的游戏序列和我正在寻找一种方式来填充它。我目前有这种类型的:

I'm making a Tic-Tac-Toe program. I plan to use minimax with it. I made a tree with space for all possible game sequences and I'm looking for a way to populate it. I currently have this type:

typedef struct name
{
    char grid [3] [3];
    struct name * child [9];
} node;

和我正在寻找一种方式来填补电网就像它的显示的此处。我怎么会去填补电网,以确保所有可能的组合有哪些?我的计划是让游戏中认识的一举一动玩家可以拿,然后再决定采取什么步骤才能赢得(我还需要弄清楚的决定的一部分,但我持有的,直到我可以填补网格,树)

and I'm looking for a way to fill grid just like it's shown here. How would I go filling the grid to make sure that all possible combinations are there? My plan is to have the game recognize every move player can take and then decide what steps to take in order to win (I still need to figure out the decision part, but I'm holding that until I can fill the grids in tree).

推荐答案

听起来像一个总理候选人递归我...

Sounds like a prime candidate for recursion to me...

这篇关于井字棋:如何填充决策树?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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