![]() Do you want graphics in your game? You could make it a console came. Do you want to be able to play the game yourself or make an algorithm to play it?Īlso, are you talking about std::stack? It's not really necessary, a vector (STL) would do just fine. Game won when you achieve a vector with the elements from 1 to n (in successive order), but it must be a vector different than the one which you initialized in the begining. Variable, delete that item from that vector(pop_back() ), then push_back that value into the vector you want to move it to. Then, if you want to move an item from the first vector, to let's say the third vector, you store the top-most value in the vector in a temp. You initialize the first vector with numbers going from 1 to n, where n is the number of disks. Make sure you use std::vector and not the standard array.Or use your stacks, doesn't matter. Also, do you have a set number of disks or based on difficulty, user-input,etc?Īnd how the algorithm would work (for the game logic): You have 3 vectors, 1 for each rod. If you are indeed going for graphics, then I suggest. ![]() (but the code editor is more consistent and less buggy). If you are on a mobile device, or prefer to use BBCode, you can use // Your code here // It will be syntax highlighted, though not necessarily corectly. To add code tags, click the button on the editor toolbar, then enter your code in the code editor that appears. Welcome to the Programming and Software Design Section, When asking for help with programming issues, please use the code tags to enclose your code, it makes things much more easily readable for the people trying to help you, thus improving your chances of actually getting help.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |