Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions exercises/practice/queen-attack/.meta/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"BoDaly",
"ErikSchierboom",
"IndelicateArgot",
"jagdish-15",
"javaeeeee",
"rchavarria",
"ryanplusplus",
Expand Down
40 changes: 25 additions & 15 deletions exercises/practice/queen-attack/.meta/tests.toml
Original file line number Diff line number Diff line change
@@ -1,39 +1,49 @@
# This is an auto-generated file. Regular comments will be removed when this
# file is regenerated. Regenerating will not touch any manually added keys,
# so comments can be added in a "comment" key.
# This is an auto-generated file.
#
# Regenerating this file via `configlet sync` will:
# - Recreate every `description` key/value pair
# - Recreate every `reimplements` key/value pair, where they exist in problem-specifications
# - Remove any `include = true` key/value pair (an omitted `include` key implies inclusion)
# - Preserve any other key/value pair
#
# As user-added comments (using the # character) will be removed when this file
# is regenerated, comments can be added via a `comment` key.

[3ac4f735-d36c-44c4-a3e2-316f79704203]
description = "queen with a valid position"
description = "Test creation of Queens with valid and invalid positions -> queen with a valid position"

[4e812d5d-b974-4e38-9a6b-8e0492bfa7be]
description = "queen must have positive row"
description = "Test creation of Queens with valid and invalid positions -> queen must have positive row"

[f07b7536-b66b-4f08-beb9-4d70d891d5c8]
description = "queen must have row on board"
description = "Test creation of Queens with valid and invalid positions -> queen must have row on board"

[15a10794-36d9-4907-ae6b-e5a0d4c54ebe]
description = "queen must have positive column"
description = "Test creation of Queens with valid and invalid positions -> queen must have positive column"

[6907762d-0e8a-4c38-87fb-12f2f65f0ce4]
description = "queen must have column on board"
description = "Test creation of Queens with valid and invalid positions -> queen must have column on board"

[33ae4113-d237-42ee-bac1-e1e699c0c007]
description = "can not attack"
description = "Test the ability of one queen to attack another -> cannot attack"

[eaa65540-ea7c-4152-8c21-003c7a68c914]
description = "can attack on same row"
description = "Test the ability of one queen to attack another -> can attack on same row"

[bae6f609-2c0e-4154-af71-af82b7c31cea]
description = "can attack on same column"
description = "Test the ability of one queen to attack another -> can attack on same column"

[0e1b4139-b90d-4562-bd58-dfa04f1746c7]
description = "can attack on first diagonal"
description = "Test the ability of one queen to attack another -> can attack on first diagonal"

[ff9b7ed4-e4b6-401b-8d16-bc894d6d3dcd]
description = "can attack on second diagonal"
description = "Test the ability of one queen to attack another -> can attack on second diagonal"

[0a71e605-6e28-4cc2-aa47-d20a2e71037a]
description = "can attack on third diagonal"
description = "Test the ability of one queen to attack another -> can attack on third diagonal"

[0790b588-ae73-4f1f-a968-dd0b34f45f86]
description = "can attack on fourth diagonal"
description = "Test the ability of one queen to attack another -> can attack on fourth diagonal"

[543f8fd4-2597-4aad-8d77-cbdab63619f8]
description = "Test the ability of one queen to attack another -> cannot attack if falling diagonals are only the same when reflected across the longest falling diagonal"
23 changes: 14 additions & 9 deletions exercises/practice/queen-attack/queen-attack.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,50 +40,55 @@ describe('Queens', () => {
});

describe('Test the ability of one queen to attack another', () => {
xtest('queens cannot attack', () => {
xtest('cannot attack', () => {
const queens = new QueenAttack({ white: [2, 4], black: [6, 6] });
expect(queens.canAttack).toEqual(false);
});

xtest('queens can attack when they are on the same row', () => {
xtest('can attack on same row', () => {
const queens = new QueenAttack({ white: [2, 4], black: [2, 6] });
expect(queens.canAttack).toEqual(true);
});

xtest('queens can attack when they are on the same column', () => {
xtest('can attack on same column', () => {
const queens = new QueenAttack({ white: [4, 5], black: [2, 5] });
expect(queens.canAttack).toEqual(true);
});

xtest('queens can attack diagonally', () => {
xtest('can attack on first diagonal', () => {
const queens = new QueenAttack({ white: [2, 2], black: [0, 4] });
expect(queens.canAttack).toEqual(true);
});

xtest('queens can attack another diagonally', () => {
xtest('can attack on second diagonal', () => {
const queens = new QueenAttack({ white: [2, 2], black: [3, 1] });
expect(queens.canAttack).toEqual(true);
});

xtest('queens can attack yet another diagonally', () => {
xtest('can attack on third diagonal', () => {
const queens = new QueenAttack({ white: [2, 2], black: [1, 1] });
expect(queens.canAttack).toEqual(true);
});

xtest('queens can attack diagonally, really', () => {
xtest('can attack on fourth diagonal', () => {
const queens = new QueenAttack({ white: [1, 7], black: [0, 6] });
expect(queens.canAttack).toEqual(true);
});

xtest('queens can attack on a north-east/south-west diagonal', () => {
xtest('can attack on fifth diagonal', () => {
const queens = new QueenAttack({ white: [7, 0], black: [0, 7] });
expect(queens.canAttack).toEqual(true);
});

xtest('queens can attack on another ne/sw diagonal', () => {
xtest('can attack on sixth diagonal', () => {
const queens = new QueenAttack({ white: [2, 6], black: [5, 3] });
expect(queens.canAttack).toEqual(true);
});

xtest('cannot attack if falling diagonals are only the same when reflected across the longest falling diagonal', () => {
const queens = new QueenAttack({ white: [4, 1], black: [2, 5] });
expect(queens.canAttack).toEqual(false);
});
});

describe('Test the board visualisation', () => {
Expand Down