(* 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="Points on line";

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

TOC[mt_,c_]:=TOTT[{Transpose[mt][[c]]}];
TTD[r_]:=StringReplace[TT[r],"\\frac"->"\\dfrac"];
TTC[A_,n_]:=TOTT[{(Transpose[A])[[n]]}];
PtString[M_]:=StringReplace[ToString[M],{"{"->"(","}"->")"}];

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

QtextF[mm_]:=Module[{Cn,Wp,Wu,Wx},{Cn,Wp,Wu}=QtList[[mm]];
Wx=TOTT[{{x,y,z}}];
Return["パラメータ表示\\("<>Wx<>"="<>TOTT[{Wp}]<>"+t"<>TOTT[{Wu}]<>", t\\in {\\mathbb R}\\)を持つ直線上にある点(の位置ベクトル)をすべて選びなさい"]];

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

ICListF[mm_]:=Module[{Cn,Wp,Wu,Wu1,Wx,Wa,WaL={},ct,fs1,ret={}},
Wx=TOTT[{{x,y,z}}];{Cn,Wp,Wu}=QtList[[mm]];
fs1="どのような\\(t\\)に対しても, その点にはなりません.";
(* pattern fs1 *)
Wa=Wp+Rnz[3]*Wu;Wu1={Rnz[3],Rnz[2],Rnz[2]};
While[MatrixRank[{Wu1,Wu}]==1,Wu1={Rnz[3],Rnz[2],Rnz[2]}];
WaL=Append[WaL,Wa+Rnz[3]*Wu1];
Wa=Wp+Rnz[3]*Wu;Wu1={Rnz[3],Rnz[2],Rnz[2]};
While[MatrixRank[{Wu1,Wu}]==1,Wu1={Rnz[3],Rnz[2],Rnz[2]}];
WaL=Append[WaL,Wa+Rnz[3]*Wu1];
Wa=Wp+Rnz[3]*Wu;Wu1={Rnz[3],Rnz[2],Rnz[2]};
While[MatrixRank[{Wu1,Wu}]==1,Wu1={Rnz[3],Rnz[2],Rnz[2]}];
WaL=Append[WaL,Wa+Rnz[3]*Wu1];
Wa=Wp+Rnz[3]*Wu;Wu1={Rnz[3],Rnz[2],Rnz[2]};
While[MatrixRank[{Wu1,Wu}]==1,Wu1={Rnz[3],Rnz[2],Rnz[2]}];
WaL=Append[WaL,Wa+Rnz[3]*Wu1];
Wa=Wp+Rnz[3]*Wu;Wu1={Rnz[3],Rnz[2],Rnz[2]};
While[MatrixRank[{Wu1,Wu}]==1,Wu1={Rnz[3],Rnz[2],Rnz[2]}];
WaL=Append[WaL,Wa+Rnz[3]*Wu1];
WaL=DeleteDuplicates[WaL];
For[ct=1,ct≤Length[WaL],ct++,
ret=Append[ret,{"\\("<>TOTT[{WaL[[ct]]}]<>"\\)",fs1}]];
Return[RandomSample[ret,SELNUM-Cn]]];

ID=1;GenerateMCxml[DFname[ID],Category<>Title<>"(MC"<>ToString[ID]<>")",Title,NUM,Single,QtextF,CListF,ICListF]