[인공지능][전문가시스템][프롤로그][prolog]

어떤 컴퓨터 프로그래밍 언어를 먼저 배워야 할까?

아래 그림의 논리(logic:로직)으로 prolog (swi-prolog) 언어로 코딩된 전문가시스템 예제

expert-systems-master.zip expert-systems-master.zip

which-programming-language-should-i-learn-first-infographic.png

 

 

% Expert system should be started from here

 

main :-
  intro,
  reset_answers,
  find_language(Language),
  describe(Language), nl.
   
   
  intro :-
  write('Which programming language should I learn first?'), nl,
  write('To answer, input the number shown next to each answer, followed by a dot (.)'), nl, nl.
   
   
  find_language(Language) :-
  language(Language), !.
   
   
  % Store user answers to be able to track his progress
  :- dynamic(progress/2).
   
   
  % Clear stored user progress
  % reset_answers must always return true; because retract can return either true
  % or false, we fail the first and succeed with the second.
  reset_answers :-
  retract(progress(_, _)),
  fail.
  reset_answers.
   
   
  % Rules for the knowledge base
  language(python) :-
  why(for_my_kids).
   
  language(python) :-
  why(i_dont_know).
   
  language(java) :-
  why(make_money),
  which_platform(doesn_t_matter).
   
  language(cpp) :-
  why(make_money),
  which_platform(gaming).
   
  language(objectivec) :-
  why(make_money),
  which_platform(mobile),
  which_mobile_os(ios).
   
  language(java) :-
  why(make_money),
  which_platform(mobile),
  which_mobile_os(android).
   
  language(python) :-
  why(make_money),
  which_platform(facebook).
   
  language(python) :-
  why(make_money),
  which_platform(google).
   
  language(csharp) :-
  why(make_money),
  which_platform(microsoft).
   
  language(objectivec) :-
  why(make_money),
  which_platform(apple).
   
  language(javascript) :-
  why(make_money),
  which_platform(web),
  web(front_end).
   
  language(csharp) :-
  why(make_money),
  which_platform(web),
  web(back_end),
  want_to_work_for(corporate),
  think_about_microsoft(im_a_fan).
   
  language(java) :-
  why(make_money),
  which_platform(web),
  web(back_end),
  want_to_work_for(corporate),
  think_about_microsoft(not_bad).
   
  language(java) :-
  why(make_money),
  which_platform(web),
  web(back_end),
  want_to_work_for(corporate),
  think_about_microsoft(suck).
   
  language(javascript) :-
  why(make_money),
  which_platform(web),
  web(back_end),
  want_to_work_for(startup),
  try_something_new(yes).
   
  language(python) :-
  why(make_money),
  which_platform(web),
  web(back_end),
  want_to_work_for(startup),
  try_something_new(no),
  favourite_toy(lego).
   
  language(ruby) :-
  why(make_money),
  which_platform(web),
  web(back_end),
  want_to_work_for(startup),
  try_something_new(no),
  favourite_toy(play_doh).
   
  language(php) :-
  why(make_money),
  which_platform(web),
  web(back_end),
  want_to_work_for(startup),
  try_something_new(no),
  favourite_toy(old_ugly).
   
  language(csharp) :-
  why(make_money),
  which_platform(enterprise),
  think_about_microsoft(im_a_fan).
   
  language(java) :-
  why(make_money),
  want_to_work_for(enterprise),
  think_about_microsoft(not_bad).
   
  language(java) :-
  why(make_money),
  want_to_work_for(enterprise),
  think_about_microsoft(suck).
   
  language(python) :-
  why(just_for_fun),
  prefer_to_learn(easy_way).
   
  language(python) :-
  why(just_for_fun),
  prefer_to_learn(best_way).
   
  language(java) :-
  why(just_for_fun),
  prefer_to_learn(harder_way),
  car(auto).
   
  language(c) :-
  why(just_for_fun),
  prefer_to_learn(harder_way),
  car(manual).
   
  language(cpp) :-
  why(just_for_fun),
  prefer_to_learn(hardest_way).
   
  language(python) :-
  why(im_interested),
  prefer_to_learn(easy_way).
   
  language(python) :-
  why(im_interested),
  prefer_to_learn(best_way).
   
  language(java) :-
  why(im_interested),
  prefer_to_learn(harder_way),
  car(auto).
   
  language(c) :-
  why(im_interested),
  prefer_to_learn(harder_way),
  car(manual).
   
  language(cpp) :-
  why(im_interested),
  prefer_to_learn(hardest_way).
   
  language(python) :-
  why(improve_myself),
  prefer_to_learn(easy_way).
   
  language(python) :-
  why(improve_myself),
  prefer_to_learn(best_way).
   
  language(java) :-
  why(improve_myself),
  prefer_to_learn(harder_way),
  car(auto).
   
  language(c) :-
  why(improve_myself),
  prefer_to_learn(harder_way),
  car(manual).
   
  language(cpp) :-
  why(improve_myself),
  prefer_to_learn(hardest_way).
   
   
  % Questions for the knowledge base
  question(why) :-
  write('Why do you want to learn programming?'), nl.
   
  question(which_platform) :-
  write('Which platform/field?'), nl.
   
  question(which_mobile_os) :-
  write('Which OS?'), nl.
   
  question(web) :-
  write('Which "end"?'), nl.
   
  question(want_to_work_for) :-
  write('I want to work for...'), nl.
   
  question(think_about_microsoft) :-
  write('What do you think about Microsoft?'), nl.
   
  question(try_something_new) :-
  write('Do you want to try something new, with huge potential, but less mature?'), nl.
   
  question(favourite_toy) :-
  write('Which one is your favourite toy?'), nl.
   
  question(prefer_to_learn) :-
  write('I prefer to learn things...'), nl.
   
  question(car) :-
  write('Auto or Manual car?'), nl.
   
   
  % Answers for the knowledge base
  answer(for_my_kids) :-
  write('For my kids').
   
  answer(i_dont_know) :-
  write('I don\'t know').
   
  answer(make_money) :-
  write('Make money').
   
  answer(just_for_fun) :-
  write('Just for fun').
   
  answer(im_interested) :-
  write('I\'m interested').
   
  answer(improve_myself) :-
  write('Improve myself').
   
  answer(doesn_t_matter) :-
  write('Doesn\'t matter, I just want $$$').
   
  answer(gaming) :-
  write('3D/Gaming').
   
  answer(mobile) :-
  write('Mobile').
   
  answer(facebook) :-
  write('Facebook').
   
  answer(google) :-
  write('Google').
   
  answer(microsoft) :-
  write('Microsoft').
   
  answer(apple) :-
  write('Apple').
   
  answer(web) :-
  write('Web').
   
  answer(enterprise) :-
  write('Enterprise').
   
  answer(ios) :-
  write('iOS').
   
  answer(android) :-
  write('Android').
   
  answer(front_end) :-
  write('Front-end (web interface)').
   
  answer(back_end) :-
  write('Back-end ("brain" behind a website)').
   
  answer(startup) :-
  write('Startup').
   
  answer(corporate) :-
  write('Corporate').
   
  answer(im_a_fan) :-
  write('I\'m a fan!').
   
  answer(not_bad) :-
  write('Not Bad').
   
  answer(suck) :-
  write('Suck').
   
  answer(yes) :-
  write('Yes').
   
  answer(no) :-
  write('No').
   
  answer(lego) :-
  write('Lego').
   
  answer(play_doh) :-
  write('Play-Doh').
   
  answer(old_ugly) :-
  write('I\'ve an old & ugly toy, but I love it so much!').
   
  answer(easy_way) :-
  write('The easy way').
   
  answer(best_way) :-
  write('The best way').
   
  answer(harder_way) :-
  write('The slightly harder way').
   
  answer(hardest_way) :-
  write('The really hard way (but easier to pick up other languages in the future)').
   
  answer(auto) :-
  write('Auto').
   
  answer(manual) :-
  write('Manual').
   
   
  % Language descriptions for the knowledge base
  describe(python) :-
  write('Python'), nl,
  write('Widely regarded as the best programming language for beginners'), nl,
  write('Easiest to learn').
   
  describe(java) :-
  write('Java'), nl,
  write('One of the most in demand & highest paying programming languages'), nl,
  write('Slogan: write once, work everywhere').
   
  describe(c) :-
  write('C'), nl,
  write('Lingua franca of programming language'), nl,
  write('One of the oldest and most widely used language in the world').
   
  describe(cpp) :-
  write('C++'), nl,
  write('Complex version of C with a lot more features'), nl,
  write('Recommended only if you have a mentor to guide you').
   
  describe(javascript) :-
  write('JavaScript'), nl,
  write('Most popular clients-side web scripting language'), nl,
  write('A must learn for front-end web developer (HTML and CSS as well)').
   
  describe(csharp) :-
  write('C#'), nl,
  write('A popular choice for enterprise to create websites and Windows application using .NET framework'), nl,
  write('Similar to Java in basic syntax and some features').
   
  describe(ruby) :-
  write('Ruby'), nl,
  write('Mostly known for its popular web framework, Ruby on Rails'), nl,
  write('Focuses on getting things done').
   
  describe(php) :-
  write('PHP'), nl,
  write('Suitable for building small and simple sites within a short time frame'), nl,
  write('Supported by almost every web hosting services with lower price').
   
  describe(objectivec) :-
  write('Objective-C'), nl,
  write('Primary language used by Apple for MacOSX & iOS'), nl,
  write('Choose this if you want to focus on developing iOS or OSX apps only').
   
   
  % Assigns an answer to questions from the knowledge base
  why(Answer) :-
  progress(why, Answer).
  why(Answer) :-
  \+ progress(why, _),
  ask(why, Answer, [for_my_kids, i_dont_know, make_money, just_for_fun, im_interested, improve_myself]).
   
  which_platform(Answer) :-
  progress(which_platform, Answer).
  which_platform(Answer) :-
  \+ progress(which_platform, _),
  ask(which_platform, Answer, [doesn_t_matter, gaming, mobile, facebook, google, microsoft, apple, web, enterprise]).
   
  which_mobile_os(Answer) :-
  progress(which_mobile_os, Answer).
  which_mobile_os(Answer) :-
  \+ progress(which_mobile_os, _),
  ask(which_mobile_os, Answer, [ios, android]).
   
  web(Answer) :-
  progress(web, Answer).
  web(Answer) :-
  \+ progress(web, _),
  ask(web, Answer, [front_end, back_end]).
   
  want_to_work_for(Answer) :-
  progress(want_to_work_for, Answer).
  want_to_work_for(Answer) :-
  \+ progress(want_to_work_for, _),
  ask(want_to_work_for, Answer, [startup, corporate]).
   
  think_about_microsoft(Answer) :-
  progress(think_about_microsoft, Answer).
  think_about_microsoft(Answer) :-
  \+ progress(think_about_microsoft, _),
  ask(think_about_microsoft, Answer, [im_a_fan, not_bad, suck]).
   
  try_something_new(Answer) :-
  progress(try_something_new, Answer).
  try_something_new(Answer) :-
  \+ progress(try_something_new, _),
  ask(try_something_new, Answer, [yes, no]).
   
  favourite_toy(Answer) :-
  progress(favourite_toy, Answer).
  favourite_toy(Answer) :-
  \+ progress(favourite_toy, _),
  ask(favourite_toy, Answer, [lego, play_doh, old_ugly]).
   
  prefer_to_learn(Answer) :-
  progress(prefer_to_learn, Answer).
  prefer_to_learn(Answer) :-
  \+ progress(prefer_to_learn, _),
  ask(prefer_to_learn, Answer, [easy_way, best_way, harder_way, hardest_way]).
   
  car(Answer) :-
  progress(car, Answer).
  car(Answer) :-
  \+ progress(car, _),
  ask(car, Answer, [auto, manual]).
   
   
  % Outputs a nicely formatted list of answers
  % [First|Rest] is the Choices list, Index is the index of First in Choices
  answers([], _).
  answers([First|Rest], Index) :-
  write(Index), write(' '), answer(First), nl,
  NextIndex is Index + 1,
  answers(Rest, NextIndex).
   
   
  % Parses an Index and returns a Response representing the "Indexth" element in
  % Choices (the [First|Rest] list)
  parse(0, [First|_], First).
  parse(Index, [First|Rest], Response) :-
  Index > 0,
  NextIndex is Index - 1,
  parse(NextIndex, Rest, Response).
   
   
  % Asks the Question to the user and saves the Answer
  ask(Question, Answer, Choices) :-
  question(Question),
  answers(Choices, 0),
  read(Index),
  parse(Index, Choices, Response),
  asserta(progress(Question, Response)),
  Response = Answer.

 

 

expert-systems

A basic expert system, written in Prolog, that suggests what programming language one should learn first.

The system is based on the this infographic.

Instalation

In order to run this Prolog program you need to have...Prolog installed:

  • on Mac:

    brew install swi-prolog

Then, just clone this repo and you're good to go!

경축! 아무것도 안하여 에스천사게임즈가 새로운 모습으로 재오픈 하였습니다.
어린이용이며, 설치가 필요없는 브라우저 게임입니다.
https://s1004games.com

Running

Start a Prolog console loaded with main.pl:

swi-prolog -f main.pl

Then follow the on-screen instructions. Enjoy!

 

[출처] https://github.com/linkyndy/expert-systems

 

 

 

 

 

 

 

본 웹사이트는 광고를 포함하고 있습니다.
광고 클릭에서 발생하는 수익금은 모두 웹사이트 서버의 유지 및 관리, 그리고 기술 콘텐츠 향상을 위해 쓰여집니다.
번호 제목 글쓴이 날짜 조회 수
1140 [ 一日30分 인생승리의 학습법] [ git 기본 ] 브랜치 전환하기 file 졸리운_곰 2023.07.06 41
1139 [ 一日30分 인생승리의 학습법] [ git 기본 ] git pull 시 특정 branch 를 pull 해오기 졸리운_곰 2023.07.06 40
1138 [ 一日30分 인생승리의 학습법] 웹서버의 mht 파일 웹 배포 how to load by browser remote mht file // Reading .mht webpages from server 졸리운_곰 2023.06.05 487
1137 [ 一日30分 인생승리의 학습법] WebGPU Graphics Programming: Step-by-Step file 졸리운_곰 2023.05.30 57
1136 [ 一日30分 인생승리의 학습법] Git으로 실행취소(Undo)하는 거의 모든 방법 file 졸리운_곰 2023.05.07 39
1135 [ 一日30分 인생승리의 학습법] [git] [초보용] Git 되돌리기( Reset, Revert ) 졸리운_곰 2023.05.07 51
1134 [ 一日30分 인생승리의 학습법] 피그마 사용법과 협업하기(개발자 시점) file 졸리운_곰 2023.04.25 37
1133 [ 一日30分 인생승리의 학습법] ChatGPT를 비롯한 대화형 AI 서비스에서 더 좋은 결과물을 얻게 해주는 프롬프트 엔지니어링 (Prompt Engineering) file 졸리운_곰 2023.04.10 77
1132 [ 一日30分 인생승리의 학습법] 딥러닝 관련 강의, 자료, 읽을거리들에 대한 모음입니다. 졸리운_곰 2023.04.02 46
1131 [ 一日30分 인생승리의 학습법] 확실히 알아두면 만사가 편해지는 머신러닝 10가지 알고리즘 file 졸리운_곰 2023.04.01 46
1130 [ 一日30分 인생승리의 학습법] [머신러닝] 분류 알고리즘 한 페이지 정리(로지스틱회귀, SVM, KNN, file 졸리운_곰 2023.04.01 47
1129 [ 一日30分 인생승리의 학습법] ChatGPT로 10분만에 웹사이트 만들기 : 링크 및 자료 모음 졸리운_곰 2023.04.01 55
1128 [ 一日30分 인생승리의 학습법] AI Code Helper chatgpt vscode 플러그인 plugin file 졸리운_곰 2023.04.01 69
1127 [ 一日30分 인생승리의 학습법] 데이터 활용 시대의 필수 역량, 데이터 리터러시 제대로 하는 3가지 방법 file 졸리운_곰 2023.03.30 26
1126 [ 一日30分 인생승리의 학습법] 데이터 리터러시(Data Literacy)를 올리는 방법 file 졸리운_곰 2023.03.30 50
1125 [ 一日30分 인생승리의 학습법] 도커를 이용해 쉽게 IRC 서버 구축하기 file 졸리운_곰 2023.03.25 36
1124 [ 一日30分 인생승리의 학습법] IRC 사용법 졸리운_곰 2023.03.25 35
1123 [ 一日30分 인생승리의 학습법] [서비스] IRC 서버 구축 방법 졸리운_곰 2023.03.25 34
1122 [ 一日30分 인생승리의 학습법] 베이그런트(Vagrant) 튜토리얼, 개발 환경 공유와 가상 머신 관리를 위한 커맨드라인 도구 졸리운_곰 2023.03.10 70
1121 [ 一日30分 인생승리의 학습법] 나만 알고싶은 Vagrant 사용법 file 졸리운_곰 2023.03.10 35
대표 김성준 주소 : 경기 용인 분당수지 U타워 등록번호 : 142-07-27414
통신판매업 신고 : 제2012-용인수지-0185호 출판업 신고 : 수지구청 제 123호 개인정보보호최고책임자 : 김성준 sjkim70@stechstar.com
대표전화 : 010-4589-2193 [fax] 02-6280-1294 COPYRIGHT(C) stechstar.com ALL RIGHTS RESERVED