This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Hello all. I looked for an introduction forum but didn't see one so I suppose this will be my intro.
I bought the book Head First Java, 2nd Edition about a week ago to give a go at finally learning a whole language in depth. To this point I've only done a bit of Perl and with that only enough to do some basic scripting. I have given Ruby a try about a year ago but got distracted and put it down. I must say so far this book has been excellent. Kathy Sierra and Bert Bates should be commended for being thorough and descriptive without being dry, which I think is an all too common programming book treatment.
I'm through chapter 5 and had a bit of brainstorming for my first independent programming project. With what I've learned so far I'm attempting to make a connect4 style game. So far I have made myself an array for the game field and am trying to print it to screen. What I'm looking for is output like so:
I understand that I need to find the last element in the row and insert a newline but am unsure where in my code this should be and how to find that end of row. Do I do with a modulus of the end element? Would that work with the element counter being an int?
aha.. I got it.
You meant System.out.println() with no input at all.
Thanks Campbell. I had never used it like this. It tried just now and it works fine.
Joined: Apr 29, 2010
Oh man I can't believe I didn't see that. Thanks guys for pointing that out. I feel noob. Also, looking through that again had me realize I had my array switched around so instead of 6 rows and 7 columns I was getting 7 rows and 6 columns. That would have made connect 4 a bit difficult. Anyway, here's my resulting code for both the game field creation and the game field print. My next task is setting up the player classes and having them assign values to the game spots.
Joined: Oct 13, 2005
Dhan Kumar wrote: . . . Thanks Campbell. I had never used it like this. It tried just now and it works fine.
You're welcome. But the details are all there in the API documentation. You need to learn your way round that documentation.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com