Implementation of Constraint Satisfaction Problem Approach for Solving the Zebra Puzzle with Prolog
EPIC Journal of Electrical Power Instrumentation and Control · 31.12.2025 · 8 (2) · 302-312
DOI: 10.32493/epic.v8i2.58721 ↗Kurz gefasst
Fachartikel in der Zeitschrift EPIC Journal of Electrical Power Instrumentation and Control, online erschienen am 31.12.2025. Verfasst von Tri Bagus Kurniawan und 2 weiteren Autor:innen. Der Volltext ist frei zugänglich (Open Access, CC BY-NC-SA 4.0).
Abstract (Originalsprache)
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.
Zitieren
APA
Kurniawan, T. B., Nuryana, M. R., & Bijokangko, R. S. (2025). Implementation of Constraint Satisfaction Problem Approach for Solving the Zebra Puzzle with Prolog. EPIC Journal of Electrical Power Instrumentation and Control, 8(2), 302-312. https://doi.org/10.32493/epic.v8i2.58721
Vancouver
Kurniawan TB, Nuryana MR, Bijokangko RS. Implementation of Constraint Satisfaction Problem Approach for Solving the Zebra Puzzle with Prolog. EPIC Journal of Electrical Power Instrumentation and Control. 2025;8(2):302-312. doi:10.32493/epic.v8i2.58721
BibTeX
@article{Kurniawan2025,
author = {Kurniawan, Tri Bagus and Nuryana, Muhammad Risqi and Bijokangko, Resi Sujiwo},
title = {Implementation of Constraint Satisfaction Problem Approach for Solving the Zebra Puzzle with Prolog},
journal = {EPIC Journal of Electrical Power Instrumentation and Control},
year = {2025},
volume = {8},
number = {2},
pages = {302--312},
doi = {10.32493/epic.v8i2.58721}
}
EUVIMED