[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] Just finished TicTacToe, but How would I do some AI?
- To: pygame-users@xxxxxxxx
- Subject: Re: [pygame] Just finished TicTacToe, but How would I do some AI?
- From: Luke Paireepinart <rabidpoobear@xxxxxxxxx>
- Date: Sat, 22 Sep 2007 18:22:00 -0500
- Delivered-to: archiver@xxxxxxxx
- Delivered-to: pygame-users-outgoing@xxxxxxxx
- Delivered-to: pygame-users@xxxxxxxx
- Delivery-date: Sat, 22 Sep 2007 19:22:12 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:user-agent:mime-version:to:subject:references:in-reply-to:content-type:content-transfer-encoding; bh=IjKunYwdOv011R8TGO9ie4wsomgrAqztm7oGDNicJRk=; b=rq2Y2+pHa9SMRt5CPqnbTXxCMVD4L8BxOHtqZP6A0TE+d6p8V/Su7CtdblFaiKxVA9srxScRHzn15WiyXVxudd2GQY1WyNsDme8MULOrBYP25qZbSY1MKfthfHG4UF8KTwAWu0wsMUEszqMG9QYT1mgumtuRu4npz7nShYezu/s=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:user-agent:mime-version:to:subject:references:in-reply-to:content-type:content-transfer-encoding; b=tjhBsk9QpHmvJaWq0mgThsgdbAq09GX8ctyldn1k/dRBA3yHRvI2IOYmJzVeZLbHp8gC6E/7Jkg7q6QyxPpdL7dBtGTmwpnah8VHi/dZP3E8m2PX2cHOrTroOEk7O37I4zJOPa60VWxZVkIICdXuT9h8NhCgC77wzd0md5Je8iY=
- In-reply-to: <eb79828c0709221538x64d45915na86b112d5f43095c@xxxxxxxxxxxxxx>
- References: <eb79828c0709221538x64d45915na86b112d5f43095c@xxxxxxxxxxxxxx>
- Reply-to: pygame-users@xxxxxxxx
- Sender: owner-pygame-users@xxxxxxxx
- User-agent: Thunderbird 2.0.0.6 (Windows/20070728)
Lamonte Harris wrote:
Yah, http://wecodepython.info/code/TicTacToe/TicTacToe.py is the code
and http://wecodepython.info/games/TicTacToe.zip
<http://wecodepython.info/games/TicTacToe.zip> is the exe, Does anyone
know how to do AI, if so can someone explain the mechanism to doing it?
Read about A* searching algorithm.
basically you search for paths that have the highest chance of winning
and take the one with the highest chance.
Because tic-tac-toe is so simple you can just do an exhaustive search of
all possibilities, straight to the ending case in every situation,
whereas with Chess you have to do some optimizations and only look ahead
a certain number of moves, because otherwise it'd take years to perform
each move.