底辺私立医大を卒業した医者って頭悪いよね? Part10at HOSP
底辺私立医大を卒業した医者って頭悪いよね? Part10 - 暇つぶし2ch868:卵の名無しさん
18/12/06 17:10:33.30 E+1fMA/x.net
# check if combination x is compatible
check <- function(x,Strict){ # Strict==TRUE if liar always lies
re=NULL
honest <- which(x==1) # index of honest in x
for(i in honest){ # check if honest answer is compatible
re=append(re,compati.H(i,x))
}
if(Strict){
liar <- which(x==0) # index of liar in x
for(i in liar){ # check if the opposite of liars is compatible
re=append(re,compati.L(i,x))
}
}
all(re) # return TRUE only if all answer are compatible
}
dat[apply(dat,1,function(x) check(x,Strict=TRUE)),] # Strict liar
dat[apply(dat,1,function(x) check(x,Strict=FALSE)),] # fuzzy liar
# バグ指摘、コード改良 歓迎!


次ページ
続きを表示
1を表示
最新レス表示
レスジャンプ
類似スレ一覧
スレッドの検索
話題のニュース
おまかせリスト
オプション
しおりを挟む
スレッドに書込
スレッドの一覧
暇つぶし2ch