-自作プログラムによりバンディットを解くプログラム. --MAX_TRIAL(100000)回中連続した10000回を見て,バンディットを試した時に報酬がいくら貰えるか? --ファイル名:player.c --コンパイル方法(例:bandit00):gcc -o gameplay00 player.c bandit00.o ---実行方法:./gameplay00 #include <stdio.h> #include <stdlib.h> #include "bandit.h" #define MAX_TRIAL 100000 int main(){ /* 変数定義・初期化 */ int i,j,select_arm=0; double reward=0.0,score[10000], max_score=0.0, tmp_score; for(i=0 ; i<10000 ; i++){ score[i]=0.0; } init_bandit(); /* バンディットの初期化 */ /* MAX_TRIAL回まで自動実行 */ /* 連続した10000回のうち最大のスコアを自動計算・更新 */ for(i=0 ; i<MAX_TRIAL ; i++){ /* 意思決定・それによるバンディットの実行*/ /* ここから自作のプログラム */ /* 選択する腕を決めてselect_armに代入して*/ select_arm = /* ここまで自作のプログラム */ reward = bandit(select_arm); if(reward < 0.0) reward = 0.0; /* 連続した10000回の最大スコアの確認 */ tmp_score=0.0; for(j=0 ; j<10000 ; j++) tmp_score += score[j]; if(tmp_score > max_score) max_score = tmp_score; /* 連続した10000回のスコアを更新 */ /* score[0] 〜score[9999] に対し, */ /* 最も古いものscore[9999]を消し, */ /* 一個ずつずらし(score[j] = score[j-1]) */ /* 最も新しいものをscore[0]に入れる */ for(j=9999 ; j> 0 ; j--) score[j] = score[j-1]; score[0] = reward; } printf("最大総獲得報酬: %lf\n", max_score); return 0; }