[인공지능][전문가시스템][프롤로그][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

 

 

 

 

 

 

 

본 웹사이트는 광고를 포함하고 있습니다.
광고 클릭에서 발생하는 수익금은 모두 웹사이트 서버의 유지 및 관리, 그리고 기술 콘텐츠 향상을 위해 쓰여집니다.
번호 제목 글쓴이 날짜 조회 수
1018 [초보용] Git 되돌리기( Reset, Revert ) file 졸리운_곰 2021.06.22 85
1017 [DOCKER] Windows Server 2016에서 도커 설치하기 졸리운_곰 2021.06.13 103
1016 [docker, windows server 2016] Installing Docker onto Windows Server 2016 file 졸리운_곰 2021.06.13 98
1015 [windows powershell] Setup Docker on Windows Server 2016 file 졸리운_곰 2021.06.13 147
1014 [ScreenToGif]움짤 만들기 프로그램, pc 화면을 움직이는 gif 로 캡쳐 file 졸리운_곰 2021.06.12 91
1013 [一日 30分 인생슬리의 학습법] 내가 AI 업계를 떠난 이유 5가지 file 졸리운_곰 2021.05.29 121
1012 [一日 30分 인생슬리의 학습법] 정규식 쉽게 베우기 : Learn Regex Easy Way file 졸리운_곰 2021.05.24 98
1011 [一日 30分 인생슬리의 학습법] Improving CartoonGAN 소개 file 졸리운_곰 2021.05.20 220
1010 [공통] 마크다운 markdown 작성법 file 졸리운_곰 2021.05.17 87
1009 자료구조 : JSON 구조 file 졸리운_곰 2021.05.17 113
1008 BitTorrent (토렌트) 의 원리와 구조 졸리운_곰 2021.05.14 92
1007 [1日 30分 인생 승리의 학습법] 훌륭한 개발자가 되는 방법 file 졸리운_곰 2021.04.28 94
1006 [1日30分 인생승리의 학습법] 개발자의 실수 -> 프로젝트 실패의 요인 노트 : 개발 프로젝트 실패하는 법 졸리운_곰 2021.04.28 86
1005 [1日30分 인생승리의 학습법] 검색에서 정보를 구성하는 방법 졸리운_곰 2021.04.28 81
1004 [1日30分 인생승리의 학습법] 웹크롤러(WebCrawler) file 졸리운_곰 2021.04.28 105
1003 [1日30分 인생승리의 학습법]프로덕션 환경에서 텐서 플로우 모델을 구축하는 방법 : gRPC로 텐서플로우 서빙 서비스 플랫폼 개발 file 졸리운_곰 2021.04.27 118
1002 [1日 30分 인생승리의 학습법] 나의 Sparx Enterprise Architect(UML) 활용기 file 졸리운_곰 2021.04.25 87
» [인공지능][전문가시스템][프롤로그][prolog] 어떤 컴퓨터 프로그래밍 언어를 먼저 배워야 할까? file 졸리운_곰 2021.04.23 117
1000 [WebGPU] Apache TVM을 사용하는 브라우저에서 WebGPU 기반 기계 학습 file 졸리운_곰 2021.04.17 173
999 테라폼이란? 클라우드 인프라스트럭처 자동화 도구 file 졸리운_곰 2021.03.28 124
대표 김성준 주소 : 경기 용인 분당수지 U타워 등록번호 : 142-07-27414
통신판매업 신고 : 제2012-용인수지-0185호 출판업 신고 : 수지구청 제 123호 개인정보보호최고책임자 : 김성준 sjkim70@stechstar.com
대표전화 : 010-4589-2193 [fax] 02-6280-1294 COPYRIGHT(C) stechstar.com ALL RIGHTS RESERVED