Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
7
Task/Cut-a-rectangle/J/cut-a-rectangle-1.j
Normal file
7
Task/Cut-a-rectangle/J/cut-a-rectangle-1.j
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
init=: - {. 1: NB. initial state: 1 square choosen
|
||||
prop=: < {:,~2 ~:/\ ] NB. propagate: neighboring squares (vertically)
|
||||
poss=: I.@,@(prop +. prop"1 +. prop&.|. +. prop&.|."1)
|
||||
keep=: poss -. <:@#@, - I.@, NB. symmetrically valid possibilities
|
||||
N=: <:@-:@#@, NB. how many neighbors to add
|
||||
step=: [: ~.@; <@(((= i.@$) +. ])"0 _~ keep)"2
|
||||
all=: step^:N@init
|
||||
25
Task/Cut-a-rectangle/J/cut-a-rectangle-2.j
Normal file
25
Task/Cut-a-rectangle/J/cut-a-rectangle-2.j
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
'.#' <"2@:{~ all 3 4
|
||||
┌────┬────┬────┬────┬────┬────┬────┬────┬────┐
|
||||
│.###│.###│..##│...#│...#│....│....│....│....│
|
||||
│.#.#│..##│..##│..##│.#.#│..##│.#.#│#.#.│##..│
|
||||
│...#│...#│..##│.###│.###│####│####│####│####│
|
||||
└────┴────┴────┴────┴────┴────┴────┴────┴────┘
|
||||
$ all 4 5
|
||||
39 4 5
|
||||
3 13$ '.#' <"2@:{~ all 4 5
|
||||
┌─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┐
|
||||
│.####│.####│.####│.####│.####│.####│..###│..###│..###│..###│..###│...##│...##│
|
||||
│.####│.##.#│.#..#│..###│...##│....#│.####│.##.#│..###│...##│....#│.####│..###│
|
||||
│....#│.#..#│.##.#│...##│..###│.####│....#│.#..#│...##│..###│.####│....#│...##│
|
||||
│....#│....#│....#│....#│....#│....#│...##│...##│...##│...##│...##│..###│..###│
|
||||
├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤
|
||||
│...##│...##│...##│....#│....#│....#│....#│....#│....#│.....│.....│.....│.....│
|
||||
│...##│....#│.#..#│.####│..###│...##│....#│.#..#│.##.#│.####│..###│...##│....#│
|
||||
│..###│.####│.##.#│....#│...##│..###│.####│.##.#│.#..#│....#│...##│..###│.####│
|
||||
│..###│..###│..###│.####│.####│.####│.####│.####│.####│#####│#####│#####│#####│
|
||||
├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤
|
||||
│.....│.....│.....│.....│.....│.....│.....│.....│.....│.....│.....│.....│.....│
|
||||
│.#..#│.##.#│..##.│...#.│.....│.#...│.##..│#.##.│#..#.│#....│##...│###..│####.│
|
||||
│.##.#│.#..#│#..##│#.###│#####│###.#│##..#│#..#.│#.##.│####.│###..│##...│#....│
|
||||
│#####│#####│#####│#####│#####│#####│#####│#####│#####│#####│#####│#####│#####│
|
||||
└─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┘
|
||||
Loading…
Add table
Add a link
Reference in a new issue