[問題] 兩題prolog?消失

看板Programming作者時間6年前 (2018/03/30 01:27), 編輯推噓-1(013)
留言4則, 2人參與, 最新討論串1/1
第一次學這東西有點頭痛Orz... 懇請幫忙! 1. Write a prolog program that tests if a Boolean formula expressed in terms is satisfiable. In other words satisfiable (Booleanterm) is true if there is an assignment (true or false) to each of the variables in Boolean term that render it satisfiable (that is true). Boolean term can contain embedded terms like: and(X,Y), or(X,Y), not(X) In other words you have to produce the clauses like: satisfiable (and(X,Y)):- ... satisfiable (or(X,Y)) :- ... satisfiable (not(Z)) :- ... 2. Write a Prolog program that recognizes if a string made of left and right parentheses is "well balanced" (as shown in the following examples): "()" --> true "())" --> false "((()" --> false "()()" --> true "(()())()" --> true "()()(" --> false -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 151.181.36.100 ※ 文章網址: https://www.ptt.cc/bbs/Programming/M.1522344473.A.B43.html

03/30 05:41, , 1F
誰學prolog不是第一次學阿
03/30 05:41, 1F

03/30 06:14, , 2F
我沒學過都覺得這題目很簡單 = =
03/30 06:14, 2F

03/30 11:54, , 3F
第一題忘了 第二題是PROLOG標準習題
03/30 11:54, 3F

03/30 11:54, , 4F
就算不是也差不多
03/30 11:54, 4F
文章代碼(AID): #1QlI8Pj3 (Programming)
文章代碼(AID): #1QlI8Pj3 (Programming)