checkers

  • (5 Pages)
  • +
  • 1
  • 2
  • 3
  • 4
  • Last »

63 Replies - 4260 Views - Last Post: 05 May 2018 - 07:40 PM Rate Topic: -----

#16 baavgai   User is online

  • Dreaming Coder
  • member icon


Reputation: 7470
  • View blog
  • Posts: 15,492
  • Joined: 16-October 07

Re: checkers

Posted 22 March 2018 - 03:21 PM

Try moving char board[8][8]; into the class checkers. Then, rather than having an init_board, you'd simply do that in the constructor.

Again, see if you can limit the scope of variables.

A class maintains state. That is, it holds mutable values and offers methods that control how those values change. And methods that report on those values.

Think about your checkers class as holding the current state of the game and offering methods to change that state. Your user io needn't be part of that class, but rather informs the program how to call the instance.
Was This Post Helpful? 0
  • +
  • -

#17 pbivens85   User is offline

  • D.I.C Addict

Reputation: -13
  • View blog
  • Posts: 507
  • Joined: 22-October 13

Re: checkers

Posted 22 March 2018 - 03:24 PM

overall did you think that I have made some good progress?
Was This Post Helpful? 0
  • +
  • -

#18 pbivens85   User is offline

  • D.I.C Addict

Reputation: -13
  • View blog
  • Posts: 507
  • Joined: 22-October 13

Re: checkers

Posted 22 March 2018 - 05:16 PM

what do you think my board should look like?
Was This Post Helpful? 0
  • +
  • -

#19 baavgai   User is online

  • Dreaming Coder
  • member icon


Reputation: 7470
  • View blog
  • Posts: 15,492
  • Joined: 16-October 07

Re: checkers

Posted 23 March 2018 - 07:10 AM

View Postpbivens85, on 22 March 2018 - 05:24 PM, said:

overall did you think that I have made some good progress?


Alas, all I see are your initial functions in a class wrapper. You don't yet seem to understand the point of the class thing.

View Postpbivens85, on 22 March 2018 - 07:16 PM, said:

what do you think my board should look like?


That would be entirely up to you.

I came up with this, which I rather like:
     a   b   c   d   e   f   g   h
   +---+---+---+---+---+---+---+---+
 8 | B |   | B |   | B |   | B |   |
   +---+---+---+---+---+---+---+---+
 7 |   | B |   | B |   | B |   | B |
   +---+---+---+---+---+---+---+---+
 6 | B |   | B |   | B |   | B |   |
   +---+---+---+---+---+---+---+---+
 5 |   | . |   | . |   | . |   | . |
   +---+---+---+---+---+---+---+---+
 4 | . |   | . |   | . |   | . |   |
   +---+---+---+---+---+---+---+---+
 3 |   | W |   | W |   | W |   | W |
   +---+---+---+---+---+---+---+---+
 2 | W |   | W |   | W |   | W |   |
   +---+---+---+---+---+---+---+---+
 1 |   | W |   | W |   | W |   | W |
   +---+---+---+---+---+---+---+---+



As an aside, I found writing a function bool liveSquare(int row, int col); made it easier to both determine where those dots are and fill the initial board. You should be filling your board with loops.
Was This Post Helpful? 0
  • +
  • -

#20 pbivens85   User is offline

  • D.I.C Addict

Reputation: -13
  • View blog
  • Posts: 507
  • Joined: 22-October 13

Re: checkers

Posted 23 March 2018 - 01:38 PM

well then how does one use classes properly?
Was This Post Helpful? 0
  • +
  • -

#21 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 15225
  • View blog
  • Posts: 60,941
  • Joined: 12-June 08

Re: checkers

Posted 23 March 2018 - 01:44 PM

There are tutorials on the topic as well as the majority of books dedicate a few chapters to it.

Example:
http://www.dreaminco...es-work-part-i/
http://www.dreaminco...s-work-part-ii/
Was This Post Helpful? 1
  • +
  • -

#22 ndc85430   User is online

  • I think you'll find it's "Dr"
  • member icon

Reputation: 979
  • View blog
  • Posts: 3,858
  • Joined: 13-June 14

Re: checkers

Posted 25 March 2018 - 02:56 AM

The whole point of OO is to structure your application in terms of "things" (other words may be "concepts", or "components" or "domain objects") that interact to produce the behaviour of your system. For example, in some kind of shopping system, the things you might have are items and orders. You might do things like adding items to an order, or ask the total cost of an order:

class Item {
    int price;
    int description;
    int id;
    ...
}

class Order {
    void addItem(Item item);
    int totalCost();
    ...
}


So, the thing to think about is what are the concepts in your application and how do they interact?

This post has been edited by ndc85430: 25 March 2018 - 02:57 AM

Was This Post Helpful? 0
  • +
  • -

#23 pbivens85   User is offline

  • D.I.C Addict

Reputation: -13
  • View blog
  • Posts: 507
  • Joined: 22-October 13

Re: checkers

Posted 25 March 2018 - 07:41 PM

I forgot how to post a screen shot.
Was This Post Helpful? 0
  • +
  • -

#24 pbivens85   User is offline

  • D.I.C Addict

Reputation: -13
  • View blog
  • Posts: 507
  • Joined: 22-October 13

Re: checkers

Posted 26 March 2018 - 04:20 PM

how do I post a screenshot?
Was This Post Helpful? 0
  • +
  • -

#25 macosxnerd101   User is offline

  • Games, Graphs, and Auctions
  • member icon




Reputation: 12641
  • View blog
  • Posts: 45,813
  • Joined: 27-December 08

Re: checkers

Posted 26 March 2018 - 07:36 PM

I'm fairly certain uploads are turned off, for the moment. You can post to a third party site and use the BBCode [img] tag to include images.
Was This Post Helpful? 0
  • +
  • -

#26 pbivens85   User is offline

  • D.I.C Addict

Reputation: -13
  • View blog
  • Posts: 507
  • Joined: 22-October 13

Re: checkers

Posted 27 March 2018 - 02:14 PM

what is a good third party site to use?
Was This Post Helpful? 0
  • +
  • -

#27 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 15225
  • View blog
  • Posts: 60,941
  • Joined: 12-June 08

Re: checkers

Posted 27 March 2018 - 02:15 PM

imgur.com
Was This Post Helpful? 0
  • +
  • -

#28 pbivens85   User is offline

  • D.I.C Addict

Reputation: -13
  • View blog
  • Posts: 507
  • Joined: 22-October 13

Re: checkers

Posted 27 March 2018 - 02:28 PM

how do I post a screen shot?
Was This Post Helpful? 0
  • +
  • -

#29 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 15225
  • View blog
  • Posts: 60,941
  • Joined: 12-June 08

Re: checkers

Posted 27 March 2018 - 02:31 PM

When you upload an image to imgur you are given an array of options to share from. Typically any that have an "[img ]" tag would be best. Barring that right click on the image, get the image location, and copy/paste that into the image tag button here.
Was This Post Helpful? 0
  • +
  • -

#30 pbivens85   User is offline

  • D.I.C Addict

Reputation: -13
  • View blog
  • Posts: 507
  • Joined: 22-October 13

Re: checkers

Posted 27 March 2018 - 02:37 PM

I am getting the following error. You are not allowed to use that image extension on this board
Was This Post Helpful? 0
  • +
  • -

  • (5 Pages)
  • +
  • 1
  • 2
  • 3
  • 4
  • Last »