INDAPlus21 / INDAPlus21/dpeilitz-task-10

Pass

Open
#1 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Prolog
Stars
0
Forks
0
PR merge metrics
No merged PRs in 30d

Description

Very well done David!

You code is really good!

Readability formatting is all personal preference. I find yours to be a little confusing, although a lot more readable than other predicates I've read today. In the future, your code will depend on whatever your team or company deems worthy. Until then, find a formatting that your are confortable with others reading; something that makes you look good.
Your code:

check_alive(Row, Column, Board, Colour, Visited):-

    %...

    (Stone = e;

        (Stone = Colour,

            \+ is_visited((Row, Column), Visited),
            Left is Column - 1,
            Right is Column + 1,
            Up is Row - 1,
            Down is Row + 1,
    (
        check_alive(Row, Left, Board, Colour, [(Row, Column) | Visited]);
        check_alive(Row, Right, Board, Colour, [(Row, Column) | Visited]);
        check_alive(Up, Column, Board, Colour, [(Row, Column) | Visited]);
        check_alive(Down, Column, Board, Colour, [(Row, Column) | Visited])
    )
)).

Airy formatting:

check_alive(Row, Column, Board, Colour, Visited):-

    %...

    (
        Stone = e;
        (
            Stone = Colour,

            \+ is_visited((Row, Column), Visited),

            Left is Column - 1,
            Right is Column + 1,
            Up is Row - 1,
            Down is Row + 1,

            (
                check_alive(Row, Left, Board, Colour, [(Row, Column) | Visited]);
                check_alive(Row, Right, Board, Colour, [(Row, Column) | Visited]);
                check_alive(Up, Column, Board, Colour, [(Row, Column) | Visited]);
                check_alive(Down, Column, Board, Colour, [(Row, Column) | Visited])
            )
        )
    ).

Thanks for your hard work!

Educational read: https://www.metalevel.at/prolog/fun

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue contains feedback on the formatting of the Prolog predicate check_alive/5, but it does not identify a file, test, or required change. Review the referenced code and repository context first; there is no explicit completion criterion beyond the general formatting comments.

Written by the indexing model from the issue text.

Assessment

Domain
backend
Issue type
Refactor
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
10/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.