It's perfectly valid, however, with no indentation or braces at first glance it looks a bit like an infinite while loop. It's generally considered good practice to brace your statements. If it's OK in your development environment, then usually you'd just copy and paste the whole of your code into the question, select it and click the code icon. Consistent bracing/indentation makes code a lot easier to read. Your formatting is quite erratic, if it looks like that in your IDE, I'd want to fix it. You're also using i,j in your code, again, I'd tend to use x,y and have them apply in the expected way. This is likely to be a bit confusing to the user the first time they play. You're asking for i,j coordinates, for vertical, then horizontal. When I'm looking at coordinates, I'm thinking (x,y) for horizontal, then vertical. <<endl<<"Enter 'f' ,then enter value of i and j to place "Ĭonsider labelling your axis, or complying with a known standard. <<endl<<"Enter 'o', then enter value of i and j to open cell." While(!end_game_lose&!end_game_win_check())Ĭout<<endl<<"Flags:"<<flag_counter<<endl Ĭout<<"Time:"<<game_time-time_since_epoch<<endl Ĭout<<"Time to complete:"<<game_time-time_since_epoch<<endl If(flag_counter=10&mines_flagged_counter=10) Void print_table(char) // prints the game tableĬhar table //the game table visible ot the playerĬhar table_mine_positions //table with the positions of the mines and the number of each cellĬhar symbol //the input symbol, it can be 'o' or f'Ĭase 'f' : place_or_remove_flag() break Void create_table() //creates the game table Void cell_number() //increases the number of a cell with 1 Void reveal(int, int) /// reveals a cell with given coordinates The player enters 'o', then enters value of i and j to open cell.Įnter 'f' ,then enter value of i and j to place a flag on cell */ I am not really good in OOP yet, so I want ideas about how I can refactor the code by adding objects (or structs) without it getting too bulky. I would like general ideas on improvement for this implementation of Minesweeper I wrote in C++.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |