* Chooses events and adds them to the board. If you are going to add per-method comments, might as well teach yourself javadoc while you're at it: /** Prefer public or private, as appropriate.ĭelegate from one constructor to another, where you can. Private String board = new String, etc.ĭon't use default scoping unless you really mean to. Initialize variables inline where you can, to reduce boilerplate: ("Player %d wins!\n\n",boards.getPlayer()) Private final int DEFAULT_PLAYER_COUNT = 2 įor(int i = 1 i events = (ArrayList) eventList.clone() īingoBoard board = new BingoBoard(events,i) Chooses events and adds them to the board. Public void updateEvents(ArrayList eventList) Private final String FREE = "FREE SPACE" īoard = new String īingoBoard(ArrayList eventList, int numb) Private final int MAX_SIZE = BOARD_DIM * BOARD_DIM Is there anything that I should do differently or improve on? Besides the oop principals, I tried to make the code very readable and reusable in case there was ever a 7x7 or a 3x3 version of bingo, and I also tried to eliminate magic numbers. I feel like I have accomplished this, but I would like to learn as much as possible from this exercise. I've recently wrote a simple bingo game in Java to refresh myself in oop principals I have not touched in quite a while.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |