473,625 Members | 3,330 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Game design : Making computer play

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.
Jun 27 '08 #1
14 2331
On Mon, 14 Apr 2008 00:13:56 -0700, v4vijayakumar wrote:
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?
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
Jun 27 '08 #2
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.
Are there any formal ways to _teach_ computer, to choose best possible
move?
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.programmin g 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
Jun 27 '08 #3
On Apr 14, 12:13*pm, v4vijayakumar <vijayakumar.su bbu...@gmail.co m>
wrote:
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.
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.
Jun 27 '08 #4
On Apr 14, 12:35 pm, Richard Heathfield <r...@see.sig.i nvalidwrote:
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.
I am just implementing a game played in my village (Tamilnadu /
India), called "aadupuli" (goats and tigers). There are only 23
positions and 18 characters (15 goats and 3 tigers). Some of you might
be aware of this.

I can post initial version of the game (implemented using html/
javascript) in couple of hours here.

Welcome any help in making computer to play one of these player.
Jun 27 '08 #5
[comp.programmin g added, and followups set to that group]

v4vijayakumar said:
On Apr 14, 12:35 pm, Richard Heathfield <r...@see.sig.i nvalidwrote:
>v4vijayakuma r 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.

I am just implementing a game played in my village (Tamilnadu /
India), called "aadupuli" (goats and tigers). There are only 23
positions and 18 characters (15 goats and 3 tigers). Some of you might
be aware of this.

I can post initial version of the game (implemented using html/
javascript) in couple of hours here.

Welcome any help in making computer to play one of these player.
comp.programmin g would be a better group.

I've found a picture of the board, but I can't find the rules anywhere,
without which the task is impossible. Can you tell us what they are?

If you reply, I suggest you do so in comp.programmin g.

--
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
Jun 27 '08 #6
v4vijayakumar wrote:
) On Apr 14, 12:35 pm, Richard Heathfield <r...@see.sig.i nvalidwrote:
)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.
)
) I am just implementing a game played in my village (Tamilnadu /
) India), called "aadupuli" (goats and tigers). There are only 23
) positions and 18 characters (15 goats and 3 tigers). Some of you might
) be aware of this.

Odd, I thought there were 25 positions, 20 goats and 4 tigers.
*googles* Oh wait, that is Bagh Chal. Roughly the same rules,
different board layout and number of tigers.

) I can post initial version of the game (implemented using html/
) javascript) in couple of hours here.
)
) Welcome any help in making computer to play one of these player.

If the board is that small then an exhaustive search might work,
but then the computer would be unbeatable.

Minmax would be best I guess.
SaSW, Willem
--
Disclaimer: I am in no way responsible for any of the statements
made in the above text. For all I know I might be
drugged or something..
No I'm not paranoid. You all think I'm paranoid, don't you !
#EOT
Jun 27 '08 #7
On Apr 14, 1:00 pm, v4vijayakumar <vijayakumar.su bbu...@gmail.co m>
wrote:
....
I can post initial version of the game (implemented using html/
javascript) in couple of hours here.
The game is here,

http://v4vijayakumar.googlepages.com...nd-tigers.html
Jun 27 '08 #8
On 14 Apr, 09:13, v4vijayakumar <vijayakumar.su bbu...@gmail.co m>
wrote:
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.
can you post a link to the game so I can see the rules and how the
board looks.
/hopefully going to india soon
Jun 27 '08 #9
sk*******@yahoo .se said:
On 14 Apr, 09:13, v4vijayakumar <vijayakumar.su bbu...@gmail.co m>
wrote:
>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.

can you post a link to the game so I can see the rules and how the
board looks.
Here's the board (which bears only a slight resemblance to one I'd seen on
the Web):

+---------------+
| HORN $ |
+---+---+---+---+---+---+
|L W| | $ | $ | |R W|
+E-I+--CHEST+---+---+I-I+
|F N| | | | |G N|
+T-G+---+---+---+---+H-G+
| | | | | |T |
+---+---+---+---+---+---+
| LEGS| | |
+---+---+---+---+

There are three tigers and fifteen goats.
The tigers' goal is to eat all the goats and remain mobile.
It seems that the initial tiger positions are: one on the horn, and one
each on CHEST-2 and CHEST-3 (see $ marks, above).
The goats' goal is to block the tigers from moving.
The goats are placed one by one.
Tigers appear only to be able to move orthogonally (up/down/left/right) -
although they can use the horn to whizz across the chest (e.g. CHEST-1 to
HORN, HORN to CHEST-4, in two moves).
The rest of the rules are beyond me, I'm afraid. It's not clear how tigers
eat goats or how goats block tigers.

--
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
Jun 27 '08 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
4402
by: BlackHawke | last post by:
My name is Nick Soutter, I own a small game development company (www.aepoxgames.net) making our first game (www.andromedaonline.net) in java. I am writing because we are having a very serious problem, and I was hoping someone might have thoughts.
3
2617
by: Sam | last post by:
Hey all, I want to create a computerised version of this game, though I'm not really sure how to go about it. For those who don't know how the game works, here's my attempt at a brief description: It is very similar to the card game Uno, though played with a standard deck of cards. An initial card is played off the top of the deck, and then each player has to play a card of the same suit, or the same face value in another suit....
138
6500
by: theodp | last post by:
--> From http://www.techdirt.com/articles/20040406/1349225.shtml Microsoft Patents Saving The Name Of A Game Contributed by Mike on Tuesday, April 6th, 2004 @ 01:49PM from the yeah,-that's-non-obvious dept. theodp writes "As if there weren't enough dodgy patents, here's an excerpt from one granted to Microsoft Tuesday for a 'Method and apparatus for displaying information regarding stored data in a gaming system': 'When saving a game,...
11
2548
by: enki | last post by:
I am writing a game and I am having trouble with moving the character on the map. Here is what I have right now. It involves win32 programming but that not my problem. I would like some suggestions how I can make my code better. If you need more code I will post it. I am in early devlopment of the game. map.h:
6
1767
by: ume$h | last post by:
Four Win Description To program the play named "four win", the background board should consist of a lattice with 7 columns, into which in each case 6 stones fit. The playing field stands perpendicularly, so that a stone falls always widen-possible downward. The rules are :
1
1432
by: =?Utf-8?B?c2hhcmVu?= | last post by:
im having a problem with my computer im trying to play sims2 seasons and every time i try to start the game it gives me an error msg 0x0000005 ive been unable to play this game for 6 months and its pissing me off . someone must help ive already uninstalled the game and reinstall many times and the problem is still there . my computer is updated and everything it clean , please can someone help me it is very frustrating .
1
3087
by: Gomi | last post by:
Hi guys I'm new to C++ Programming and I am having trouble in making my Guessing game code replay. I am suppose to give the user that is playing my game the opportunity to play again with options of 'Yes' and 'No' and if Yes then the game starts up again and if No then the game tells the user bye and quits. "Do you want to play again? (y/n)" Please Help if possible thanks. ^^ -----------------------------------------
1
4644
by: Leiram | last post by:
I am trying to write a game where there is 13 stones and you play against the computer to make sure that you don't take the last stone. You or the computer (depending on the turn) is allowed to take 1, 2, or 3 stones during their turn. I am kind of lost at the moment. I have several methods and I want to send several things between them. One is who is playing and the other is how many stones there are left. I am also not sure if I am just...
2
5306
by: LilMeechc20 | last post by:
Hello, I have a group assignment that I have to do. We have to write a Tic Tac Toe game. One person in my group has managed to write the code for a multiplayer (human -vs- human) game and I managed to write a code for a single player (human -vs- computer) game. My problem is, now we want to merge the two games with options to pick which game you would like to play. However, the games were written totally different styles and I can't...
0
8694
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8635
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8356
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8497
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
4089
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4193
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2621
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1803
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1500
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.