擬似プログラム
出典: フリー百科事典『ウィキペディア(Wikipedia)』 (2020/04/28 03:03 UTC 版)
以上のアルゴリズムを擬似コードで記述すると以下のようになる。 function MIN_MAX(position:局面, depth:integer): integerbegin if depth=0 then return STATIC_VALUE(position); {読み深さに達した} positionを展開→すべての子ノードをchildren[]に。子ノードの数をwに。 if w=0 then return STATIC_VALUE(position); {終局} if positionは自分の局面 then begin max := -∞; for i:=1 to w do begin score = MIN_MAX( children[i], depth-1); if(score>max) max := score; end; return max; end else begin{positionは相手の局面} min := ∞; for i:=1 to w do begin score = MIN_MAX( children[i], depth-1); if(score<min) min := score; end; return min; end;end;
※この「擬似プログラム」の解説は、「ミニマックス法」の解説の一部です。
「擬似プログラム」を含む「ミニマックス法」の記事については、「ミニマックス法」の概要を参照ください。
- 擬似プログラムのページへのリンク