/*整理组函数(绑定BlankConform事件) * 类函数:整理本组成员 * 参数:标准事件函数 * 返回值:void */ public void SettleGroup(object sender, Suduku_EventArgs e) { switch (this.GrpType) { case GroupType.Row: this.Unsolved_Blank.Remove(this.Blank[Index_Parser.Row_index(e.ConformIndex)]); for (int i = 0; i < this.Unsolved_Blank.Count; i++) { this.Unsolved_Blank[i].iValues.Remove(this.Blank[Index_Parser.Row_index(e.ConformIndex)].Value); } break; case GroupType.Column: this.Unsolved_Blank.Remove(this.Blank[Index_Parser.Column_index(e.ConformIndex)]); for (int i = 0; i < this.Unsolved_Blank.Count; i++) { this.Unsolved_Blank[i].iValues.Remove(Blank[Index_Parser.Column_index(e.ConformIndex)].Value); } break; case GroupType.Mix: this.Unsolved_Blank.Remove(this.Blank[Index_Parser.Mix_index(e.ConformIndex)]); for (int i = 0; i < this.Unsolved_Blank.Count; i++) { this.Unsolved_Blank[i].iValues.Remove(Blank[Index_Parser.Mix_index(e.ConformIndex)].Value); } break; } }
public void Resutore_Image(Suduku_Group image) { this.Unsolved_Blank.Clear(); switch (this.GrpType) { case GroupType.Row: for (int i = 0; i < image.Unsolved_Blank.Count; i++) { this.Unsolved_Blank.Add(this.Blank[Index_Parser.Row_index(image.Unsolved_Blank[i].Index)]); } break; case GroupType.Column: for (int i = 0; i < image.Unsolved_Blank.Count; i++) { this.Unsolved_Blank.Add(this.Blank[Index_Parser.Column_index(image.Unsolved_Blank[i].Index)]); } break; case GroupType.Mix: for (int i = 0; i < image.Unsolved_Blank.Count; i++) { this.Unsolved_Blank.Add(this.Blank[Index_Parser.Mix_index(image.Unsolved_Blank[i].Index)]); } break; } }
protected void init_comp(GroupType gt, int g_index, Suduku_Blank[] Blk) { this.GrpType = gt; this.GroupIndex = g_index; for (int i = 0; i < Blk.Length; i++) { switch (this.GrpType) { case GroupType.Row: if (Index_Parser.Row(Blk[i]) == this.GroupIndex) { this.Blank.Add(Blk[i]); } break; case GroupType.Column: if (Index_Parser.Column(Blk[i]) == this.GroupIndex) { this.Blank.Add(Blk[i]); } break; case GroupType.Mix: if (Index_Parser.MixGroup(Blk[i]) == this.GroupIndex) { this.Blank.Add(Blk[i]); } break; } } Unsolved_Blank = new List <Suduku_Blank>(this.Blank); for (int i = 0; i < this.Blank.Count; i++) { Blank[i].BlankConform += this.SettleGroup; Blank[i].Value = Blank[i].Value; } }