You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.6KB

  1. /*------------ -------------- -------- --- ----- --- -- - -
  2. * Libre Blackjack - main function
  3. *
  4. * Copyright (C) 2020 jeremy theler
  5. *
  6. * This file is part of Libre Blackjack.
  7. *
  8. * Libre Blackjack is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation, either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * Libre Blackjack is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with Libre Blackjack. If not, see <http://www.gnu.org/licenses/>.
  20. *------------------- ------------ ---- -------- -- - - -
  21. */
  22. #include <iostream>
  23. #include "blackjack.h"
  24. int main(int argc, char **argv) {
  25. // TODO: read args/conf to see what dealer we need to play
  26. // TODO: pass args/conf to the constructor
  27. Blackjack dealer;
  28. std::cout << "Let's play" << std::endl;
  29. dealer.setNextAction(DealerAction::StartNewHand);
  30. while (!dealer.finished()) {
  31. dealer.setInputNeeded(false);
  32. // TODO: clean buffers
  33. dealer.deal();
  34. if (dealer.getInputNeeded()) {
  35. do {
  36. // TODO: check for too many errors meaning dealer and player do not understand each other
  37. dealer.ask();
  38. } while (dealer.process() <= 0);
  39. }
  40. }
  41. // TODO: write report
  42. }