4 Rollback to Revision 1
source | link

MATL, 27 3131 bytes

81)t3\8:t!Vt48+wZ*j1)tK\~++w4\~?5\g9+LYH\]2#f2Y2!w)wVh

Try it online!Try it online!

8:        % row vector [1,2,...,8]
!V        % transform into column char array ['1';'2';...;'8']
t48+      % duplicate. Add 48 so that '1' becomes 'a' etc
wZ*       % swap. Cartesian product. Gives 2-column char array with rows 'a1', ...., 'h8'
j1)       % first character of input
tK\~      % true if input is 'both'
?         % if so...
  5\g     %   1 if input is 'light', 0 if 'dark'
  9+      %   add 9: gives 9 for 'dark',  10 for light'
  L       %   predefined literal to pick odd or even indices of array
  Y)      %   pick rows corresponding to those inidices
          % implicitly end if and display

MATL, 27 31 bytes

8:!Vt48+wZ*j1)tK\~?5\g9+LY)

Try it online!

8:        % row vector [1,2,...,8]
!V        % transform into column char array ['1';'2';...;'8']
t48+      % duplicate. Add 48 so that '1' becomes 'a' etc
wZ*       % swap. Cartesian product. Gives 2-column char array with rows 'a1', ...., 'h8'
j1)       % first character of input
tK\~      % true if input is 'both'
?         % if so...
  5\g     %   1 if input is 'light', 0 if 'dark'
  9+      %   add 9: gives 9 for 'dark',  10 for light'
  L       %   predefined literal to pick odd or even indices of array
  Y)      %   pick rows corresponding to those inidices
          % implicitly end if and display

MATL, 31 bytes

1)t3\8:t!++w4\~?H\]2#f2Y2!w)wVh

Try it online!

3 added 671 characters in body
source | link

MATL, 27 31 bytes

8:!Vt48+wZ*j1)tK\~?5\g9+LY)

Try it online!

8:        % row vector [1,2,...,8]
!V        % transform into column char array ['1';'2';...;'8']
t48+      % duplicate. Add 48 so that '1' becomes 'a' etc
wZ*       % swap. Cartesian product. Gives 2-column char array with rows 'a1', ...., 'h8'
j1)       % first character of input
tK\~      % true if input is 'both'
?         % if so...
  5\g     %   1 if input is 'light', 0 if 'dark'
  9+      %   add 9: gives 9 for 'dark',  10 for light'
  L       %   predefined literal to pick odd or even indices of array
  Y)      %   pick rows corresponding to those inidices
          % implicitly end if and display

MATL, 27 31 bytes

8:!Vt48+wZ*j1)tK\~?5\g9+LY)

Try it online!

MATL, 27 31 bytes

8:!Vt48+wZ*j1)tK\~?5\g9+LY)

Try it online!

8:        % row vector [1,2,...,8]
!V        % transform into column char array ['1';'2';...;'8']
t48+      % duplicate. Add 48 so that '1' becomes 'a' etc
wZ*       % swap. Cartesian product. Gives 2-column char array with rows 'a1', ...., 'h8'
j1)       % first character of input
tK\~      % true if input is 'both'
?         % if so...
  5\g     %   1 if input is 'light', 0 if 'dark'
  9+      %   add 9: gives 9 for 'dark',  10 for light'
  L       %   predefined literal to pick odd or even indices of array
  Y)      %   pick rows corresponding to those inidices
          % implicitly end if and display
2 deleted 2 characters in body
source | link

MATL, 3127 31 bytes

1)t3\88:t!++w4\~Vt48+wZ*j1)tK\~?H\]2#f2Y2!w5\g9+LY)wVh

Try it online!Try it online!

MATL, 31 bytes

1)t3\8:t!++w4\~?H\]2#f2Y2!w)wVh

Try it online!

MATL, 27 31 bytes

8:!Vt48+wZ*j1)tK\~?5\g9+LY)

Try it online!

1
source | link