0

I'd like to typeset a board game that (visually speaking) is closer to Othello --- because it uses round stones. The package othelloboard is almost perfect. My main concern is that I need a different board. The board I need doesn't contain the corners, to cite one difference and that's almost the only difference: just remove the corners. But there's one more difference: the first and last rows and file should be a tiny bit detached from the 6x6 inner board. (That's less important than removing the corners.)

So I'm looking for a package that lets me choose which squares belong to the board and also let me separate ranks and rows by small distance so as to create this visual-detachment.

I think the ideal thing for me would be make changes to the othelloboard package so that I can redesign the board and apply a separation to the "outer ring" of the "inner 6x6 board". Because for everything else I need, othelloboard seems to be perfect.

Is there a package that's just perfect for this request or should I really go along with othelloboard and change its source code to fix my needs? Thank you.

1
  • 1
    Welcome to TeX.SE! Can you maybe share a link to your game, or at least name it, that might help others to find your question and answer it.
    – TobiBS
    Jul 26 '20 at 13:11
1

The MWE below shows a modification of the othelloboard package to remove the corner fields and to separate the outer rows and columns from the inner 6x6 board with a thick line.

I opted not to change the actual position of the outer rows and columns because that would require a full rewrite of everything in the package that has to do with drawing at specific coordinates (which would amount to a very large number of changes).

Apart from the grid drawing also the two environments othelloboard and othelloboardnorefs needed to be changed, because the original definition draws a frame around the board (which is actually not necessary because the outer lines are also drawn in the grid).

MWE:

\documentclass{article}
\usepackage{othelloboard}

% redefinition to remove frame around board
\renewenvironment{othelloboard}[1]%
{\renewcommand{\scalefactor}{#1} \begin{lrbox}{\fmboard}\begin{picture}(192,192)\resetalldisccolours \othellogrid \gridrefs}
{\end{picture} \end{lrbox} \scalebox{\scalefactor}{\begin{picture}(208,208)(-16,0) \usebox{\fmboard} \end{picture}}}

\renewenvironment{othelloboardnorefs}[1]%
{\renewcommand{\scalefactor}{#1} \begin{lrbox}{\fmboard}\begin{picture}(192,192)\resetalldisccolours \othellogrid}
{\end{picture} \end{lrbox} \scalebox{\scalefactor}{\begin{picture}(192,192)(0,0) \usebox{\fmboard} \end{picture}}}

% redefinition of grid
\renewcommand{\othellogrid}{%
% outside lines, shorter to cut off corners
\begingroup % start of \linethickness scope
\linethickness{0.8mm}
\put(0,24){\line(0,1){144}}   % bottom left to top left
\put(192,24){\line(0,1){144}} % top right to bottom right
\put(24,0){\line(1,0){144}}   % bottom left to bottom right
\put(24,192){\line(1,0){144}} % top left to top right
% inside lines
% lines around the 6x6 inner board
\put(24,0){\line(0,1){192}}
\put(168,0){\line(0,1){192}}
\put(0,24){\line(1,0){192}}
\put(0,168){\line(1,0){192}}
\endgroup % end of \linethickness scope
% other inner lines
\put(48,0){\line(0,1){192}}
\put(72,0){\line(0,1){192}}
\put(96,0){\line(0,1){192}}
\put(120,0){\line(0,1){192}}
\put(144,0){\line(0,1){192}}
\put(0,48){\line(1,0){192}}
\put(0,72){\line(1,0){192}}
\put(0,96){\line(1,0){192}}
\put(0,120){\line(1,0){192}}
\put(0,144){\line(1,0){192}}
}

\begin{document}
\begin{othelloboard}{1}
\othelloarrayfirstrow   {0}{0}{0}{0}{0}{0}{0}{0}
\othelloarraysecondrow  {0}{0}{2}{0}{0}{0}{0}{0}
\othelloarraythirdrow   {0}{1}{2}{2}{2}{0}{0}{0}
\othelloarrayfourthrow  {0}{1}{2}{1}{2}{1}{0}{0}
\othelloarrayfifthrow   {0}{0}{2}{2}{1}{1}{0}{0}
\othelloarraysixthrow   {0}{0}{2}{1}{1}{1}{0}{0}
\othelloarrayseventhrow {0}{0}{0}{0}{0}{0}{0}{0}
\othelloarrayeighthrow  {0}{0}{0}{0}{0}{0}{0}{0}
\end{othelloboard}
\end{document}

Result:

enter image description here


Edit: a filled square can be printed using a rule of 24pt width and height. With a double for-loop (for example using the forloop package) you can draw a checkered board. To separate the inner board from the outer rows and columns (the thick line is hard to see with the checkered squares) you can draw a gray rectangle around the inner squares.

MWE:

\documentclass{article}
\usepackage{othelloboard}
\usepackage{forloop}
\usepackage{xcolor}

% redefinition to remove frame around board
\renewenvironment{othelloboard}[1]%
{\renewcommand{\scalefactor}{#1} \begin{lrbox}{\fmboard}\begin{picture}(192,192)\resetalldisccolours \othellogrid \gridrefs}
{\end{picture} \end{lrbox} \scalebox{\scalefactor}{\begin{picture}(208,208)(-16,0) \usebox{\fmboard} \end{picture}}}

\renewenvironment{othelloboardnorefs}[1]%
{\renewcommand{\scalefactor}{#1} \begin{lrbox}{\fmboard}\begin{picture}(192,192)\resetalldisccolours \othellogrid}
{\end{picture} \end{lrbox} \scalebox{\scalefactor}{\begin{picture}(192,192)(0,0) \usebox{\fmboard} \end{picture}}}

% some variables for checkered board loops
\newcounter{xsquare}
\newcounter{ysquare}
\newcounter{shiftsquare}
\newcounter{skipsquare}

% redefinition of grid
\renewcommand{\othellogrid}{%
% outside lines, shorter to cut off corners
\begingroup % start of \linethickness scope
\linethickness{0.8mm}
\put(0,24){\line(0,1){144}}   % bottom left to top left
\put(192,24){\line(0,1){144}} % top right to bottom right
\put(24,0){\line(1,0){144}}   % bottom left to bottom right
\put(24,192){\line(1,0){144}} % top left to top right
% inside lines
\put(24,0){\line(0,1){192}}
\put(168,0){\line(0,1){192}}
\put(0,24){\line(1,0){192}}
\put(0,168){\line(1,0){192}}
\endgroup % end of \linethickness scope
\put(48,0){\line(0,1){192}}
\put(72,0){\line(0,1){192}}
\put(96,0){\line(0,1){192}}
\put(120,0){\line(0,1){192}}
\put(144,0){\line(0,1){192}}
\put(0,48){\line(1,0){192}}
\put(0,72){\line(1,0){192}}
\put(0,96){\line(1,0){192}}
\put(0,120){\line(1,0){192}}
\put(0,144){\line(1,0){192}}
%
% double for loop for checkered board
% loop rows
\forloop[24]{ysquare}{0}{\value{ysquare}<192}{%
% shift or shift back one square after every row
\ifnum\value{shiftsquare}=0\setcounter{shiftsquare}{24}\else\setcounter{shiftsquare}{0}\fi
% loop columns
\forloop[48]{xsquare}{\value{shiftsquare}}{\value{xsquare}<192}{%
% check for skipping corners
\setcounter{skipsquare}{0}
% bottom right corner
\ifnum\value{ysquare}=0\ifnum\value{xsquare}=168%
\setcounter{skipsquare}{1}\fi\fi
% top left corner
\ifnum\value{ysquare}=168\ifnum\value{xsquare}=0%
\setcounter{skipsquare}{1}\fi\fi
% draw black square if not one of the two corners
\ifnum\value{skipsquare}=0%
\put(\thexsquare,\theysquare){\rule{24pt}{24pt}}%
\fi
}% end loop columns
}% end loop rows
% gray frame around inner board
\begingroup
\color{gray}
\linethickness{1.2mm}
\put(24,24){\line(0,1){144}}
\put(168,24){\line(0,1){144}}
\put(24,24){\line(1,0){144}}
\put(24,168){\line(1,0){144}}
\endgroup
}

\begin{document}
\begin{othelloboard}{1}
\othelloarrayfirstrow   {0}{0}{0}{0}{0}{0}{0}{0}
\othelloarraysecondrow  {0}{0}{2}{0}{0}{0}{0}{0}
\othelloarraythirdrow   {0}{1}{2}{2}{2}{0}{0}{0}
\othelloarrayfourthrow  {0}{1}{2}{1}{2}{1}{0}{0}
\othelloarrayfifthrow   {0}{0}{2}{2}{1}{1}{0}{0}
\othelloarraysixthrow   {0}{0}{2}{1}{1}{1}{0}{0}
\othelloarrayseventhrow {0}{0}{0}{0}{0}{0}{0}{0}
\othelloarrayeighthrow  {0}{0}{0}{0}{0}{0}{0}{0}
\end{othelloboard}
\end{document}

Result:

enter image description here

If you also want to put pieces on black squares then you can modify the code that is used for drawing pieces (\blackdisc and \whitedisc) to use colors other than plain black and white. Below I've used dark gray and off-white with two circles around the pieces.

\definecolor{offwhite}{RGB}{255,255,244}
\definecolor{dimgray}{RGB}{42,42,42}
\renewcommand{\blackdisc}{\linethickness{0.5mm}\color{dimgray}\circle*{19}\color{gray}\circle{19.4}\linethickness{0.2mm}\circle{15}}
\renewcommand{\whitedisc}{\linethickness{0.5mm}\color{offwhite}\circle*{19}\color{gray}\circle{19.4}\linethickness{0.2mm}\circle{15}}

enter image description here

9
  • You did understand it! Thanks. I was making those changes myself, but you seemed to have done much more quickly. Impressive. Jul 26 '20 at 16:23
  • But, you know, I get ambitious fast. The othelloboard.sty doesn't seem to provide an easy way for a checkered board, so I might write one from scratch using Tikz. I think skak and chessboard are too complex for my needs and perhaps othelloboard is too limited. Jul 26 '20 at 17:14
  • @user12406990 I have added a checkered variant using a nested for-loop.
    – Marijn
    Jul 26 '20 at 18:15
  • You're unbelievable! I started reading Tikz's documentation and I see I lack the sophistication to get things done with the tools available, even though the package is marvelous. So, thanks very much for providing me with probably everything I'll need! Jul 26 '20 at 18:40
  • @user12406990 note that currently you cannot put pieces on black squares (because black on black is not visible). If the game allows for that situation then you need to make more changes to the code.
    – Marijn
    Jul 26 '20 at 18:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.