How i can translate this Prolog source code to Visual Prolog ?
I am working on my Thesis and i must implement a diagnostic tool about mobile phones with Visual Prolog.
Please help....
This is the code...
Code: Select all
go :- guess(Ac),
write('you probably have : '),
write(Ac),
nl,
undo.
/*hypotheses to be tested*/
guess(virus) :- virus, !.
guess(bad_battery) :- bad_battery, !.
guess(low_storage) :- low_storage, !.
guess(synchronization_issue) :- synchronization_issue, !.
guess(screen_that_isnt_working_right) :- screen_that_isnt_working_right , !.
guess(deadpixel) :- deadpixel , !.
guess(softbrick) :- softbrick , !.
guess(sim) :- sim , !.
guess(google_play_cache_error) :- google_play_cache_error,!.
guess(microsd_false_format) :- microsd_false_format,!.
guess(damaged_charging_port) :- damaged_charging_port,!.
guess(hacked) :- hacked,!.
guess(hardware_issue) :- hardware_issue,!.
guess(outdated_bootloader) :- outdated_bootloader,!.
guess(unknown). /*no diagnosis*/
/* illness identification rules */
virus :- verify(lag),
verify(freeze),
verify(crashes),
verify(consumin_data_without_any_reason),
verify(get_suspicious_shortcut_files).
bad_battery :- verify(lag);
verify(do_you_overcharge_your_battery);
verify(overheating).
bad_battery :- verify(phone_is_dead).
low_storage :- verify(freeze) ;
verify(cant_download_apps);
verify(cant_shoot_a_photo);
verify(cant_save_files);
verify(phone_freezes_when_certain_apps_are_opened).
synchronization_issue :- verify(cant_connect_to_internet_services).
synchronization_issue :- verify(some_apps_dont_work_or_freeze).
synchronization_issue :- verify(gps_is_not_accurate).
screen_that_isnt_working_right :- verify(cracks_spots_and_blotches);
verify(buzzing).
deadpixel :- verify(dead_or_stuck_pixels);
verify(stuttering_or_flickering).
softbrick :- verify(repeating_rebooting).
sim :- verify(calls_being_interrupted_or_messages_delayed);
verify(pin_code_requested_without_rebooting_the_phone);
verify(sudden_airplane_mode).
google_play_cache_error :- verify(play_store_soesnt_work_properly).
microsd_false_format :- verify(microsd_card_does_not_work).
damaged_charging_port :- verify(not_charging).
hacked :- verify(your_device_s_sending_or_receiving_strange_text_messages);
verify(new_apps_are_installed_on_your_device_and_you_didnt_install_them);
verify(websites_appear_somewhat_different_than_before);
verify(your_cell-phone_bill_shows_unexpected_charges);
verify(your_email_from_the_device_is_getting_blocked_by_spam_filters).
hardware_issue :- verify(randomly_powers_on).
outdated_bootloader :- verify(wi-fi_signal_is_constantly_cutting_out_with_a_weak_signal).
/*question to be asked*/
ask(Question) :-
write('Is/Does your phone : '),
write(Question),
write('? '),
read(Response),
nl,
( (Response == yes ; Response == y)
->
assert(yes(Question)) ;
assert(no(Question)), fail).
:- dynamic yes/1,no/1.
verify(S) :-
(yes(S)
->
true ;
(no(S)
->
fail ;
ask(S))).
undo :- retract(yes(_)),fail.
undo :- retract(no(_)),fail.
undo.