• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Help with alternating colors correctly on chess board

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I've been having difficulty alternating colors properly for the chess board I'm constructing. Although I think I'm close, as the output shows, I'm not sure whether it's a structural problem. I am new to game dev.
 
lowercase baba
Posts: 13089
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I am not a game coder...but this looks a little redundant. Is there any way both of these can be different? don't both or neither have to be true?

in any case...tell me, in ENGLISH, how you determine the color of a square. It seems like you are writing code without necessarily knowing what you are trying to do...a common mistake that many people make.

You generally want to spend 90% of your time thinking about how to write your code, and 10% actually writing it. That means you need to do a lot of writing, erasing, revising, editing, and changing your code. If you can't tell me what you are trying to do, in English, you shouldn't be writing code yet.
 
Ranch Hand
Posts: 287
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is probably too late but I think you just need:or even:I'll point out that chess is quite a difficult to program. Even working out which moves are legal is quite difficult. If it's your 1st game program then I'd suggest doing naughts and crosses first, then othello or connect 4 before approaching something as difficult as chess.

Mike

PS remember to put a white square in the bottom right of the board.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic