-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #258 from govariantsteam/add_board_patterns_to_baduk
add components for new board patterns that work with baduk
- Loading branch information
Showing
18 changed files
with
413 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { Color } from "../../variants/badukWithAbstractBoard"; | ||
import { | ||
BoardPattern, | ||
createBoard, | ||
createGraph, | ||
} from "../abstractBoard/boardFactory"; | ||
import { Intersection } from "../abstractBoard/intersection"; | ||
|
||
test("create rhombitrihexagonal board", () => { | ||
const intersections = createBoard( | ||
{ | ||
type: BoardPattern.Polygonal, | ||
size: 2, | ||
}, | ||
Intersection, | ||
); | ||
const graph = createGraph(intersections, Color.EMPTY); | ||
|
||
expect( | ||
graph.reduce<number>( | ||
(prev, _, index, g) => prev + g.neighbors(index).length, | ||
0, | ||
), | ||
).toEqual(6 * 4 + 12 * 3); | ||
|
||
// Remark: This assertion is not independent of implementation | ||
// Also see PolygonalBoardHelper lines 4 - 28 | ||
expect(graph.neighbors(0)).toEqual([1, 5, 6, 17]); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.