あなたはファジー関数を呼ぶのですかに依存しますが、 基本的に、ファジーロジックは、この種の条件IFのセットに変換します。
は、我々はビデオゲームのモンスターのためのファジー論理規則を書きたいとしましょう。ヒットポイント(HP)と火力(FP)の2つの変数から始めます。
HP/FP Very low HP Low HP Medium HP High HP Very high HP
Very weak FP Retreat! Retreat! Defend Defend Attack
Weak FP Retreat! Defend Defend Attack Attack
Medium FP Retreat! Defend Attack Attack Full attack!
High FP Retreat! Defend Attack Attack Full attack!
Very high FP Defend Attack Attack Full attack! Full attack!
function fuzzy ($hp, $firepower)
{
if($hp == 'very low hp' && $firepower == 'very weak fp') return 'retreat';
if($hp == 'low hp' && $firepower == 'very weak fp') return 'retreat';
if($hp == 'high hp' && $firepower == 'very weak fp') return 'defend';
...
if($hp == 'high hp' && $firepower == 'very high fp') return 'full attack';
if($hp == 'very high hp' && $firepower == 'very high fp') return 'full attack';
}
何を:私たちは、これを始めるかもしれませんか? ......... – Cjueden