游戏设计:让电脑玩游戏 [英] Game design : Making computer play

查看:89
本文介绍了游戏设计:让电脑玩游戏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在基于计算机,两个玩家,棋盘游戏,如何让电脑玩?

有没有正式的方法来_teach_电脑,选择最好的可能

移动?


我知道这是一个偏离主题的地方。请重定向我,如果有
更合适的新闻组。


非常感谢。

In computer based, two player, board games, how to make computer play?
Are there any formal ways to _teach_ computer, to choose best possible
move?

I know this is kind of off-topic here. Please redirect me, if there
are more appropriate newsgroup.

Many thanks.

推荐答案

2008年4月14日星期一00:13:56 -0700,v4vijayakumar写道:
On Mon, 14 Apr 2008 00:13:56 -0700, v4vijayakumar wrote:

在基于计算机,两个玩家,棋盘游戏,如何让电脑玩吗?

有没有正式的方法_teach_电脑,选择最好的

移动?
In computer based, two player, board games, how to make computer play?
Are there any formal ways to _teach_ computer, to choose best possible
move?



这取决于游戏的类型。对于某类游戏,例如
可以使用`minimax method`_。


... _minimax方法: http://en.wikipedia.org/wiki/Minimax


Ciao,

Marc''BlackJack''Rintsch

That depends on the type of the game. For a certain class of games one
can use the `minimax method`_ for instance.

... _minimax method: http://en.wikipedia.org/wiki/Minimax

Ciao,
Marc ''BlackJack'' Rintsch


v4vijayakumar说:
v4vijayakumar said:

在基于计算机,两个玩家的棋盘游戏中,如何让电脑玩?
In computer based, two player, board games, how to make computer play?



写一些能解决计算机播放器应该做的代码。如果你想要更好的答案,请提出更好的答案。

Write some code that works out what the computer player should do. If you
want a better answer, ask a better question.


有没有正式的方法_teach_计算机,选择最好的

搬家?
Are there any formal ways to _teach_ computer, to choose best possible
move?



这是一个更好的问题。显而易见的方法是DFS,BFS和数据库。


例如,采取步步高,计算机先行。你滚动PRNGs

并得到6,1。你(电脑)之前从未玩过这个游戏,所以

你没有好的动作数据库。您的法律行动是:


24,18和24,23

24,18和8,7

24,18和6,5

13,7和24,23

13,7和8,7

13,7和6,5


这些,哪个最好? DFS(深度优先搜索)和BFS

(广度优先搜索)可以帮助您回答这个问题。你做的是

为这个位置定义一个评估函数,基于诸如如何
多次墨迹,条形图上有多少,你是否有素数这样的东西,等等上。然后

你*在模拟中玩游戏*,尽可能深入(实际上不会是非常深的b $ b),一直在评估。一旦你找到了对你最好的(或者最小的伤害)你最好的(或者最小的伤害)位置,不管是什么掷骰子,对手都可以得到
,无论他多么娴熟或者她玩,你知道

让你的电脑玩家接下来做什么。


如果你聪明,你会保留解决方案树周围,只破坏它不会被再次使用的

位 - 为了节省你的下一轮

的处理时间。


如果你真的很聪明,你会在

文件中写下很多这样的信息,这是一本开头的书,所以你不要每次都要从头开始计算

。例如,在上面的情况下,

没有必要计算,因为它是明智的:13,7和8,7是

远和离开最好的举动。

That''s a better question. The obvious ways are DFS, BFS, and databases.

For example, take backgammon, and computer goes first. You roll the PRNGs
and get 6, 1. You (the computer) have never played this game before, so
you don''t have a database of good moves. Your legal moves are:

24,18 and 24,23
24,18 and 8,7
24,18 and 6,5
13,7 and 24,23
13,7 and 8,7
13,7 and 6,5

Of these, which is the best? DFS (Depth-First Search) and BFS
(Breadth-First Search) can help you answer that question. What you do is
define an evaluation function for the position, based on things like how
many blots, how many on the bar, whether you have a prime, and so on. Then
you *play the game* in simulation, as deeply as you can (which won''t be
very deep, actually), evaluating all the time. Once you''ve found the
position that does you most good (or least harm) no matter what die-rolls
the opponent may get and no matter how skilfully he or she plays, you know
what to get your computer player to do next.

If you''re clever, you''ll keep the solution tree around, destroying only the
bits of it that won''t ever be used again - to save processing time on your
next turn.

If you''re really clever, you''ll write a lot of this information down in a
file, a sort of opening "book", so that you don''t have to calculate
everything from scratch every time. For example, in the above situation,
there is no need to calculate, because it''s a no-brainer: 13,7 and 8,7 is
far and away the best move.


我知道这是一个偏离主题的地方。请重定向我,如果有
更合适的新闻组。
I know this is kind of off-topic here. Please redirect me, if there
are more appropriate newsgroup.



comp.programming可能就是你想要的地方,至少开始用




-

Richard Heathfield< http://www.cpax.org.uk>

电子邮件:-http:// www。 + rjh @

谷歌用户:< http://www.cpax.org.uk/prg/writings/googly.php>

Usenet是一个奇怪的放置" - dmr 1999年7月29日

comp.programming is probably where you want to be, at least to start off
with.

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999


4月14日,12:13 * pm,v4vijayakumar< vijayakumar.subbu ... @ gmail.com>

写道:
On Apr 14, 12:13*pm, v4vijayakumar <vijayakumar.subbu...@gmail.com>
wrote:

在基于计算机,两个玩家,棋盘游戏,如何让电脑玩?

有没有正式的方式来_teach_电脑,选择最好的

移动?


我知道这是一个偏离主题的地方。请重定向我,如果有
更合适的新闻组。


非常感谢。
In computer based, two player, board games, how to make computer play?
Are there any formal ways to _teach_ computer, to choose best possible
move?

I know this is kind of off-topic here. Please redirect me, if there
are more appropriate newsgroup.

Many thanks.



你应该拿起一些不错的人工智能书,并在游戏部分查看

。他们中的大多数都拥有它。教电脑

几乎就像告诉它所有的可能性。实际教学

告诉计算机如何确定哪种可能性最好。

即使用启发式算法。所有可能性通常都是以树木为代表的b $ b,一步是另一种。然后还有

修剪技术,我们处理的概念很简单,我们处理的是
最小化对手获得并最大化你自己的概念。所以你设计

这样的启发式方法。 (例如在tic tac toe的游戏中,有
可以说是5个动作,而启发函数是

给定玩家的动作数量赢得......和电脑

计算出4分为他而3分为你进行一定的动作....他将支付下一步的动作对他来说可能是3,对你来说可能是4和

执行该移动)。这是一个非常简单的应用程序,但这是怎么回事。有许多搜索启发式算法,一些

盲搜索算法等。它们在游戏玩法中非常重要

不仅仅是棋盘游戏,而是几乎全部。他们是基础。

所以我建议你打开一些基本的AI书。

You should pick up some nice Artificial intelligence book and see for
the game playing section. Most of them have it. Teaching the computer
is almost like telling it all the possibilities. The actual teaching
is telling the computer how to decide which possibility is the best.
That is by using heuristics. All possibilities are normally
represented as trees, one move leading to another. Then there is are
pruning techniques, miny-maxy things where we deal with the concept of
minimizing opponents gain and maximizing your own. So you design
heuristics like that. (For example in the game of tic tac toe, there
can be say 5 moves to be made, and the heuristic function is the
number of moves a given player will win in.... and the computer
calculates that its 4 for him and 3 for you for a certain move.... he
will pick the next move with is maybe 3 for him and 4 for you and
execute that move). This is a very simplistic application but this is
how it goes. There are many searching heuristic based algorithms, some
blind search algorithms etc. They are very important in game playing
not just board ones but almost all of them. They are the foundation.
So I would recommend you to open some elementary AI book.


这篇关于游戏设计:让电脑玩游戏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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