Skip to content

NitishKanna107/BullsCows

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Bulls and Cows

I made this game while reading the book Programming Principles and Practice Using C++ (2nd Edition). I had never heard of Bulls and Cows until I came across the exercise section of this book. It looked like a really fun game to play and hence I decided to publish a version made completely by me.

How to play?

The rules are simple to understand and the program will tell them to you at the start. To start playing the game you must enter a seed (random number) for the randint() function to generate a secret four digit number. The number of guesses are unlimited and in order to win the game you must score 4 Bulls. If you feel its impossible to guess then enter -1 to reveal the secret code.

Setup

  • Clone this repository or download a zip and extract all files.
  • Compile the program using any compiler that you like.
  • Use main.cpp if you want to play the number version
  • Use main_str.cpp if you want to play the word version

Note:- The header file std_lib_facilities.h comes along with the book PPPUC++ and contains utilities that assist novice programmers. The game uses certain functions like error() and keep_window_open() defined in the header file. Its totally fine if you do not want std_lib_facilities.h and are fine with writing your own error() and keep_window_open() functions.

Conclusion

This project was made as a learning endeavor and to appreciate the book PPPUC++ written by Bjarne Stroustrap himself. I would recommend PPPUC++ to any novice programmer wanting to learn C++ along with some tips about developing quality software.

I thank you for investing your time in exploring my project and playing the game. I would really appreciate it if you could give me some constructive feedback on how to better program in C++.

About

A terminal Bulls and Cows game implemented in C++

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages