Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add queen-attack exercise #183

Closed
wants to merge 1 commit into from

Conversation

keiravillekode
Copy link
Contributor

No description provided.

@github-actions
Copy link

Hello. Thanks for opening a PR on Exercism. We are currently in a phase of our journey where we have paused community contributions to allow us to take a breather and redesign our community model. You can learn more in this blog post. As such, all issues and PRs in this repository are being automatically closed.

That doesn't mean we're not interested in your ideas, or that if you're stuck on something we don't want to help. The best place to discuss things is with our community on the Exercism Community Forum. You can use this link to copy this into a new topic there.


Note: If this PR has been pre-approved, please link back to this PR on the forum thread and a maintainer or staff member will reopen it.

@github-actions github-actions bot closed this Oct 15, 2023
#include "vendor/unity.h"

// Returns 1 if queen can be created, otherwise 0.
extern int can_create(int row, int column);
Copy link
Contributor Author

@keiravillekode keiravillekode Oct 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two possible alternatives:

typedef struct {
   int64_t row;
   int64_t column;
} position_t;

Alternative One:

// Populates and returns queen.
// Returns NULL if row or column are invalid.
position_t* create(int64_t row, int64_t column, position_t* queen);

int can_attack(position_t* queen_1, position_t* queen_2);

Alternative Two with no create function (adapted from C track):

typedef enum { CAN_NOT_ATTACK, CAN_ATTACK, INVALID_POSITION } attack_status_t;


attack_status_t can_attack(position_t* queen_1, position_t* queen_2);

@ErikSchierboom
Copy link
Member

I can't recreate this PR due to it being "force-pushed or recreated" (Github's wording)

@keiravillekode
Copy link
Contributor Author

I can't recreate this PR due to it being "force-pushed or recreated" (Github's wording)

Sorry, I made a late change and rebased.

Replacement PR: #186

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants