Download Jar. Libraryless. Click here for Pure Java version (14460L/103K).
1 | !7 |
2 | |
3 | answer { |
4 | makeBoard(parseFirstInt(s)); |
5 | } |
6 | |
7 | p { |
8 | bot(); |
9 | print("Please type board size."); |
10 | consoleSetInput("8"); |
11 | } |
12 | |
13 | svoid makeBoard(int size) { |
14 | Web web = simpleWeb(); |
15 | for (int row = 1; row <= size; row++) |
16 | for (char col = 'A'; col < (char) ('A'+size); col++) { |
17 | rel(size, web, col, row, (char) (col+1), row, 'right); |
18 | rel(size, web, col, row, (char) (col-1), row, 'left); |
19 | rel(size, web, col, row, col, row+1, 'up); |
20 | rel(size, web, col, row, col, row-1, 'down); |
21 | } |
22 | showWeb(web); |
23 | } |
24 | |
25 | svoid rel(int size, Web web, char col1, int row1, char col2, int row2, S rel) { |
26 | S a = cell(col1, row1, size), b = cell(col2, row2, size); |
27 | if (nempty(a) && nempty(b)) |
28 | web_addRelation(web, a, b, rel); |
29 | } |
30 | |
31 | sS cell(char col, int row, int size) { |
32 | if (row >= 1 && row <= size && col >= 'A' && col < (char) ('A'+size)) |
33 | ret col + str(row); |
34 | null; |
35 | } |
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1010388 |
Snippet name: | Chess Network [dev.] |
Eternal ID of this version: | #1010388/13 |
Text MD5: | 44c7fd6a55e4f44916c711400994aac5 |
Transpilation MD5: | 19e41d452653530f767fe438eee7bcde |
Author: | stefan |
Category: | javax / a.i. |
Type: | JavaX source code (desktop) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-09-14 04:35:29 |
Source code size: | 909 bytes / 35 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 568 / 1289 |
Version history: | 12 change(s) |
Referenced in: | [show references] |