This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

eight Move q that use OO  RSS feed

 
Andres John
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need help with the legal move of 8 q, i need some ideas or brainstorm about moving the q from 2 diagonal (left and right) and we don't care about the bottom part.
this what i got so far :

 
fred rosenberger
lowercase baba
Bartender
Posts: 12542
48
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Andres John wrote:I need help with the legal move of 8 q, i need some ideas or brainstorm about moving the q from 2 diagonal (left and right) and we don't care about the bottom part.
this what i got so far :

What, exactly, do you need help with? compiling this? running this? is it doing something you don't expect? If so, what DOES it do, and what do you EXPECT it to do?

I don't see an actual question anywhere, so nobody has any idea how to help you.
 
Andres John
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
fred rosenberger wrote:
Andres John wrote:I need help with the legal move of 8 q, i need some ideas or brainstorm about moving the q from 2 diagonal (left and right) and we don't care about the bottom part.
this what i got so far :

What, exactly, do you need help with? compiling this? running this? is it doing something you don't expect? If so, what DOES it do, and what do you EXPECT it to do?

I don't see an actual question anywhere, so nobody has any idea how to help you.


i guess i need help with the compile and i was expecting the queen to backtracking, the solution requires that no two queens share the same row, column, or diagonal by checking the first row
 
fred rosenberger
lowercase baba
Bartender
Posts: 12542
48
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
so...if you need help with compiling, tell us what happens when you do the "javac Queen8Moves.java" command?
 
Andres John
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the error
 
fred rosenberger
lowercase baba
Bartender
Posts: 12542
48
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok...so fix that. it tells you exactly what the problem is.

On line 21, you call the legal() method, and pass it two int variables:


However, the only place you define the legal method, you say it takes THREE int variables:


The compiler is telling you that something isn't right. You either need to:
a) change the call on line 21 to pass in three arguments
b) define a new legal() method that takes two int parameters
c) change the existing legal() method to only take two - this would then require you to change any other calls to the legal() method that currently pass in three arguments.

My guess is you would want to do a, but I haven't (and most likely won't) go through your 100 lines of code to try and figure that out.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!