More actions
imported>Unknown No edit summary |
(Repair batch-0001 pages from live compare) |
||
| Line 25: | Line 25: | ||
* http://jaist.dl.sourceforge.net/sourceforge/psyco/psyco-1.5.win32-py2.4.exe | * http://jaist.dl.sourceforge.net/sourceforge/psyco/psyco-1.5.win32-py2.4.exe | ||
* 기본 모듈 화일들 | * 기본 모듈 화일들 | ||
OthelloAISeminar.zip | |||
== 주요 클래스 == | == 주요 클래스 == | ||
| Line 68: | Line 68: | ||
def execute(self): | def execute(self): | ||
putableList = self.getPutableList() | putableList = self.getPutableList() | ||
posX,posY = putableList | posX,posY = putableList[0] | ||
return self.put(posX,posY) | return self.put(posX,posY) | ||
=== Evaluator interface === | === Evaluator interface === | ||
| Line 110: | Line 110: | ||
| | | | ||
|} | |} | ||
CheepPlayer.zip | |||
SmartPlayer.py | |||
Latest revision as of 23:55, 26 March 2026
| TableOfContent |
주제
간단 Othello AI 만들어보기
순서
- 간단 Othello 룰에 대한 설명
- 1차 구현
- approach : state machine
- approach : minimax
팀 구성
2-3명 당 1팀으로. 팀 내에는
- 파이썬 프로그래밍 가능한 사람 1명 이상
- 오델로 게임을 아는 사람이 1명 이상
혹은, 구현 자체가 간단하므로 간단히 문법을 도움받아서 프로그래밍 진행해도 좋음
이용 툴들(설치할 것)
- http://www.othelloclub.com/program/wz423.exe - wzebra
- http://python.org/ftp/python/2.4.2/python-2.4.2.msi
- http://jaist.dl.sourceforge.net/sourceforge/psyco/psyco-1.5.win32-py2.4.exe
- 기본 모듈 화일들
OthelloAISeminar.zip
주요 클래스
class Board getPutableList(self,aStone) 해당 돌 색에 대한 놓을 수 있는 위치들 터플들을 준다 (col,row)들 리스트
count(self,aStone) 해당 돌 색을 센다
isPutable(self, aCol, aRow, aStone) 해당 돌 색일 해당 위치에 놓을 수 있는지 여부 테스트(true/false)
tsGameOver(self) 게임 종료 조건 상태에 도달했는지에 대한 여부
class Player name(self) 해당 플레이어의 이름을 나타냄
put(self) 실제 돌을 놓음
isPutable(self,aCol,aRow) 자기 자신이 놓을 수 있는 위치인지에 대한 여부 체크
getStoneColor(self) 자신의 돌 색에 대해 스트링을 리턴
getPutableList(self) 해당 플레이어가 놓을 수 있는 위치들에 대한 리스트를 얻어옴.
1 minute tutorial
기본 뼈대
from Player import Player
class DefaultComputerPlayer(Player):
def __init__(self,aStone, aBoard):
Player.__init__(self, aStone, aBoard)
def name(self): return "MyName~"
def execute(self):
putableList = self.getPutableList()
posX,posY = putableList[0]
return self.put(posX,posY)
Evaluator interface
from evaluator import Evaluator
class SimpleEvaluator(Evaluator):
def __init__(self,aBoardSize=8):
Evaluator.__init__(self,aBoardSize)
# 해당 판에 대해 평가하는 함수
# stone 에 대해서 이 판이 몇점짜리 판인지에 대해 점수를 매긴다
def evaluate(self,board,stone):
return board.count(stone)
Simple Heuristic Table
50 4 16 12 12 16 4 50 4 -30 -4 -5 -5 -4 -30 4 16 -4 1 0 0 1 -4 16 12 -5 0 0 0 0 -5 12 12 -5 0 0 0 0 -5 12 16 -4 1 0 0 1 -4 16 4 -30 -4 -5 -5 -4 -30 4 50 4 16 12 12 16 4 50
대전 결과
| 팀명 | 작성자 | 코드 |
| Namsang | 상섭, 정현, 보창 | ALittleAiSeminar/Namsang |
| Smart | 기웅, 선호, 휘동 | Upload(zeropage):SmartPlayer.py |
| NonNamsang | 수생, 현태, 규현 |
CheepPlayer.zip SmartPlayer.py