I am familiar with loops, functions, recursions, (though I have praticed some questions, it is troubling to get the hang of it completely), passing by value, reference and ofcourse pointers. I can work with arrays and 2d arrays.

This is my second project. My first project was hangman. My sir wasn't impressed if he did approve of what I made. This time, I wish to do better. I am willing to work harder but this project marks means alot. I want to ask you, is blackjack a better option to make my c++ project or checkers? I prefer checkers but I don't want to make the wrong descicion and get stuck because this time the deadline is quite near.

Appreciate your help.

Play in computer human to human or human against computer? I think first one as checker playing logic for computer is not ready in one week (except random play)

Blackjack is definitely more manageable. All you need is a random-number generator (the rand() function) to draw the cards (or a bit more than that if you want to draw cards from a actual deck with a finite number of cards, as opposed to an "infinite" deck of cards) and very simple logic for the dealer.

Checkers would definitely be harder because you need to keep track of all the pieces and display them on a board, but certainly manageable. But creating a computer opponent is out of the question for a week's project.

I can't say if a blackjack game would be enough to "impress" your prof. That really depends on the level of your course, but your initial description suggests that it is a very basic programming class, so it would probably be a reasonable project. A blackjack game is more difficult than a hangman game, but not by a lot.

You also have to keep in mind that the extent to which you can impress your prof often depends more on the quality of the implementation than on the end result. If you throw together a dirty piece of code that does the job it is not likely to impress much because it can look like the result of a trial-and-error methodology (which is really bad) or look like you don't understand how and why you should organize the code properly. For example, if I see a piece of code that does simple linear algebra calculations (matrix-matrix arithmetic, matrix-vector products, gaussian elimination, matrix inversion, etc.) but in a way that is organised in a nice class which handles its resources well, that provides good encapsulation, and a clear interface, then that would be much more impressive to me than a complete blackjack/checkers program that is riddled with global variables and lack of clear functional separations. Although, as an end-result, writing a program that performs a few simple lin-alg calculations is far simpler than a blackjack game. What matters is the lessons you have drawn from previous exercises and showing that you can apply them on your own (i.e., instead of being told, in simple exercise, "write a function that does this and another that does that", that you can ask yourself "to solve this overall problem, what functions will I need, what sub-problems do I have to solve, how do I need to structure my data, etc." and use what you have learned to come up with the right answers). At least, that's my opinion.

Quick story: A few years back, in an introductory Java class, there was a question on the final which asked to implement (in pen-and-paper) a simple school staff / profs / classes / students record-keeping program (I don't remember the exact details of it). I wrote the class interfaces and inheritances and the function declarations only (basically, the skeleton for the program), and didn't write any actual code (implementation). I wrote a note saying something like "I left the implementation details out because they are trivial and don't really matter", I left early from the exam and I got 100% grade for it, while essentially nobody else managed to finish the exam, trying to work out all those implementation details on that last question. So, I'm not the only one who thinks that being able to properly engineer your code is far more important than being able to work out little coding issues.

Conclusion, make sure you can produce a quality implementation that is well thought out in terms of organizing the code, the data, and breaking the problem down into sub-tasks and so on. And, of course, the problem needs to have some level of complexity in order to allow you to show those software engineering skills at work. But, if the problem is too hard, you might get pressured (by time) into "just getting it to work" and produce a very nasty piece of code (casually called "spaghetti code" or "cowboy coding") that won't be very impressive (or even disgusting) even though it solves a harder problem.

You could really show off even the Blackjack with making it with test driven design style showing gradual progression to full functionality (say implementation and testing date and time in comments of the function/method). Add to that good variable names, informative relevant comments,...

Then nail it by adding diary of design showing three days for design (including the class inheritance, function interface and test cases), two days for implementation and two days for documentation and clean up. I would be immensely impressed with one page "User Manual" for using the program, even it would be very simple program. You could finish the documentation with wish to add robustness to program later when you learn about exception handling.

Okay, this is confusing. I though of doing checkers and I made up my mind and I also made up the report. So, If I do choose checkers, can I managed human vs human in a week's time and not take the gamble of computer vs. human?

If I do make computer vs human, is it necessary that the computer winds everytime or the players wins who has the first turn?

Thank you mike_2000_17 for your post. It is indeed very helpful. I absolutely agree that the code should be well organized and that I should know the basics and divide my bigger problems into smaller ones and handle them efficiently.
I am thinking of taking a gamble and doing the checkers project. It might not complete but I hope to do as much as I can and give it justice and go good programing. Definitely no spagetti code. :)
And it is very nice to you that you got a 100% grade. That, is impressive.

pyTony, Thank you for your response.
I am thinking if I do make computer vs. human, and if I make it randomn play on computer's part, is that bad? I need time and ofcourse, that is what is lacking. Or should I not even go for computer vs. human?

Thank you for your time.
This will be exciting if not peaceful.

Also, I am not familiar with these terms:
class inheritance, function interface and test cases.

We haven't been taught that,

pyTony, Thank you for your response.
I am thinking if I do make computer vs. human, and if I make it randomn play on computer's part, is that bad? I need time and ofcourse, that is what is lacking. Or should I not even go for computer vs. human?

You can design the option, but do not code it at beginning. Just make it easy to add the feature if you have time at end. Good checkers playing is more hard than you think, little easier Artificial Intelligence problem than chess though.http://www.nytimes.com/2007/07/19/science/19cnd-checkers.html

I agree with pyTony, you should start by getting the human-human game working. You should structure your code such that you can easily swap one human player for a computer player. For example, if you had a function like this:

enum PlayerID {
  BlackPlayer,
  WhitePlayer
};

PlayerMove GetNextHumanPlayerMove(const CheckerBoard& board, PlayerID id) {
  PrintCheckerBoard(board);
  int init_pos, next_pos;
  std::cout << "Which piece do you want to move?" << std::endl;
  std::cin >> init_pos;
  while(!IsSquareOccupied(board, init_pos, id)) {
    std::cout << "You do not have a piece at that square! Select a new piece..." << std::endl;
    std::cout >> init_pos;
  };
  std::cout << "Where do you which to move this piece to?" << std::endl;
  std::cin >> next_pos;
  while(!IsMoveValid(board, init_pos, next_pos, id)) {
    std::cout << "This move is not valid! Select a new destination..." << std::endl;
    std::cin >> next_pos;
  };
  PlayerMove result;
  result.initial_position = init_pos;
  result.destination_position = next_pos;
  return result;
};

The above function will work for both human players, and you can also see from it the kinds of sub-functions that you might want to do (PrintCheckerBoard, IsSquareOccupied, IsMoveValid, etc.) and the kinds of data structures you might want to create (PlayerMove, CheckerBoard, etc.). Also, if you want to create a computer player, you can easily make an alternate function with the same signature, as so:

PlayerMove GetNextComputerPlayerMove(const CheckerBoard& board, PlayerID id) {
  // insert some code here to analyse the board and find the best next move.
  // return the best next move that was found.
};

This way you can easily swap one function for another, in fact, you can even use a feature called "function pointers" to make it even easier.

Creating a computer player could be quite a challenge. As far as I know, there is no simple rule (like a math formula) to calculate the "optimal" move. So, it requires the use of artificial intelligence techniques (more specifically, "machine learning"). I would first try to implement a random player (generate moves at random until you have a valid move). Afterwards, you might want to use a brute-force "greedy" strategy which means that you check all valid moves and see which one is the most advantagous (in the short term), and if there is a tie, you select one of them at random (this strategy would at least select good moves when there is one). In reality, the "optimal" move should take into account all the possible moves by the opponent as well, and over the entire predicted future of the game, but that becomes a very hard problem (NP-hard) and it cannot be solved like that (brute-force, checking all the possibilities), and that's where these "machine learning" techniques come into play. For your project, don't even think about implementing such advanced methods, but you might be able to implement the brute-force "greedy" strategy that I mentioned, and it would probably be a reasonably challenging computer opponent. The random computer player isn't the absolute worst, because the absolute worst would be a computer player that always selects the worst move, so, a random player is usually considered to be worse than any computer player that are actually designed to win.

Also, I am not familiar with these terms:
class inheritance, function interface and test cases.
We haven't been taught that,

Don't worry about that. You'll learn these things later.

Aside from all of the above, I'll add this. For checkers, you'd have to write a graphical user interface. You could write one without, I suppose, but I don't think it would look very good. All of the original checkers games were console, but we've gotten spoiled. For blackjack, a GUI would be nice, but certainly not required. I'll concur with the others as far as the complexity of artificial intelligence in a checkers game too. I'll vote blackjack hands-down, particularly with the one week deadline and a beginners' course.

Personally I'm a Tic-Tac-Toe kind of guy. You can get some intelligent play in there, offer human or computer options, and show off your algorithm skills on something more managable than checkers. I had a friend who did Othello and you could play the computer. Don't know much about Othello, but the algorithm was easier than Checkers. Still too much for one week though! Go with Blackjack.

The time span I have is two weeks. Yes, but it is not the only project I have been assigned. So more or less I have a week to complete this.

I had a friend who did Othello

This sounds like a good idea. I would like to pursue it. But I am not sure right now. Because i had made up my mind about checkers and I went to my professor and he said that somebody already did a checkers project for the first project. But I can still do it if I want to unless I do computer vs human. Now that is not cool. he said somebody else made that game too and quite good. Computer was nearly unbeatable. He says human vs. human is very easy. I only have to define the rules.

I would go with blackjack but I like blackjack and haven't played it ever before while checkers, I know the game and I have played it all my life.

One last question:
How bad is the chess idea?

Thank you everyone for your input. Probably, I shall get one idea approved today and start working.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.