Mã:
public class Luat { public List<RuleItem> List; public Luat(string fileName) { RuleItem e = new RuleItem(); List = e.GetData(fileName); } /* *Suy dien tien voi logic menh de -Input:+ Tap luat Rule={r1,r2,r3,…,rm} + Gia thiet (GT), ket luan (KL) -Output: Return “true” neu GT => KL *Method TD = GT; //TD: tap dich, GT: gia thuyet T = FILTER(Rule, TD); //loc rule co VT (ve trai) trong TD While <KL Є/ TD> and <T ≠ ø> do { r = Get(T); TD = TD Ū {q}; //r: left->q Rule = Rule \ {r}; // luat nao da dung roi thi bo di T=FILTER(Rule,TD); // luu y Rule nao ma loc ra tu TD da xuat hien roi thi khong lay lai } If (KL Є TD) then return “true” Else return false */ private void PrintGT(string title,List<string> gt) { string str=title+"{"; foreach (string s in gt) str += s + ","; str += "}
"; Console.WriteLine(str); } private void PrintRule(string title, List<RuleItem> rule) { string str = title + "{"; foreach (RuleItem r in rule) str += r.Code + ","; str += "}
"; Console.WriteLine(str); } public string KQ { get; set; } public bool SuyDienTien(List<RuleItem> rules, List<string> gt, List<EventItem> kl) { //Lay tat ca ma cua gt List<string> td = gt; //Lay rule co VT chua cac gia thuyet List<RuleItem> newRules= FILTER(rules, td); List<RuleItem> vet = new List<RuleItem>(); //In Console.WriteLine("----------------------------
"); PrintRule("Rules=",rules); PrintGT("TD=", gt); PrintRule("T=", newRules); int c = 1; // while (newRules.Count>0 && Check_KL_in_TL(kl, td) == false) { //r=GET(T) Console.WriteLine("Chay lan "+c.ToString()+"
"); foreach (RuleItem r in newRules) { if(td.IndexOf(r.Right)<0) td.Add(r.Right.Trim()); rules.Remove(r); vet.Add(r); } newRules = FILTER(rules, td); PrintGT("TD=", gt); PrintRule("Rules=", rules); PrintRule("T=", newRules); c++; } PrintRule("VET=", vet); return Check_KL_in_TL(kl, td); } // private List<RuleItem> FILTER(List<RuleItem> rules, List<string> gt) { List<RuleItem> lst=new List<RuleItem>(); foreach (RuleItem r in rules) { //GT={a,b} //r1={a,b,c->k) - ko lay luat nay //r2={a->k) - Lay luat nay //r3={b->k) - Lay luat nay //r4={a,b->k) - Lay luat nay if (r.Left.Length <= gt.Count) { int count = 0; foreach (string tt in gt) { if (r.Left.Contains(tt)) count++; } if (count == r.Left.Length) lst.Add(r); } } return lst; } //Kiem tra xem gia thuyet da suy ra ket luan chua private bool Check_KL_in_TL(List<EventItem> kl, List<string> gt) { foreach (EventItem k in kl) { foreach (string g in gt) if (g == k.Code) { KQ = k.Name; return true; } } return false; } }
Mr Thanh -KHMT1K8 - HAUI [IMG]images/smilies/biggrin.png[/IMG][IMG]images/smilies/laughing.gif[/IMG]
Bất chấp những lầm tưởng phổ quát, hồ hết những người có âm đạo đều khó lên đỉnh khi bị kích thích âm đạo. Tuy nhiên, điều đó không có tức thị nó không thể vui được! Việc xâm nhập vào âm đạo bằng...
Quý bà giải tỏa bằng việc kích...