Find Jobs
Hire Freelancers

Chessboard Display

$10-30 USD

Завершено
Опублікований over 9 years ago

$10-30 USD

Оплачується при отриманні
Develop a Prolog program to display a chessboard position. Such a task is ordinarily straightforward in most other programming languages, but to implement it in Prolog will require some thought. To be successful in this assignment, you must develop appropriate structures for representation and predicates to perform the various sub-parts of the problem as you have defined it. Unless you are already a proficient Prolog programmer, you will find that Prolog’s trace, debug and spy predicates will be your close friends during your code development. You will also find that simply putting in appropriate output statements in your code, as we do in much software development, will also be useful, although you will probably need to develop a predicate or two to work the formatting. The main entry point for running the program must be a predicate named “show” that takes two arguments. The first argument to the show predicate will be an integer, which will represent the dimension size of the chessboard. Multiple sizes will be tested. All tested sizes will be square. The second will be a list of pieces with their board positions. Each piece will be described using a list containing, in this order: (a) a Prolog constant representing the identifier for the piece, (b) the row in which the piece is located, and (c) the column in which the piece is located. The piece identifiers for White are: wk, wq, wb, wn, wr, and wp. Similarly, for Black, they are: bk, bq, bb, bn, br, and bp. Piece locations will be typical, 1-based matrix notation, with the row index first. For a standard 8 x 8 chessboard, the upper left corner is (1,1), the lower right is (8,8), and the position in the second row, third column is (2,3). Program output must be strictly to the terminal. It should begin with the string “Board Position:” and then should display the contents of every location on the board. If a location is empty, then the program should output two hyphens for the identifier. If a piece is located at a given position, then that piece’s identifier should be displayed. Adjacent location identifiers should be separated by a single space character to enhance readability. Your program will not need to validate the input data. All piece locations in test predicates will be within the bounds of the chessboard, and no two pieces will be assigned to the same board location. Sample run predicate and output ========================== The prolog command: show( 8, [ [ br, 7, 6 ], [ wr, 2, 4 ], [ wk, 2, 3 ], [ bk, 5, 2 ] ] ). Should produce the following output: Board Position: -- -- -- -- -- -- -- -- -- -- wk wr -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- bk -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- br -- -- -- -- -- -- -- -- -- --
ID проекту: 6680618

Про проект

Дистанційний проект
Активність 9 yrs ago

Хочете заробити?

Переваги подання заявок на Freelancer

Вкажіть свій бюджет та терміни
Отримайте гроші за свою роботу
Опишіть свою пропозицію
Реєстрація та подання заявок у проекти є безкоштовними
Доручений:
Аватарка користувача
I have not yet completed projects in this forum, but some of the projects should be first. Maybe it is your project? From the Prolog, of course, familiar. Swi?
$30 USD за 1 день
0,0 (0 відгуки(-ів))
0,0
0,0

Про клієнта

Прапор UNITED STATES
oviedo, United States
5,0
1
Спосіб оплати верифіковано
На сайті з лист. 3, 2014

Верифікація клієнта

Дякуємо! Ми надіслали на вашу електронну пошту посилання для отримання безкоштовного кредиту.
Під час надсилання електронного листа сталася помилка. Будь ласка, спробуйте ще раз.
Зареєстрованих користувачів Загальна кількість опублікованих робіт
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Завантажуємо для перегляду
Дозвіл на визначення геолокації надано.
Ваш сеанс входу закінчився, і сеанс було закрито. Будь ласка, увійдіть знову.