強いAI(人工知能)ver0.0.1
at TECH
[
2ch
|
▼Menu
]
■コピペモード
□
スレを通常表示
□
オプションモード
□このスレッドのURL
■項目テキスト
657:ミカエル ◆ebgHt4B05A 12/03/29 16:11:49.19 バグとり。 #include <stdio.h> #include <stdlib.h> struct _obj { int p; int hara; } int getlp(struct _obj *p){ p->p = rand(); return 1; } void action(struct _obj *p){ if(p->p==1){ printf("はらは"); if(p->hara==0){printf("減った。");} else{printf("減っていない。");} } if(p->p==2){printf("楽しい。");} if(p->p==3){ printf("はらが減る"); p->hara=0; } if(p->p==4){ printf("おいしいごはんを食べた"); p->hara=1; } int main(void){ struct _obj p; while(getlp(&p)){ action(&p); } } 658:ミカエル ◆ebgHt4B05A 12/03/29 16:18:40.07 さらに改良。 #include <stdio.h> #include <stdlib.h> struct _obj { int p; int hara; } int getlp(struct _obj *obj){ obj->p = rand(); return 1; } void action(struct _obj *obj){ if(obj->p==1){ printf("はらは"); if(obj->hara==0){printf("減った。");} else{printf("減っていない。");} } if(obj->p==2){printf("楽しい。");} if(obj->p==3){ printf("はらが減る"); obj->hara=0; } if(obj->p==4){ printf("おいしいごはんを食べた"); obj->hara=1; }
次ページ
最新レス表示
スレッドの検索
類似スレ一覧
話題のニュース
おまかせリスト
▼オプションを表示
レスジャンプ
mixiチェック!
Twitterに投稿
オプション
しおりを挟む
スレッドに書込
スレッドの一覧
暇つぶし2ch
5074日前に更新/150 KB
担当:undef