[Solved] Creating a checkerboard in Java using a while loop [closed]


You could build something along this pseudo code:

for y=0 to 3 * ysize
   for x=0 to 3 * xsize
      if x even and y even
        print +
      if x even and y odd
        print |
      if x odd  and y even
        print --
      if x odd  and y odd
        print space space

I don’t think a single while loop is matching your needs.

If you want to put chess figures on your board later on, you maybe are better off to save your checkerboard into a StringBuffer and “render” it to screen 😉

1

solved Creating a checkerboard in Java using a while loop [closed]