so i created this simple AI code and i want to add a simple multiply math to my code so its done like this
domains
bonus = integer
predicates
crew_db(string, integer, string) - nondeterm (o,o,o)
absensi_crew(string, symbol) - nondeterm (o,o), (i,i)
posisi_terdaftar(string, symbol) - nondeterm (o,o), (i,i)
terima_gaji(string) - nondeterm (o,i,i,o)
tambah_bonus(bonus,bonus,bonus) - procedure (i,i,o)
clauses
crew_db("Muhammad", 18, "Bantaeng, 28 November 1998").
crew_db("Irvan", 20, "Bantaeng, 28 November 1998").
crew_db("Jaya", 21, "Bantaeng, 28 November 1998").
absensi_crew("Muhammad",aman).
absensi_crew("Irvan",aman).
absensi_crew("Jaya",tidak).
posisi_terdaftar("Muhammad",aktif).
posisi_terdaftar("Irvan",aktif).
posisi_terdaftar("Jaya",tidak).
terima_gaji(TesBebasTernyata):-
crew_db(TesBebasTernyata,_,_),
absensi_crew(TesBebasTernyata,aman),
posisi_terdaftar(TesBebasTernyata,aktif).
tambah_bonus(A,B,Bonus):-
Bonus=A*B.
goal
terima_gaji(Crew_Yang_Di_Gaji_Bulan_Ini),tambah_bonus(45000,2,Bonus).
and when i check the goals of my Prolog, it fails and said wrong number of arguments in flow pattern
In clause
you have
but your facts are
Notice that the clauses has three argument positions while your facts have four.
Change
to
Since I do not have Visual Prolog I can not test this answer with Visual Prolog.