I gang

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.


- 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).

Evner: Prolog

Se mere: 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

Om arbejdsgiveren:
( 0 bedømmelser ) Yancheng, China

Projekt ID: #23530620

Tildelt til:


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 in 7 dage
(0 bedømmelser)

3 freelancere byder i gennemsnit $47 på dette job


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

$25 AUD på 1 dag
(10 bedømmelser)

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 Flere

$70 AUD in 3 dage
(2 bedømmelser)