EPIC : Journal of Electrical Power, Instrumentation and Control
Vol 8 No 2 (2025): EPIC

Implementation of Constraint Satisfaction Problem Approach for Solving the Zebra Puzzle with Prolog

KURNIAWAN, TRI BAGUS KURNIAWAN (Unknown)
NURYANA, MUHAMMAD RISQI (Unknown)
BIJOKANGKO, RESI SUJIWO (Unknown)



Article Info

Publish Date
31 Dec 2025

Abstract

Constraint Satisfaction Problem (CSP) Is a fundamental concept in artificial intelligence used to solve combinatorial problems by satisfying a set of constraints. The Zebra Puzzle is a classical example that involves assigning attributes such as nationality, house color, pet, drink, and candy to five houses based on logical clues. This study aims to implement CSP techniques using the Prolog programming language to solve the Zebra Puzzle. The methodology includes classifying all relevant attributes, encoding constraints into Prolog predicates, and applying helper functions to represent adjacency and ordering relationships. The puzzle is modeled as a list of structured facts, and Prolog’s inference engine is used to derive consistent solutions. The program successfully assigns all attributes to the correct house positions. For example, the Englishman lives in the red house, the Spaniard owns the dog, and the Ukrainian drinks tea. The Norwegian lives in the first house and drinks water, while the Japanese owns the zebra. These results confirm the effectiveness of Prolog in solving structured logic puzzles using CSP. The study concludes that logic programming is a reliable tool for modeling and solving constraint-based problems. This implies broader applicability of CSP in intelligent systems.

Copyrights © 2025






Journal Info

Abbrev

jit

Publisher

Subject

Electrical & Electronics Engineering

Description

Jurnal EPIC merupakan wadah komunikasi ilmiah antara akademisi maupun praktisi terkait penelitian di bidang teknik elektro. ...