Link to home
Start Free TrialLog in
Avatar of USA Java Newbie
USA Java Newbie

asked on

Tic Tac Toe Java checking for a win

My method for checking for a horizontal win is not working any help is greatful
MainFile.java
ConnectFourGame.java
Avatar of mccarl
mccarl
Flag of Australia image

You still have a problem where you are NOT checking the char in the "real" column of the board, but you are checking the columns that have '|' characters too. I would recommend that you remove all the | and _ characters from your array. Keep the array just for the state if there is a RED, BLACK or empty piece. You can add all the | and _ drawing characters when you print out the board.

The other problem is that the array that you call "f" contains characters like R, Y,  , |, _  but in your checkWins method you are comparing them to ints such as RED and BLACK.
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.