Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- InputLs = [
- [1, 2, 3, 6, 8],
- [4, 5, 7, 9]
- ] &
- [P1Lst, P2Lst] <=> InputLs &
- Count = compute sum (Len) where
- (
- L1 = m:lst.member (InputLs) &
- Len = :lst.length (L1)
- ) &
- N = to_integer (sqrt (Count)) &
- RowElements = compute list (Res) where
- (
- Row = m:type.enum_nbr (1, N) &
- Res = compute list (El) where
- (
- El = m:type.enum_nbr (1 + (Row - 1) * N, N * Row) &
- nop
- )
- ) &
- ColElements = compute list (Res) where
- (
- Col = m:type.enum_nbr (1, N) &
- Res = compute list (El) where
- (
- El = m:type.step_nbr (Col, N * N, N) &
- nop
- )
- ) &
- LDiag = compute list (El) where
- (
- El = m:type.step_nbr (1, N * N, N + 1) &
- nop
- ) &
- RDiag = compute list (El) where
- (
- El = m:type.step_nbr (N, N * N - 1, N - 1) &
- nop
- ) &
- List1 = :lst.append (RowElements, ColElements) &
- List2 = :lst.append (List1, [LDiag]) &
- WinList = :lst.append (List2, [RDiag])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement