Sub AddGroup
y=0
Controls.ButtonClicked = AddElement
For i_a = 1 To Array.GetItemCount(Groups)
y=y+GraphicsWindow.Height/(Array.GetItemCount(Groups)+1)
If IsGroup[i_a] = 1 Then
GroupButton[i_a] = Controls.AddButton(Groups[i_a],x+80,y-20)
EndIf
EndFor
EndSub
Sub IsMake
For i_a = 1 To Array.GetItemCount(Groups)
IsGroup[i_a] = 0
For i_b = 1 To Array.GetItemCount(Element[i_a])
IsStartly=0
For i_c = 1 To Array.GetItemCount(StartMaked)
If StartMaked[i_c] = Text.Append(i_a,i_b) Then
IsStartly=1
EndIf
EndFor
IsElement[i_a][i_b]=IsStartly
If IsGroup[i_a] = 0 Then
IsGroup[i_a] = IsStartly
EndIf
EndFor
EndFor
EndSub
Sub AddElement
For i_a = 1 To Array.GetItemCount(Groups)
If Controls.LastClickedButton = GroupButton[i_a] Then
SelectGroup[Number] = i_a
EndIf
Controls.Remove(GroupButton[i_a])
EndFor
y=0
Controls.ButtonClicked = FinalCheck
Cancel = Controls.AddButton("Cancel",x,0)
For i_b = 1 To Array.GetItemCount(Element[SelectGroup[Number]])
y=y+GraphicsWindow.Height/(Array.GetItemCount(Element[SelectGroup[Number]])+1)
If IsElement[SelectGroup[Number]][i_b] = 1 Then
EleButton[i_b]=Controls.AddButton(Element[SelectGroup[Number]][i_b],x+80,y-20)
EndIf
EndFor
EndSub
Sub FinalCheck
If Controls.LastClickedButton = Cancel Then
Controls.Remove(Cancel)
For i_b = 1 To Array.GetItemCount(Element[SelectGroup[Number]])
Controls.Remove(EleButton[i_b])
EndFor
AddGroup()
Else
Controls.Remove(Cancel)
For i_b = 1 To Array.GetItemCount(Element[SelectGroup[Number]])
If Controls.LastClickedButton = EleButton[i_b] Then
SelectEle[Number] = i_b
EndIf
Controls.Remove(EleButton[i_b])
EndFor
FontSize = GraphicsWindow.FontSize
GraphicsWindow.FontSize = 40
MakeText[Number] = Shapes.AddText(Element[SelectGroup[Number]][SelectEle[Number]])
Shapes.Move(MakeText[Number],x+80,GraphicsWindow.Height/2-40)
GraphicsWindow.FontSize = FontSize
If Number=1 Then
x=GraphicsWindow.Width/2
Number=2
AddGroup()
Else
MakedGroup = 0
MakedElement = 0
For i_c = 1 To Array.GetItemCount(UseElement[SelectGroup[1]][SelectEle[1]])
If SelectGroup[2] = UseGroup[SelectGroup[1]][SelectEle[1]][i_c] And SelectEle[2] = UseElement[SelectGroup[1]][SelectEle[1]][i_c] Then
MakedGroup = EqualGroup[SelectGroup[1]][SelectEle[1]][i_c]
MakedElement = EqualEle[SelectGroup[1]][SelectEle[1]][i_c]
EndIf
EndFor
If IsElement[MakedGroup][MakedElement] = 0 Then
IsElement[MakedGroup][MakedElement] = 1
If IsGroup[MakedGroup] = 0 Then
IsGroup[MakedGroup] = 1
EndIf
EndIf
If MakedGroup <> 0 And MakedElement <> 0 Then
i_c = 1
Shapes.Animate(MakeText[i_c],GraphicsWindow.Width/2-Text.GetLength(Element[SelectGroup[i_c]][SelectEle[i_c]])*10,GraphicsWindow.Height/2-40,1000)
i_c = 2
Shapes.Animate(MakeText[i_c],GraphicsWindow.Width/2-Text.GetLength(Element[SelectGroup[i_c]][SelectEle[i_c]])*10,GraphicsWindow.Height/2-40,1000)
Program.Delay(1000)
Shapes.Remove(MakeText[1])
Shapes.Remove(MakeText[2])
GraphicsWindow.FontSize = 40
Total = Shapes.AddText(Element[MakedGroup][MakedElement])
Shapes.Move(Total,GraphicsWindow.Width/2-Text.GetLength(Element[MakedGroup][MakedElement])*10,GraphicsWindow.Height/2-40)
GraphicsWindow.FontSize = FontSize
Sound.PlayChimeAndWait()
Program.Delay(1000)
Shapes.Remove(Total)
x=0
Number = 1
AddGroup()
Else
Shapes.Remove(MakeText[1])
Shapes.Remove(MakeText[2])
x=0
Number = 1
AddGroup()
EndIf
EndIf
EndIf
EndSub