how to improve simple prolog login? -
i building first project in swi-prolog.it expert system guess user identification base on input of user. of code produces dialog allows user enter information, verifies information , allows user have access. there way improve code?
% user facts enable user log in user(dac,dac11). user(dac101,daa). % login gui. checks database log in logingui :- new(dialog,dialog('login')), send_list(dialog, append, [ new( username, text_item(username)), new(password, text_item(password)), button(enter, and(message(@prolog, checkuser, username?selection, password?selection), message(dialog, destroy) ))]), send(dialog, default_button, enter), send(dialog, open). % verfies user logging checkuser(username,password):-user(username,password), username \== password, new(dialog,dialog('login')), send_list(dialog, append, [ new( label(welcome_to_criminal_system,welcome_to_criminal_system)), button(enter, and(message(@prolog, ask_user), message(dialog, destroy) ))]), send(dialog, default_button, enter), send(dialog, open). % main menu loggin , user can search or select different option ask_user :- new(dialog, dialog('main menu')), all_offence(t),all_eye_color(e),all_skin_colour(skin), all_hair_colour(hc) ,all_hair_style(hs), send_list(dialog, append, [ new(n1, text_item(firstname)), new(n2, text_item(lastname)), new(n3, new(s, menu(gender))), new(n4, new(offense, menu(offense,cycle))), new(n5 , new(eye,menu(eye_color,cycle))), new(n6, new(hair,menu(hair_color,cycle))), new(n8, new(hairstyle,menu(hair_style,cycle))), new(n9, new(skincolor,menu(skin_color,cycle))), button(all_criminals,and(message(@prolog, all_criminals), message(dialog, destroy))), button(add_criminals,and(message(@prolog,add_criminal_gui), message(dialog, destroy))), button(exit, message(dialog, destroy)), button(enter, and(message(@prolog, pick_search_algorithm, n1?selection, n2?selection, n3?selection, n4?selection, n5?selection, n6?selection, n8?selection, n9?selection), message(dialog, destroy))) ]), send_list(offense, append,t), send_list(eye, append,e), send_list(hair, append,hc), send_list(hairstyle, append,hs), send_list(skincolor, append,skin), send_list(s, append, [male, female,none]), send(dialog, default_button, enter), send(dialog, open).
Comments
Post a Comment