Skip to main content
deleted 92 characters in body
Source Link
Neil
  • 184.4k
  • 12
  • 76
  • 290

Charcoal, 1616 12 bytes

G⌈T¬↑←↑→³X↘XOUE¹E³XX‖O↘¬OUE¹ 

Try it online!Try it online! Link is to verbose version of code. Uses X and O for the output characters. Explanation:

G⌈T¬↑←↑→³XE³XX 

Draw the pegboard. , T andOutput a ¬2×3 are shortcuts forrectangle of →↓Xs.

‖O↘¬ 

Reflect diagonally downright, →↓←then separately down and ↓← respectively. There are no shortcuts for because e.g. ↑← would look the same as →↓left, so I optimise by having one fewerto complete the remaining X operation. This also has the effect of leaving the cursor nearer the centres.

↘XOO 

ChangeOutput the centre square to ancentral O. (It saves a byte to do this here rather than elsewhere in the code.)

UE¹ 

Space out the pegboard horizontally.

Charcoal, 16 bytes

G⌈T¬↑←↑→³X↘XOUE¹ 

Try it online! Link is to verbose version of code. Uses X and O for the output characters. Explanation:

G⌈T¬↑←↑→³X 

Draw the pegboard. , T and ¬ are shortcuts for →↓, →↓← and ↓← respectively. There are no shortcuts for because e.g. ↑← would look the same as →↓, so I optimise by having one fewer operation. This also has the effect of leaving the cursor nearer the centre.

↘XO 

Change the centre square to an O.

UE¹ 

Space out the pegboard horizontally.

Charcoal, 16 12 bytes

E³XX‖O↘¬OUE¹ 

Try it online! Link is to verbose version of code. Uses X and O for the output characters. Explanation:

E³XX 

Output a 2×3 rectangle of Xs.

‖O↘¬ 

Reflect diagonally downright, then separately down and left, to complete the remaining Xs.

O 

Output the central O. (It saves a byte to do this here rather than elsewhere in the code.)

UE¹ 

Space out the pegboard horizontally.

Source Link
Neil
  • 184.4k
  • 12
  • 76
  • 290

Charcoal, 16 bytes

G⌈T¬↑←↑→³X↘XOUE¹ 

Try it online! Link is to verbose version of code. Uses X and O for the output characters. Explanation:

G⌈T¬↑←↑→³X 

Draw the pegboard. , T and ¬ are shortcuts for →↓, →↓← and ↓← respectively. There are no shortcuts for because e.g. ↑← would look the same as →↓, so I optimise by having one fewer operation. This also has the effect of leaving the cursor nearer the centre.

↘XO 

Change the centre square to an O.

UE¹ 

Space out the pegboard horizontally.