How do I prevent pound signs from overlapping in java game Domineering
<p>im fairly new to java and im supposed to Modify the game such that no overlap # signs are allowed to put on the board. For example: if the first player selects 0,0 horizontally, then the second player can’t selects 0,0 vertically again</p>

<p>I plugged </p>

<pre><code>(if(HORIZONTAL == VERTICAL) { System.out.println("illegal move try again"))
</code></pre>

<p>but it wouldnt work. what am I doing wrong?</p>

<p>Here is the program </p>

<pre><code>    public class Domineering
    { 
     public static final java.util.Scanner INPUT
     = new java.util.Scanner(System.in);

      public static final boolean HORIZONTAL = false;
      public static final boolean VERTICAL = true;

      private boolean [] [] squares;

      public Domineering()
      { squares = new boolean [8][8];
       }

       public boolean hasLegalMoveFor(boolean player)
       {
        int rowOffset = 0;
        int columnOffset=0;
        if (player == HORIZONTAL)
        {
         columnOffset =1;
         }else{
          rowOffset =1;
          }
          for(int row =0; row &lt;(8-rowOffset); row++)
          {
           for(int column = 0; column &lt;(8-columnOffset); column++)
           {
            if(!(squares[row][column]
             || squares[row + rowOffset][column + columnOffset])){
              return true;
               }
              }
             }
            return false;
           }
    public void play
    {
    boolean player = HORIZONTAL;
    while (true)
    {
     System.out.println("\n" + this);
     if (player == HORIZONTAL)
     {
      System.out.println("Horizontal to play");
     }else{
     System.out.println("Vertical to play");
     }
     if(!(hasLegalMoveFor(player)))
     {
      System.out.println)"No legal move--Sorry you lose!");
      return;
      }
      System.out.print("Row:");
      int row = INPUT.nextInt();
      System.out.print("Column");
      int column = INPUT.nextInt();
      playAt(row, column, player);
      player =!player;
      {
      if (HORIZONTAL == VERTICAL)  //this is what i added but it doesnt seem to
                                   //work right..what am i doing wrong?
      {
       System.out.println("Sorry Illegal Move try again")
       return;
        }
       }
      }
    public void playAT (int row, int column, boolean player)
       {
       squares [row][column +1]=true;
        }
       else
        {
        squares[row +1][column] = true;
        }
       }
    public string toString()
     {
     String result = " 0 1 2 3 4 5 6 7";
     for (int row =0; row &lt; 8; row++)
     {
     result += "\n" + row;
      for (int column = 0; column &lt; 8; column++)
     {
     if(squares[row][column]){
     result += " #";
     }else{
     result += " .";
       }
      } 
     }
    return result;
   }

    public static void main(String[] args){
     System.out.println("Welcome to Domineering.");
     Domineering game = new Domineering();
     game.play();
     }
    }
</code></pre>
