From 34d24825172e89a973e2a3559fb112cb0d4b75e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustav=20S=C3=B6rn=C3=A4s?= Date: Sun, 29 Nov 2020 03:02:24 +0100 Subject: refactor setup_board --- labb5/src/boggleplay.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'labb5') diff --git a/labb5/src/boggleplay.cpp b/labb5/src/boggleplay.cpp index da03d93..60e45c6 100755 --- a/labb5/src/boggleplay.cpp +++ b/labb5/src/boggleplay.cpp @@ -12,11 +12,7 @@ #include -/* - * Plays one game of Boggle using the given boggle game state object. - */ -void playOneGame(Boggle& boggle) { - boggle.clear(); +void setup_board(Boggle& boggle) { bool input_custom_board = yesOrNo("Input custom board? "); if (input_custom_board) { string input_board; @@ -36,6 +32,15 @@ void playOneGame(Boggle& boggle) { } else { boggle.shuffle(); } +} + +/* + * Plays one game of Boggle using the given boggle game state object. + */ +void playOneGame(Boggle& boggle) { + boggle.clear(); + setup_board(boggle); + string user_input; while (true) { std::cout << "It's your turn!" << std::endl; -- cgit v1.2.1