Board game like Abalone for AmigaOS
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.

Board_testmain.cpp 2.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /*
  2. * This file is part of Abacus.
  3. * Copyright (C) 1997 Kai Nickel
  4. *
  5. * Abacus is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation, either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * Abacus is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with Abacus. If not, see <http://www.gnu.org/licenses/>.
  17. *
  18. */
  19. /*******************************************************************************
  20. Board_main.cpp
  21. --------------------------------------------------------------------------------
  22. --------------------------------------------------------------------------------
  23. Last Change: 27.09.1996
  24. *******************************************************************************/
  25. #include <iostream.h>
  26. #include <string.h>
  27. /*******************************************************************************
  28. BOOL
  29. *******************************************************************************/
  30. #ifndef TRUE
  31. typedef int BOOL;
  32. const TRUE = 1;
  33. const FALSE = 0;
  34. #endif
  35. #include "Board.cpp"
  36. /*******************************************************************************
  37. main
  38. *******************************************************************************/
  39. int main()
  40. {
  41. Board b;
  42. b.Clear();
  43. BOOL running = TRUE;
  44. char player = b.white;
  45. while (running)
  46. {
  47. b.Show();
  48. cout << "\n\n 00 01 02 03 04 \n"
  49. << " 05 06 07 08 09 10 \n"
  50. << " 11 12 13 14 15 16 17 0 1 \n"
  51. << " 18 19 20 21 22 23 24 25 5 X 2 \n"
  52. << " 26 27 28 29 30 31 32 33 34 4 3 \n"
  53. << " 35 36 37 38 39 40 41 42 \n"
  54. << " 43 44 45 46 47 48 49 \n"
  55. << " 50 51 52 53 54 55 \n"
  56. << " 56 57 58 59 60 \n\n"
  57. << "Player " << player << " : ball#";
  58. int ball1, ball2, ball3, dir;
  59. cin >> ball1;
  60. cout << " direction#";
  61. cin >> dir;
  62. cout << " 2nd ball#";
  63. cin >> ball2;
  64. if (ball2 != -1)
  65. {
  66. cout << " 3rd ball#";
  67. cin >> ball3;
  68. }
  69. cout << "\n";
  70. int res = b.Test(ball1, dir, ball2, ball3);
  71. if (res >= 0)
  72. {
  73. b.Move(ball1, dir, ball2, ball3);
  74. cout << "Kugeldifferenz: " << res;
  75. if (player == b.white) player = b.black; else player = b.white;
  76. }
  77. else
  78. {
  79. cout << "Fehlercode: " << res;
  80. }
  81. cout << "\n\n";
  82. };
  83. return 0;
  84. };