Sedang Disiapkan

Basic Prolog program

I am new to start this language, there is a problem that cannot be solved.

There are two buttons: button a and button b.

and two lights: light p and light q.

Rule:

- pressing button a the light p will be on.

- pressing button b will interchanges p and q.

- initially, p and q are off.

- goal: p and q are on.

Use the Prolog language to solve this question.

Only use clauses of the form like this:

p(T+1) :- ...

q(T+1) :- ...

Using the following action names:

name: press_a, meaning: press button a

name: press_b, meaning: press button b

the rule T+1 instantiated by 1 and T instantiated by 0,

and the additional fact press_a(0).

the program should mention these six atoms:p(1),p(1),p(0),p(0),press_a(0),press_b(0).

The part of my code, but I am not sure if it is correct:

p(T+1) :- press_a(T),not p(T).

p(T+1) :- q(T), not p(T), press_b(T).

q(T+1) :- not q(T), p(T), press_b(T).

Kemahiran: Prolog

Lihat lagi: program visual basic 2008 program, visual basic net program, program correct java, visual basic 2008 program, visual basic monitor program, free example visual basic mysql program, visual basic slots program, visual basic finishing program, visual basic attach program, basic slideshow program, basic gui program input, visual basic hide program system processes, basic java program needs gui, visual basic hide program task manager, visual basic sample program generate report, hide visual basic net program task, visual basic blackjack program code, basic java program sample gui

Tentang Majikan:
( 0 ulasan ) Yancheng, China

ID Projek: #23530620

Dianugerahkan kepada:

Mdaurich

Hi, I'm a systems engineer and I can carry out your project without problems. Could you contact me to know more details?

$45 AUD dalam 7 hari
(0 Ulasan)
0.0

3 pekerja bebas membida secara purata $47 untuk pekerjaan ini

tuanthanhle

I can do it. Please check my profile for my previous projects. And also dont hesitate to contact me for this work

$25 AUD dalam sehari
(10 Ulasan)
3.8
idleswell

Hello, I use Prolog programming daily in my regular employment. I will create a Prolog solution to your posted problem. I will use SWI Prolog. A milestone payment for the full budget for this project must be deposit Lagi

$70 AUD dalam 3 hari
(2 Ulasan)
3.1