(*Require XMLgenMC.mx (ver>0.30) and Categories.mx≥0.30*)SetDirectory[NotebookDirectory[]];
<<XMLgenMC.mx;
<<Categories.mx;
ThisNo=StringReplace[StringSplit[NotebookFileName[],"/"][[-1]],{"LA_"->"",".nb"->"","_"->"-"}];
CatNo=StringReplace[ThisNo,Join["-0"<>ToString[#]->""&/@Range[1,9],"-1"<>ToString[#]->""&/@Range[0,9]]];
Category="LA/"<>CatNo<>"."<>CatNoAssoc[CatNo]<>"/"<>ThisNo<>".";
Title="2点を通る直線のパラメータ表示";

(*Global Options*)DebugMode=False;Shuffle="true";Numbering="abc";
(*Numbers of select options and questions*)
Single="false";SELNUM=4;NUM=200;

TOPt[A_]:="\\(("<>TOT[A[[1]]]<>","<>TOT[A[[2]]]<>","<>TOT[A[[3]]]<>")\\)";

(* Select matrices satisfying some mapping conditions *)
QtList={}; For[ct=1,ct≤1000,ct++,
Wp={Rnz[3],Rnz[2],Rnz[1]};Wu={Rnz[3],Rnz[3],Rnz[2]};
t1=RandomChoice[{-3,-2,-1,1,2,3,4}];
QtList=Append[QtList,{RandomChoice[{1,2,2,2,2,3}],Wp,Wu,t1}];
QtList=DeleteDuplicates[QtList]];QtList=RandomSample[QtList,NUM];
Length[QtList]

QtextF[mm_]:=Module[{Cn,A,B,t1,Wp,Wu,Wx},{Cn,Wp,Wu,t1}=QtList[[mm]];
Wx=TOTT[{{x,y,z}}];A=Wp;B=Wp+t1*Wu;
Return["2点A"<>TOPt[A]<>",B"<>TOPt[B]<>"を通る直線のパラメータ表示として正しいものをすべて選びなさい"]];

CListF[mm_]:=Module[{Cn,Wp,WpL,Wu,WuL,Wx,Wa,t1,tL,ct,fs,ret={}},
{Cn,Wp,Wu,t1}=QtList[[mm]];
Wx=TOTT[{{x,y,z}}];fs="正解です.";
WpL=RandomSample[{Wp,Wp-Wu,Wp+Wu,Wp+2*Wu,Wp+3*Wu,Wp-2*Wu},3];
WuL=RandomSample[{Wu,Wu,2*Wu,-Wu,-3*Wu,4*Wu},3];
For[ct=1,ct≤3,ct++,
ret=Append[ret,{"\\("<>Wx<>"="<>TOTT[{WpL[[ct]]}]<>"+t"<>TOTT[{WuL[[ct]]}]<>"\\)",fs}]];
Return[RandomSample[ret,Cn]]];

ICListF[mm_]:=Module[{Cn,Wp,Wp1,Wu,Wu1,WuL={},Wx,t1,B,ct,fs1,fs2,ret={}},
Wx=TOTT[{{x,y,z}}];{Cn,Wp,Wu,t1}=QtList[[mm]];
fs1="Aは通るかもしれませんが, Bを通らないようです.";
fs2="A,Bともに通りません.";B=Wp+t1*Wu;
(* pattern fs1 *)
For[ct=1,ct≤6,ct++,
Wu1={Rnz[2],Rnz[3],Rnz[3]};
While[MatrixRank[{Wu,Wu1}]==1,Wu1={Rnz[2],Rnz[3],Rnz[3]}];
 WuL=Append[WuL,Wu1]];
WuL=DeleteDuplicates[WuL];
For[ct=1,ct≤Length[WuL],ct++,
ret=Append[ret,{"\\("<>Wx<>"="<>TOTT[{Wp}]<>"+t"<>TOTT[{WuL[[ct]]}]<>"\\)",fs1}]];
(* pattern fs2 *)
WuL={};
For[ct=1,ct≤6,ct++,
Wu1={Rnz[2],Rnz[3],Rnz[3]};
While[MatrixRank[{Wu,Wu1}]==1,Wu1={Rnz[2],Rnz[3],Rnz[3]}];
WuL=Append[WuL,Wu1]];
WuL=DeleteDuplicates[WuL];
For[ct=1,ct≤Length[WuL],ct++,
Wp1=Wp+WuL[[ct]];Wu1={Rnz[2],Rnz[3],Rnz[1]};
While[MatrixRank[{B-Wp1,Wu1}]==1,Wu1={Rnz[2],Rnz[3],Rnz[1]}];
ret=Append[ret,{"\\("<>Wx<>"="<>TOTT[{Wp1}]<>"+t"<>TOTT[{Wu1}]<>"\\)",fs2}]];
Return[RandomSample[ret,SELNUM-Cn]]];

GenerateMCxml[DFname[1],Category<>Title<>"(MC1)",Title,NUM,Single,QtextF,CListF,ICListF]