Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

Post Undeleted by Jonathan Allan
added 208 characters in body
Source Link
Jonathan Allan
  • 115.4k
  • 8
  • 68
  • 293

Jelly, 1928 bytes

This feels way too long...

Ṗ’ḅ5NṪ0ẋ24¤;ṙÑs5UY
Ṫ0ẋ24¤;ṙÇs5UY’ḅ5
Ṗḟ5R¤
-ÑÇ?

TryItOnline! TryItOnline!

Ṗ’ḅ5NṪ0ẋ24¤;ṙÑs5UY - Link 1, location helper: [row, column, character] e.g. [5,2,'*']
Ṗ - pop: [column, row]  [5,2]
 ’ - decrement: [column-1, row-1] [4,1]
 ḅ5 - convert from base 5: 5*column-5+row-1 21
 N - negate: -5*column+5-row+1 -21
Ṫ0ẋ24¤;ṙÇs5UY - Mainmake linkgrid: [row, column, character] e.g. [5,2,'*']
Ṫ - tail: character '*'
 ¤ - nilad followed by link(s) as a nilad 
 0 - zero
 ẋ - repeated
 24 - 24 times [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
 ; - concatenate: "000000000000000000000000*"
 ÇÑ - call lastnext link (12) as a monad -21
 ṙ - rotate left by "000*000000000000000000000"
 s5 - split into chunks of length 5 ["000*0","00000","00000","00000","00000"]
 U - upend (reveres each) ["0*000","00000","00000","00000","00000"]
 Y - join with line feeds 0*000
 - implicit print 00000
 00000
’ḅ5 - Link 2, position: [row, column] 00000
’ - decrement  00000
 ḅ5 - convert from base 5
Ṗḟ5R¤ - Link 3, input error checking: [row, column, character]
Ṗ - pop: [row, column]
  - filter out values in
 5R¤ - range(5): [1,2,3,4,5] - any values not in this remain giving a truthy result
-ÑÇ? - Main link: [row, column, character]
 ? - ternary if:
 Ç - last link (3) as a monad
- - -1 (if truthy - the error 00000identification)
 Ñ - next link (1) as a monad (if falsey - the grid)

Jelly, 19 bytes

Ṗ’ḅ5N
Ṫ0ẋ24¤;ṙÇs5UY

TryItOnline!

Ṗ’ḅ5N - Link 1, location helper: [row, column, character] e.g. [5,2,'*']
Ṗ - pop: [column, row]  [5,2]
 ’ - decrement: [column-1, row-1] [4,1]
 ḅ5 - convert from base 5: 5*column-5+row-1 21
 N - negate: -5*column+5-row+1 -21
Ṫ0ẋ24¤;ṙÇs5UY - Main link: [row, column, character] e.g. [5,2,'*']
Ṫ - tail: character '*'
 ¤ - nilad followed by link(s) as a nilad 
 0 - zero
 ẋ - repeated
 24 - 24 times [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
 ; - concatenate: "000000000000000000000000*"
 Ç - call last link (1) as a monad -21
 ṙ - rotate left by "000*000000000000000000000"
 s5 - split into chunks of length 5 ["000*0","00000","00000","00000","00000"]
 U - upend (reveres each) ["0*000","00000","00000","00000","00000"]
 Y - join with line feeds 0*000
 - implicit print 00000
 00000
 00000
 00000

Jelly, 28 bytes

This feels way too long...

Ṫ0ẋ24¤;ṙÑs5UY
’ḅ5
Ṗḟ5R¤
-ÑÇ?

TryItOnline!

Ṫ0ẋ24¤;ṙÑs5UY - Link 1, make grid: [row, column, character] e.g. [5,2,'*']
Ṫ - tail: character '*'
 ¤ - nilad followed by link(s) as a nilad 
 0 - zero
 ẋ - repeated
 24 - 24 times [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
 ; - concatenate: "000000000000000000000000*"
 Ñ - call next link (2) as a monad 21
 ṙ - rotate left by "000*000000000000000000000"
 s5 - split into chunks of length 5 ["000*0","00000","00000","00000","00000"]
 U - upend (reveres each) ["0*000","00000","00000","00000","00000"]
 Y - join with line feeds 0*000
 - implicit print 00000
 00000
’ḅ5 - Link 2, position: [row, column] 00000
’ - decrement  00000
 ḅ5 - convert from base 5
Ṗḟ5R¤ - Link 3, input error checking: [row, column, character]
Ṗ - pop: [row, column]
  - filter out values in
 5R¤ - range(5): [1,2,3,4,5] - any values not in this remain giving a truthy result
-ÑÇ? - Main link: [row, column, character]
 ? - ternary if:
 Ç - last link (3) as a monad
- - -1 (if truthy - the error identification)
 Ñ - next link (1) as a monad (if falsey - the grid)
Post Deleted by Jonathan Allan
added 1640 characters in body
Source Link
Jonathan Allan
  • 115.4k
  • 8
  • 68
  • 293

How?

Ṗ’ḅ5N - Link 1, location helper: [row, column, character] e.g. [5,2,'*']
Ṗ - pop: [column, row] [5,2]
 ’ - decrement: [column-1, row-1] [4,1]
 ḅ5 - convert from base 5: 5*column-5+row-1 21
 N - negate: -5*column+5-row+1 -21
Ṫ0ẋ24¤;ṙÇs5UY - Main link: [row, column, character] e.g. [5,2,'*']
Ṫ - tail: character '*'
 ¤ - nilad followed by link(s) as a nilad 
 0 - zero
 ẋ - repeated
 24 - 24 times [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
 ; - concatenate: "000000000000000000000000*"
 Ç - call last link (1) as a monad -21
 ṙ - rotate left by "000*000000000000000000000"
 s5 - split into chunks of length 5 ["000*0","00000","00000","00000","00000"]
 U - upend (reveres each) ["0*000","00000","00000","00000","00000"]
 Y - join with line feeds 0*000
 - implicit print 00000
 00000
 00000
 00000

How?

Ṗ’ḅ5N - Link 1, location helper: [row, column, character] e.g. [5,2,'*']
Ṗ - pop: [column, row] [5,2]
 ’ - decrement: [column-1, row-1] [4,1]
 ḅ5 - convert from base 5: 5*column-5+row-1 21
 N - negate: -5*column+5-row+1 -21
Ṫ0ẋ24¤;ṙÇs5UY - Main link: [row, column, character] e.g. [5,2,'*']
Ṫ - tail: character '*'
 ¤ - nilad followed by link(s) as a nilad 
 0 - zero
 ẋ - repeated
 24 - 24 times [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
 ; - concatenate: "000000000000000000000000*"
 Ç - call last link (1) as a monad -21
 ṙ - rotate left by "000*000000000000000000000"
 s5 - split into chunks of length 5 ["000*0","00000","00000","00000","00000"]
 U - upend (reveres each) ["0*000","00000","00000","00000","00000"]
 Y - join with line feeds 0*000
 - implicit print 00000
 00000
 00000
 00000
Source Link
Jonathan Allan
  • 115.4k
  • 8
  • 68
  • 293

Jelly, 19 bytes

Ṗ’ḅ5N
Ṫ0ẋ24¤;ṙÇs5UY

TryItOnline!

AltStyle によって変換されたページ (->オリジナル) /