メイン コーダーズルーム【スクリプト系】 MXで外部テキストを利用したランダムクイズの作成 | 投稿するにはまず登録を |
フラット表示 | 前のトピック | 次のトピック |
投稿者 | スレッド |
---|---|
miboo | Åê¹ÆNo.8545 投稿日時: 2004-6-24 11:00 |
新米 居住地: 投稿: 13
使用環境:
|
MXで外部テキストを利用したランダムクイズの作成 はじめましてmibooと申します。
ランダムクイズの作成で行き詰ってしまったので ぜひ、ご助言いただきたく投稿させていただきます。 まず、クイズの仕様ですが、全部で40問の3択クイズです。 一回の出題は10問です。 問題と3つの選択肢、答えは外部txtファイルに以下のように 記述しています。 questionArray=問題,選択肢A,選択肢B,選択肢C,正解, ・ ・ ・ 問題,選択肢A,選択肢B,選択肢C,正解&endFlag=1 としてこれをquestion.txtとしています。 後日難易度別に作ろうと思っているのですが、 現在難易度が1つしかないので、 1フレーム目に this.endFlag = 0; if (this.difficult == 1) { this.loadVariables( "question.txt" ); } と記述し 3フレーム目で下記のように記述し初期化しています。 this.questionArray = this.questionArray.split(newline); for (i=0; i<this.questionArray.length; i++) { questionArray[i] = questionArray[i].split(","); } this.totalCorrect = 0; this.totalCount = 0; 次に4フレーム目で配列からランダムに問題を拾い、 それぞれ配列から変数を拾うようにしています。 this.currentQuestion = Math.floor( Math.random() * this.questionArray.length ); this.question = questionArray[ this.currentQuestion ][ 0 ]; this.selectA = questionArray[ this.currentQuestion ][ 1 ]; this.selectB = questionArray[ this.currentQuestion ][ 2 ]; this.selectC = questionArray[ this.currentQuestion ][ 3 ]; this.correct = questionArray[ this.currentQuestion ][ 4 ]; 正解、不正解の判定は下記のような記述をしております。 if (this.answer == this.correct) { this.judgeIcon.gotoAndPlay("correct"); this.totalCorrect++; if (this.totalCorrect == 1) { this.count1.gotoAndPlay(2); } else if (this.totalCorrect == 2) { this.count2.gotoAndPlay(2); } else if (this.totalCorrect == 3) { this.count3.gotoAndPlay(2); }else if (this.totalCorrect == 4) { this.count4.gotoAndPlay(2); }else if (this.totalCorrect == 5) { this.count5.gotoAndPlay(2); }else if (this.totalCorrect == 6) { this.count6.gotoAndPlay(2); }else if (this.totalCorrect == 7) { this.count7.gotoAndPlay(2); }else if (this.totalCorrect == 8) { this.count8.gotoAndPlay(2); }else if (this.totalCorrect == 9) { this.count9.gotoAndPlay(2); }else if (this.totalCorrect == 10) { this.count10.gotoAndPlay(2); } } else { this.judgeIcon.gotoAndPlay("incorrect"); } this.totalCount++; this.correctRatio = Math.round(this.totalCorrect/totalCount*1000)/10; this.answer = ""; this.stop(); ここまでで、ランダムに読み込むことはできたのですが、同じ問題が出てしまうので同じ問題が出題されないようにしたいのですが、やり方として、問題それぞれに、ユニークナンバーを振り分け最初に10問一気にランダムで読みこんでしまい、その中には同じ番号が入らないようにするのが一番スマートかとおもうのですが、記述のしかたが思い浮かばず・・・・といったところで躓いております。 どなたか、ご助言、ご助力願えますでしょうか。 宜しくお願いいたします。 |
フラット表示 | 前のトピック | 次のトピック |
題名 | 投稿者 | 日時 |
---|---|---|
» MXで外部テキストを利用したランダムクイズの作成 | miboo | 2004-6-24 11:00 |
Re: MXで外部テキストを利用したランダムクイズの作成 | Fumio | 2004-6-24 11:09 |
Re: MXで外部テキストを利用したランダムクイズの作成 | miboo | 2004-6-24 11:29 |
Re: MXで外部テキストを利用したランダムクイズの作成 | miboo | 2004-6-24 15:45 |
Re: MXで外部テキストを利用したランダムクイズの作成 | Fumio | 2004-6-24 16:14 |
Re: MXで外部テキストを利用したランダムクイズの作成 | miboo | 2004-6-24 18:14 |
Re: MXで外部テキストを利用したランダムクイズの作成 | Fumio | 2004-6-24 19:00 |
Re: MXで外部テキストを利用したランダムクイズの作成 | miboo | 2004-6-25 1:18 |
Re: MXで外部テキストを利用したランダムクイズの作成 | Fumio | 2004-6-25 1:57 |
Re: MXで外部テキストを利用したランダムクイズの作成 | miboo | 2004-7-2 21:14 |
投稿するにはまず登録を | |