; 調整法のデモ
; Display & Responce / RT
log=""
notesel log ; ログをメモリーノートパッドにとる
; make display
; 2 Factors 組み合わせ ランダム順実施
a=2 ; Levels of Factor Right/Left
b=2 ; levels of Factor A/D
cn=a*b ; n of combination
n=4 ;n of repetition
repeat n ;各条件n回 繰り返し 全体でn*cn --------------------- 全体ループ
repeat cn
C.cnt=cnt ;条件コード作成
;mes C.cnt; 0, 1,2,,,,,cn-1 確認
loop
gosub *rndorder ;試行順序ランダム化
repeat cn
mes C.cnt ; 確認 実施条件順序 C.0----.cn-1
loop
await 2000
*presentation
repeat cn ;cn回繰り返す 各条件1回ずつ(基本の組み合わせ)------基本ループ
cls
; mes cnt+1
if C.cnt¥4=0 {x1=100:x2=400:dr=10}
if C.cnt¥4=1 {x1=100:x2=400:dr=40}
if C.cnt¥4=2 {x1=400:x2=100:dr=10}
if C.cnt¥4=3 {x1=400:x2=100:dr=40}
dx=500:dy=500
series=0
while series=0
buffer 2,dx,dy ; ID 2 仮想ウィンドウに
y1=100 ;位置、幅
circle x1-dr,y1-dr,x1+dr,y1+dr,0 ;比較刺激
;円を用意
ds=5 ;凝視点用意
; line dx/2-ds,dy/2,dx/2+ds,dy/2
; line dx/2,dy/2-ds,dx/2,dy/2+ds
y2=100:dr2=30 ;位置、幅
circle x2-dr2,y2-dr2,x2+dr2,y2+dr2,0 ;標準刺激
circle x2-20,y2-20,x2+20,y2+20,0;
; Show display
gsel 0 ; ID 0 のウィンドウに、描画先指定
gcopy 2,0,0,dx,dy ; ID 2 の画像の ( 左上角 )位置から、幅 dx、高さ dy の範囲をコピーしてID 0 に表示
await 100 ;待ち時間 ms
;------Reaction
resp="" ; 何が押されたかの変数を空に
repeat
stick res ; 入力されたキー情報の取得
if res&256 {
resp="a" ; 256はマウスの左ボタン
dr=dr+1
break ; loopからぬける
}
if res&512 {
resp="d" ; 512はマウスの右ボタン
dr=dr-1
break ; loopからぬける
}
if res&16 {
series=1
break
}
await 2: loop
wend; ここまで系列の繰り返し ------
series=0
await 2 ; await を入れないと無限ループ
cls ; 画面をクリアー
cc=C.cnt
noteadd " "+cc+" "+dr
loop; cn 試行
loop; n 繰り返し
;----------------------- Save Data
bsave "data", log
stop
end
;=============
*rndorder ; ランダム順化サブルーチン
randomize ; 乱数を不規則化
repeat cn ; 組み合わせの数だけ繰り返す
x=rnd(cn) ; 0から(cn-1)の範囲で整数の乱数値を発生させる:x
k=C.cnt ; cnt 番目の配列をx番目と入れかえるために、
C.cnt = C.x ; 乱数x番目の配列の数を cnt版目の数に入れ( cnt:0 -- cn-1 )
C.x=k ; 乱数x番目の配列にcnt番目を入れる
loop
return