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

Commonmark migration
Source Link

#WinDbg, 95 bytes

WinDbg, 95 bytes

j(0<(@$t0|@$t1))&(6>@$t0)&(6>@$t1)'f8<<16 L19 30;eb2000018+@$t0-@$t1*5 @$t2;da/c5 8<<16 L19';?0

Almost half of it just verifying the indexes are in range... Input is done by setting the psuedo-registers $t0, $t1, and $t2 (where $t2 holds the ascii value of the char to replace). For example, (2,5,*) like the example would be:

0:000> r$t0=2
0:000> r$t1=5
0:000> r$t2=2a

Prints 0 on error.

How it works:

j (0<(@$t0|@$t1)) & (6>@$t0) & (6>@$t1) * If $t0 and $t1 are both positive and less than 6
'
 f 8<<16 L19 30; * Put 19 (0n25) '0's (ascii 30) at 2000000 (8<<16)
 eb 2000018+@$t0-@$t1*5 @$t2; * Replace the specified cell with the new char
 da /c5 8<<16 L19 * Print 19 (0n25) chars in rows of length 5
';
 ?0 * ...Else print 0

Sample Output:

0:000> r$t0=2
0:000> r$t1=5
0:000> r$t2=2a
0:000> j(0<(@$t0|@$t1))&(6>@$t0)&(6>@$t1)'f8<<16 L19 30;eb2000018+@$t0-@$t1*5 @$t2;da/c5 8<<16 L19';?0
Filled 0x19 bytes
02000000 "0*000"
02000005 "00000"
0200000a "00000"
0200000f "00000"
02000014 "00000"
0:000> r$t0=-2
0:000> j(0<(@$t0|@$t1))&(6>@$t0)&(6>@$t1)'f8<<16 L19 30;eb2000018+@$t0-@$t1*5 @$t2;da/c5 8<<16 L19';?0
Evaluate expression: 0 = 00000000
0:000> r$t0=4
0:000> r$t1=2
0:000> r$t2=23
0:000> j(0<(@$t0|@$t1))&(6>@$t0)&(6>@$t1)'f8<<16 L19 30;eb2000018+@$t0-@$t1*5 @$t2;da/c5 8<<16 L19';?0
Filled 0x19 bytes
02000000 "00000"
02000005 "00000"
0200000a "00000"
0200000f "000#0"
02000014 "00000"
0:000> r$t1=f
0:000> j(0<(@$t0|@$t1))&(6>@$t0)&(6>@$t1)'f8<<16 L19 30;eb2000018+@$t0-@$t1*5 @$t2;da/c5 8<<16 L19';?0
Evaluate expression: 0 = 00000000

#WinDbg, 95 bytes

j(0<(@$t0|@$t1))&(6>@$t0)&(6>@$t1)'f8<<16 L19 30;eb2000018+@$t0-@$t1*5 @$t2;da/c5 8<<16 L19';?0

Almost half of it just verifying the indexes are in range... Input is done by setting the psuedo-registers $t0, $t1, and $t2 (where $t2 holds the ascii value of the char to replace). For example, (2,5,*) like the example would be:

0:000> r$t0=2
0:000> r$t1=5
0:000> r$t2=2a

Prints 0 on error.

How it works:

j (0<(@$t0|@$t1)) & (6>@$t0) & (6>@$t1) * If $t0 and $t1 are both positive and less than 6
'
 f 8<<16 L19 30; * Put 19 (0n25) '0's (ascii 30) at 2000000 (8<<16)
 eb 2000018+@$t0-@$t1*5 @$t2; * Replace the specified cell with the new char
 da /c5 8<<16 L19 * Print 19 (0n25) chars in rows of length 5
';
 ?0 * ...Else print 0

Sample Output:

0:000> r$t0=2
0:000> r$t1=5
0:000> r$t2=2a
0:000> j(0<(@$t0|@$t1))&(6>@$t0)&(6>@$t1)'f8<<16 L19 30;eb2000018+@$t0-@$t1*5 @$t2;da/c5 8<<16 L19';?0
Filled 0x19 bytes
02000000 "0*000"
02000005 "00000"
0200000a "00000"
0200000f "00000"
02000014 "00000"
0:000> r$t0=-2
0:000> j(0<(@$t0|@$t1))&(6>@$t0)&(6>@$t1)'f8<<16 L19 30;eb2000018+@$t0-@$t1*5 @$t2;da/c5 8<<16 L19';?0
Evaluate expression: 0 = 00000000
0:000> r$t0=4
0:000> r$t1=2
0:000> r$t2=23
0:000> j(0<(@$t0|@$t1))&(6>@$t0)&(6>@$t1)'f8<<16 L19 30;eb2000018+@$t0-@$t1*5 @$t2;da/c5 8<<16 L19';?0
Filled 0x19 bytes
02000000 "00000"
02000005 "00000"
0200000a "00000"
0200000f "000#0"
02000014 "00000"
0:000> r$t1=f
0:000> j(0<(@$t0|@$t1))&(6>@$t0)&(6>@$t1)'f8<<16 L19 30;eb2000018+@$t0-@$t1*5 @$t2;da/c5 8<<16 L19';?0
Evaluate expression: 0 = 00000000

WinDbg, 95 bytes

j(0<(@$t0|@$t1))&(6>@$t0)&(6>@$t1)'f8<<16 L19 30;eb2000018+@$t0-@$t1*5 @$t2;da/c5 8<<16 L19';?0

Almost half of it just verifying the indexes are in range... Input is done by setting the psuedo-registers $t0, $t1, and $t2 (where $t2 holds the ascii value of the char to replace). For example, (2,5,*) like the example would be:

0:000> r$t0=2
0:000> r$t1=5
0:000> r$t2=2a

Prints 0 on error.

How it works:

j (0<(@$t0|@$t1)) & (6>@$t0) & (6>@$t1) * If $t0 and $t1 are both positive and less than 6
'
 f 8<<16 L19 30; * Put 19 (0n25) '0's (ascii 30) at 2000000 (8<<16)
 eb 2000018+@$t0-@$t1*5 @$t2; * Replace the specified cell with the new char
 da /c5 8<<16 L19 * Print 19 (0n25) chars in rows of length 5
';
 ?0 * ...Else print 0

Sample Output:

0:000> r$t0=2
0:000> r$t1=5
0:000> r$t2=2a
0:000> j(0<(@$t0|@$t1))&(6>@$t0)&(6>@$t1)'f8<<16 L19 30;eb2000018+@$t0-@$t1*5 @$t2;da/c5 8<<16 L19';?0
Filled 0x19 bytes
02000000 "0*000"
02000005 "00000"
0200000a "00000"
0200000f "00000"
02000014 "00000"
0:000> r$t0=-2
0:000> j(0<(@$t0|@$t1))&(6>@$t0)&(6>@$t1)'f8<<16 L19 30;eb2000018+@$t0-@$t1*5 @$t2;da/c5 8<<16 L19';?0
Evaluate expression: 0 = 00000000
0:000> r$t0=4
0:000> r$t1=2
0:000> r$t2=23
0:000> j(0<(@$t0|@$t1))&(6>@$t0)&(6>@$t1)'f8<<16 L19 30;eb2000018+@$t0-@$t1*5 @$t2;da/c5 8<<16 L19';?0
Filled 0x19 bytes
02000000 "00000"
02000005 "00000"
0200000a "00000"
0200000f "000#0"
02000014 "00000"
0:000> r$t1=f
0:000> j(0<(@$t0|@$t1))&(6>@$t0)&(6>@$t1)'f8<<16 L19 30;eb2000018+@$t0-@$t1*5 @$t2;da/c5 8<<16 L19';?0
Evaluate expression: 0 = 00000000
Source Link
milk
  • 3.2k
  • 2
  • 10
  • 15

#WinDbg, 95 bytes

j(0<(@$t0|@$t1))&(6>@$t0)&(6>@$t1)'f8<<16 L19 30;eb2000018+@$t0-@$t1*5 @$t2;da/c5 8<<16 L19';?0

Almost half of it just verifying the indexes are in range... Input is done by setting the psuedo-registers $t0, $t1, and $t2 (where $t2 holds the ascii value of the char to replace). For example, (2,5,*) like the example would be:

0:000> r$t0=2
0:000> r$t1=5
0:000> r$t2=2a

Prints 0 on error.

How it works:

j (0<(@$t0|@$t1)) & (6>@$t0) & (6>@$t1) * If $t0 and $t1 are both positive and less than 6
'
 f 8<<16 L19 30; * Put 19 (0n25) '0's (ascii 30) at 2000000 (8<<16)
 eb 2000018+@$t0-@$t1*5 @$t2; * Replace the specified cell with the new char
 da /c5 8<<16 L19 * Print 19 (0n25) chars in rows of length 5
';
 ?0 * ...Else print 0

Sample Output:

0:000> r$t0=2
0:000> r$t1=5
0:000> r$t2=2a
0:000> j(0<(@$t0|@$t1))&(6>@$t0)&(6>@$t1)'f8<<16 L19 30;eb2000018+@$t0-@$t1*5 @$t2;da/c5 8<<16 L19';?0
Filled 0x19 bytes
02000000 "0*000"
02000005 "00000"
0200000a "00000"
0200000f "00000"
02000014 "00000"
0:000> r$t0=-2
0:000> j(0<(@$t0|@$t1))&(6>@$t0)&(6>@$t1)'f8<<16 L19 30;eb2000018+@$t0-@$t1*5 @$t2;da/c5 8<<16 L19';?0
Evaluate expression: 0 = 00000000
0:000> r$t0=4
0:000> r$t1=2
0:000> r$t2=23
0:000> j(0<(@$t0|@$t1))&(6>@$t0)&(6>@$t1)'f8<<16 L19 30;eb2000018+@$t0-@$t1*5 @$t2;da/c5 8<<16 L19';?0
Filled 0x19 bytes
02000000 "00000"
02000005 "00000"
0200000a "00000"
0200000f "000#0"
02000014 "00000"
0:000> r$t1=f
0:000> j(0<(@$t0|@$t1))&(6>@$t0)&(6>@$t1)'f8<<16 L19 30;eb2000018+@$t0-@$t1*5 @$t2;da/c5 8<<16 L19';?0
Evaluate expression: 0 = 00000000

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