Advertisement
Guest User

Untitled

a guest
Mar 15th, 2012
3,151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 20.97 KB | None | 0 0
  1. import java.io.BufferedReader;
  2. import java.io.IOException;
  3. import java.io.InputStreamReader;
  4.  
  5. public class reversi {
  6. static boolean inv = false;
  7. static int flipcount = 0;
  8. static int flips = 0;
  9. static String pone = "";
  10. static String ptwo = "";
  11. static String twogo = "";
  12. static String onego = "";
  13. static String f = "";
  14. static boolean start = true;
  15. static int turn = 0;
  16. static String one[] = new String[8];
  17. static String two[] = new String[8];
  18. static String three[] = new String[8];
  19. static String four[] = new String[8];
  20. static String five[] = new String[8];
  21. static String six[] = new String[8];
  22. static String seven[] = new String[8];
  23. static String eight[] = new String[8];
  24. static String onet[] = new String[8];
  25. static String twot[] = new String[8];
  26. static String threet[] = new String[8];
  27. static String fourt[] = new String[8];
  28. static String fivet[] = new String[8];
  29. static String sixt[] = new String[8];
  30. static String sevent[] = new String[8];
  31. static String eightt[] = new String[8];
  32. static int check[] = new int[100];
  33. static int xco = 0;
  34. static int yco = 0;
  35. static int turnt;
  36. static int counter = 0;
  37. static int[] direction = new int[8];
  38. static int[] boarder = { 10, -10, 1, -1, +11, -11, -9, +9 };
  39. static String blnk = " ";
  40. static String blnk2 = "____";
  41. static String xtop = "\\__/";
  42. static String xbottom = "/ \\";
  43. static String o = "OOOO";
  44. static int tmp;
  45. static int y;
  46. static int z;
  47. static int h = 0;
  48.  
  49. public static void main(String[] args) {
  50.  
  51. start();
  52. }
  53.  
  54. public static void start() {
  55. boolean c = true;
  56. int total = 0;
  57. int exes = 0;
  58. int ys = 0;
  59. for (int x = 0; x < 100; x++){
  60. if ((check[x] == 1) || (check[x] == 2) || (check[x] == 3)){
  61. total++;
  62. }
  63. if (check[x] == 1){
  64. exes++;
  65. }
  66. if (check[x] == 2){
  67. ys++;
  68. }
  69. }
  70. if (total == 100){
  71. System.out.println("Game finished! "+pone+" has "+exes+" crosses on the board!\n"+ptwo+" has "+ys+" circles on the board!");
  72. if (ys < exes){
  73. f = readLine("Congradulations "+pone+"! You won!\nWould you like to play again? ");
  74. } else if (ys > exes){
  75. f = readLine("Congradulations "+ptwo+"! You won!\nWould you like to play again? ");
  76. } else if (ys == exes){
  77. f = readLine("Congradulations both players drew! You won!\nWould you like to play again? ");
  78. }
  79. do {
  80. if (f.equals("yes") || f.equals("y") || f.equals("YES")){
  81. start = true;
  82. start();
  83. } else if (f.equals("no") || f.equals("n") || f.equals("NO")){
  84. System.out.println("I hope you enjoyed Othello (Reversi) by Greg Cawthorne!");
  85. System.exit(0);
  86. } else {
  87. f = readLine("Sorry I didn't quite get that. Would you like to play again? ");
  88. c = false;
  89. }} while (c == false);} else if ((start == false) && (turn != 0) && (inv == false)){
  90. System.out.print(pone+" has "+exes+" (X) tiles!\n"+ptwo+" has "+ys+" (0) tiles!\n");
  91. }
  92. inv = false;
  93. boolean chin = true;
  94. if (start == true) {
  95. pone = readLine("Welcome to Othello (Reversi) by Greg Cawthorne!\nPlease enter player one's name! ");
  96. while (pone.equals("")) {
  97. pone = readLine("Please enter a name for player 1 :) ");
  98. }
  99. ptwo = readLine("Player 1s name is " + pone
  100. + ".\nPlease enter player two's name! ");
  101. while (ptwo.equals("")) {
  102. ptwo = readLine("Please enter a name for player 2 :) ");
  103. }
  104. f = readLine("Player 2s name is "
  105. + ptwo
  106. + "\nJust press enter to begin or type something and then press enter change player names: ");
  107. if (false == f.equals("")) {
  108. start();
  109. }
  110. }
  111. for (int x = 0; x < 100; x++) {
  112. check[x] = 3;
  113. if (x == 9) {
  114. x = 89;
  115. }
  116. }
  117. for (int x = 0; x < 100; x = x + 10) {
  118. check[x] = 3;
  119. if (x == 90) {
  120. x = 9;
  121. }
  122. }
  123. if (start == true) {
  124. for (int x = 0; x < 8; x++) {
  125. one[x] = blnk;
  126. two[x] = blnk;
  127. three[x] = blnk;
  128. five[x] = blnk;
  129. six[x] = blnk;
  130. seven[x] = blnk;
  131. eight[x] = blnk;
  132. onet[x] = blnk2;
  133. twot[x] = blnk2;
  134. threet[x] = blnk2;
  135. fivet[x] = blnk2;
  136. sixt[x] = blnk2;
  137. sevent[x] = blnk2;
  138. eightt[x] = blnk2;
  139. check[44] = 2;
  140. check[45] = 1;
  141. check[54] = 1;
  142. check[55] = 2;
  143. if (x == 3) {
  144. five[x] = xtop;
  145. fivet[x] = xbottom;
  146. four[x] = o;
  147. fourt[x] = o;
  148. } else if (x == 4) {
  149. five[x] = o;
  150. fivet[x] = o;
  151. four[x] = xtop;
  152. fourt[x] = xbottom;
  153. } else {
  154. five[x] = blnk;
  155. fivet[x] = blnk2;
  156. four[x] = blnk;
  157. fourt[x] = blnk2;
  158. }
  159. }// end for
  160.  
  161. } else if (turn % 2 == 0) {
  162. turnt = 2;
  163. counter = 1;
  164. while (chin == true) {
  165.  
  166. onego = readLine(pone
  167. + ", please enter in the coordinates of where you'd like to place an (X) tile (e.g. x,y) ");
  168. while ((false == onego.equals("1,1"))
  169. && (false == onego.equals("1,2"))
  170. && (false == onego.equals("1,3"))
  171. && (false == onego.equals("1,4"))
  172. && (false == onego.equals("1,5"))
  173. && (false == onego.equals("1,6"))
  174. && (false == onego.equals("1,7"))
  175. && (false == onego.equals("1,8"))
  176. && (false == onego.equals("2,1"))
  177. && (false == onego.equals("2,2"))
  178. && (false == onego.equals("2,3"))
  179. && (false == onego.equals("2,4"))
  180. && (false == onego.equals("2,5"))
  181. && (false == onego.equals("2,6"))
  182. && (false == onego.equals("2,7"))
  183. && (false == onego.equals("2,8"))
  184. && (false == onego.equals("3,1"))
  185. && (false == onego.equals("3,2"))
  186. && (false == onego.equals("3,3"))
  187. && (false == onego.equals("3,4"))
  188. && (false == onego.equals("3,5"))
  189. && (false == onego.equals("3,6"))
  190. && (false == onego.equals("3,7"))
  191. && (false == onego.equals("3,8"))
  192. && (false == onego.equals("4,1"))
  193. && (false == onego.equals("4,2"))
  194. && (false == onego.equals("4,3"))
  195. && (false == onego.equals("4,4"))
  196. && (false == onego.equals("4,5"))
  197. && (false == onego.equals("4,6"))
  198. && (false == onego.equals("4,7"))
  199. && (false == onego.equals("4,8"))
  200. && (false == onego.equals("5,1"))
  201. && (false == onego.equals("5,2"))
  202. && (false == onego.equals("5,3"))
  203. && (false == onego.equals("5,4"))
  204. && (false == onego.equals("5,5"))
  205. && (false == onego.equals("5,6"))
  206. && (false == onego.equals("5,7"))
  207. && (false == onego.equals("5,8"))
  208. && (false == onego.equals("6,1"))
  209. && (false == onego.equals("6,2"))
  210. && (false == onego.equals("6,3"))
  211. && (false == onego.equals("6,4"))
  212. && (false == onego.equals("6,5"))
  213. && (false == onego.equals("6,6"))
  214. && (false == onego.equals("6,7"))
  215. && (false == onego.equals("6,8"))
  216. && (false == onego.equals("7,1"))
  217. && (false == onego.equals("7,2"))
  218. && (false == onego.equals("7,3"))
  219. && (false == onego.equals("7,4"))
  220. && (false == onego.equals("7,5"))
  221. && (false == onego.equals("7,6"))
  222. && (false == onego.equals("7,7"))
  223. && (false == onego.equals("7,8"))
  224. && (false == onego.equals("8,1"))
  225. && (false == onego.equals("8,2"))
  226. && (false == onego.equals("8,3"))
  227. && (false == onego.equals("8,4"))
  228. && (false == onego.equals("8,5"))
  229. && (false == onego.equals("8,6"))
  230. && (false == onego.equals("8,7"))
  231. && (false == onego.equals("8,8"))) {
  232. onego = readLine("Invalid position. "
  233. + pone
  234. + ", please enter in valid coordinates of where you'd like to place an (X) tile (e.g. x,y) ");
  235. }
  236. chin = false;
  237. String x = String.valueOf(onego.charAt(0));
  238. String y = String.valueOf(onego.charAt(2));
  239. xco = Integer.parseInt(x);
  240. yco = Integer.parseInt(y);
  241. tmp = check[xco + yco * 10];
  242. if ((yco == 1) && (check[xco + 10] == 0)) {
  243. one[xco - 1] = xtop;
  244. onet[xco - 1] = xbottom;
  245. check[xco + 10] = 1;
  246. } else if ((yco == 2) && (check[xco + 20] == 0)) {
  247. two[xco - 1] = xtop;
  248. twot[xco - 1] = xbottom;
  249. check[xco + 20] = 1;
  250. } else if ((yco == 3) && (check[xco + 30] == 0)) {
  251. three[xco - 1] = xtop;
  252. threet[xco - 1] = xbottom;
  253. check[xco + 30] = 1;
  254. } else if ((yco == 4) && (check[xco + 40] == 0)) {
  255. four[xco - 1] = xtop;
  256. fourt[xco - 1] = xbottom;
  257. check[xco + 40] = 1;
  258. } else if ((yco == 5) && (check[xco + 50] == 0)) {
  259. five[xco - 1] = xtop;
  260. fivet[xco - 1] = xbottom;
  261. check[xco + 50] = 1;
  262. } else if ((yco == 6) && (check[xco + 60] == 0)) {
  263. six[xco - 1] = xtop;
  264. sixt[xco - 1] = xbottom;
  265. check[xco + 60] = 1;
  266. } else if ((yco == 7) && (check[xco + 70] == 0)) {
  267. seven[xco - 1] = xtop;
  268. sevent[xco - 1] = xbottom;
  269. check[xco + 70] = 1;
  270. } else if ((yco == 8) && (check[xco + 80] == 0)) {
  271. eight[xco - 1] = xtop;
  272. eightt[xco - 1] = xbottom;
  273. check[xco + 80] = 1;
  274. } else {
  275. chin = true;
  276. System.out.print("This coordiante is already filled. ");
  277. }// end else
  278. }
  279. } else {
  280. while (chin == true) {
  281. turnt = 1;
  282. counter = 2;
  283. twogo = readLine(ptwo
  284. + ", please enter in the coordinates of where you'd like to place an (O) tile (e.g. x,y) ");
  285. while ((false == twogo.equals("1,1"))
  286. && (false == twogo.equals("1,2"))
  287. && (false == twogo.equals("1,3"))
  288. && (false == twogo.equals("1,4"))
  289. && (false == twogo.equals("1,5"))
  290. && (false == twogo.equals("1,6"))
  291. && (false == twogo.equals("1,7"))
  292. && (false == twogo.equals("1,8"))
  293. && (false == twogo.equals("2,1"))
  294. && (false == twogo.equals("2,2"))
  295. && (false == twogo.equals("2,3"))
  296. && (false == twogo.equals("2,4"))
  297. && (false == twogo.equals("2,5"))
  298. && (false == twogo.equals("2,6"))
  299. && (false == twogo.equals("2,7"))
  300. && (false == twogo.equals("2,8"))
  301. && (false == twogo.equals("3,1"))
  302. && (false == twogo.equals("3,2"))
  303. && (false == twogo.equals("3,3"))
  304. && (false == twogo.equals("3,4"))
  305. && (false == twogo.equals("3,5"))
  306. && (false == twogo.equals("3,6"))
  307. && (false == twogo.equals("3,7"))
  308. && (false == twogo.equals("3,8"))
  309. && (false == twogo.equals("4,1"))
  310. && (false == twogo.equals("4,2"))
  311. && (false == twogo.equals("4,3"))
  312. && (false == twogo.equals("4,4"))
  313. && (false == twogo.equals("4,5"))
  314. && (false == twogo.equals("4,6"))
  315. && (false == twogo.equals("4,7"))
  316. && (false == twogo.equals("4,8"))
  317. && (false == twogo.equals("5,1"))
  318. && (false == twogo.equals("5,2"))
  319. && (false == twogo.equals("5,3"))
  320. && (false == twogo.equals("5,4"))
  321. && (false == twogo.equals("5,5"))
  322. && (false == twogo.equals("5,6"))
  323. && (false == twogo.equals("5,7"))
  324. && (false == twogo.equals("5,8"))
  325. && (false == twogo.equals("6,1"))
  326. && (false == twogo.equals("6,2"))
  327. && (false == twogo.equals("6,3"))
  328. && (false == twogo.equals("6,4"))
  329. && (false == twogo.equals("6,5"))
  330. && (false == twogo.equals("6,6"))
  331. && (false == twogo.equals("6,7"))
  332. && (false == twogo.equals("6,8"))
  333. && (false == twogo.equals("7,1"))
  334. && (false == twogo.equals("7,2"))
  335. && (false == twogo.equals("7,3"))
  336. && (false == twogo.equals("7,4"))
  337. && (false == twogo.equals("7,5"))
  338. && (false == twogo.equals("7,6"))
  339. && (false == twogo.equals("7,7"))
  340. && (false == twogo.equals("7,8"))
  341. && (false == twogo.equals("8,1"))
  342. && (false == twogo.equals("8,2"))
  343. && (false == twogo.equals("8,3"))
  344. && (false == twogo.equals("8,4"))
  345. && (false == twogo.equals("8,5"))
  346. && (false == twogo.equals("8,6"))
  347. && (false == twogo.equals("8,7"))
  348. && (false == twogo.equals("8,8"))) {
  349. twogo = readLine("Invalid position. "
  350. + ptwo
  351. + ", please enter in valid coordinates of where you'd like to place an (O) tile (e.g. x,y) ");
  352. }
  353. chin = false;
  354. String x = String.valueOf(twogo.charAt(0));
  355. String y = String.valueOf(twogo.charAt(2));
  356. xco = Integer.parseInt(x);
  357. yco = Integer.parseInt(y);
  358. tmp = check[xco + yco * 10];
  359. if ((yco == 1) && (check[xco + 10] == 0)) {
  360. one[xco - 1] = o;
  361. onet[xco - 1] = o;
  362. check[xco + 10] = 2;
  363. } else if ((yco == 2) && (check[xco + 20] == 0)) {
  364. two[xco - 1] = o;
  365. twot[xco - 1] = o;
  366. check[xco + 20] = 2;
  367. } else if ((yco == 3) && (check[xco + 30] == 0)) {
  368. three[xco - 1] = o;
  369. threet[xco - 1] = o;
  370. check[xco + 30] = 2;
  371. } else if ((yco == 4) && (check[xco + 40] == 0)) {
  372. four[xco - 1] = o;
  373. fourt[xco - 1] = o;
  374. check[xco + 40] = 2;
  375. } else if ((yco == 5) && (check[xco + 50] == 0)) {
  376. five[xco - 1] = o;
  377. fivet[xco - 1] = o;
  378. check[xco + 50] = 2;
  379. } else if ((yco == 6) && (check[xco + 60] == 0)) {
  380. six[xco - 1] = o;
  381. sixt[xco - 1] = o;
  382. check[xco + 60] = 2;
  383. } else if ((yco == 7) && (check[xco + 70] == 0)) {
  384. seven[xco - 1] = o;
  385. sevent[xco - 1] = o;
  386. check[xco + 70] = 2;
  387. } else if ((yco == 8) && (check[xco + 80] == 0)) {
  388. eight[xco - 1] = o;
  389. eightt[xco - 1] = o;
  390. check[xco + 80] = 2;
  391. } else {
  392. chin = true;
  393. System.out.print("This coordiante is already filled. ");
  394. }
  395. }
  396. }// end else
  397. if (start == true) {
  398. board(one, two, three, four, five, six, seven, eight, onet, twot,
  399. threet, fourt, fivet, sixt, sevent, eightt);
  400. start = false;
  401. start();
  402. }
  403. check();
  404. board(one, two, three, four, five, six, seven, eight, onet, twot,
  405. threet, fourt, fivet, sixt, sevent, eightt);
  406. }
  407.  
  408. public static void check() {
  409. for (int x = 0; x < 8 ; x++){
  410. direction[x] = 0;
  411. }
  412. int p = 0;
  413. if (check[xco + (yco * 10)] == counter) {
  414.  
  415. for (int x = 0; x < 8; x++) {
  416. if (check[xco + (yco * 10) + boarder[x]] == turnt) {
  417. direction[x] = boarder[x];
  418. }
  419. }
  420. }
  421. for (int x = 0; x < 8; x++) {
  422. if (direction[x] == 0) {
  423. p++;
  424. }
  425. }
  426. if (p == 8) {
  427. invalidturn();
  428. } else {
  429. extra();
  430. }
  431. }
  432.  
  433. public static void invalidturn() {
  434. String pic = null;
  435. String pic2 = null;
  436. System.out.print("That's not a valid turn ");
  437. check[xco + yco * 10] = tmp;
  438. if (tmp == 1){
  439. pic = xtop;
  440. pic2 = xbottom;
  441. } else if (tmp == 2){
  442. pic = o;
  443. pic2 = o;
  444. } else if (tmp == 0){
  445. pic = blnk;
  446. pic2 = blnk2;
  447. }
  448. if ((yco == 1)) {
  449. one[xco - 1] = pic;
  450. onet[xco - 1] = pic2;
  451. } else if ((yco == 2)) {
  452. two[xco - 1] = pic;
  453. twot[xco - 1] = pic2;
  454. } else if ((yco == 3)) {
  455. three[xco - 1] = pic;
  456. threet[xco - 1] = pic2;
  457. } else if ((yco == 4)) {
  458. four[xco - 1] = pic;
  459. fourt[xco - 1] = pic2;
  460. } else if ((yco == 5)) {
  461. five[xco - 1] = pic;
  462. fivet[xco - 1] = pic2;
  463. } else if ((yco == 6)) {
  464. six[xco - 1] = pic;
  465. sixt[xco - 1] = pic2;
  466. } else if ((yco == 7)) {
  467. seven[xco - 1] = pic;
  468. sevent[xco - 1] = pic2;
  469. } else if ((yco == 8)) {
  470. eight[xco - 1] = pic;
  471. eightt[xco - 1] = pic2;
  472. }
  473. inv = true;
  474. start();
  475.  
  476. }
  477.  
  478. public static void extra() {
  479. y = 0;
  480. z = 2;
  481. boolean end = false;
  482. for (h = h + 0; h <= 8; h++) {
  483. if (h == 8) {
  484. if (flipcount == 0){
  485. flipcount = 0;
  486. h = 0;
  487. invalidturn();
  488. }
  489. flipcount = 0;
  490. h = 0;
  491. board(one, two, three, four, five, six, seven, eight, onet, twot,
  492. threet, fourt, fivet, sixt, sevent, eightt);
  493. }
  494. if (direction[h] != 0) {
  495. for (y = 0; y < 8; y++) {
  496. if (direction[h] == boarder[y]) {
  497. if ((check[xco + (yco * 10) + boarder[y]] == turnt)) {
  498. while (end == false) {
  499. if ((check[xco + (yco * 10) + (boarder[y]) * z] == turnt)) {
  500. z++;
  501. } else if ((check[xco + (yco * 10)
  502. + (boarder[y]) * z] == counter)) {
  503. flipcount++;
  504. h++;
  505. end = true;
  506. flip(z);
  507. } else if ((check[xco + (yco * 10)
  508. + (boarder[y]) * z] == 3)
  509. || (check[xco + (yco * 10)
  510. + (boarder[y]) * z] == 0)) {
  511. h++;
  512. extra();
  513. }
  514. }
  515. }
  516. }
  517. }
  518. }
  519. }
  520. }
  521.  
  522. public static void flip(int z) {
  523. String pic = null;
  524. String pic2 = null;
  525. int tmpy = yco;
  526. int tmpx = xco;
  527. if (counter == 2) {
  528. pic = o;
  529. pic2 = o;
  530. } else if (counter == 1) {
  531. pic = xtop;
  532. pic2 = xbottom;
  533. }
  534. for (int x = 0; x < z; x++) {
  535. check[xco + yco * 10 + boarder[y] * x] = counter;
  536.  
  537. if (boarder[y] == 10) {
  538. tmpy = tmpy + 1;
  539. } else if (boarder[y] == -10) {
  540. tmpy = tmpy - 1;
  541. } else if (boarder[y] == 1) {
  542. tmpx = tmpx + 1;
  543. } else if (boarder[y] == -1) {
  544. tmpx = tmpx - 1;
  545. } else if (boarder[y] == 11) {
  546. tmpy = tmpy + 1;
  547. tmpx = tmpx + 1;
  548. } else if (boarder[y] == -11) {
  549. tmpy = tmpy - 1;
  550. tmpx = tmpx - 1;
  551. } else if (boarder[y] == 9) {
  552. tmpy = tmpy + 1;
  553. tmpx = tmpx - 1;
  554. } else if (boarder[y] == -9) {
  555. tmpy = tmpy - 1;
  556. tmpx = tmpx + 1;
  557. }
  558.  
  559. if ((tmpy == 1)) {
  560. one[tmpx - 1] = pic;
  561. onet[tmpx - 1] = pic2;
  562. } else if ((tmpy == 2)) {
  563. two[tmpx - 1] = pic;
  564. twot[tmpx - 1] = pic2;
  565. } else if ((tmpy == 3)) {
  566. three[tmpx - 1] = pic;
  567. threet[tmpx - 1] = pic2;
  568. } else if ((tmpy == 4)) {
  569. four[tmpx - 1] = pic;
  570. fourt[tmpx - 1] = pic2;
  571. } else if ((tmpy == 5)) {
  572. five[tmpx - 1] = pic;
  573. fivet[tmpx - 1] = pic2;
  574. } else if ((tmpy == 6)) {
  575. six[tmpx - 1] = pic;
  576. sixt[tmpx - 1] = pic2;
  577. } else if ((tmpy == 7)) {
  578. seven[tmpx - 1] = pic;
  579. sevent[tmpx - 1] = pic2;
  580. } else if ((tmpy == 8)) {
  581. eight[tmpx - 1] = pic;
  582. eightt[tmpx - 1] = pic2;
  583. }
  584. }
  585. extra();
  586. }
  587.  
  588. public static void board(String[] one, String[] two, String[] three,
  589. String[] four, String[] five, String[] six, String[] seven,
  590. String[] eight, String[] onet, String[] twot, String[] threet,
  591. String[] fourt, String[] fivet, String[] sixt, String[] sevent,
  592. String[] eightt) {
  593. System.out.println("._______________________________________");
  594. System.out.println("|" + eight[0] + "|" + eight[1] + "|" + eight[2]
  595. + "|" + eight[3] + "|" + eight[4] + "|" + eight[5] + "|"
  596. + eight[6] + "|" + eight[7] + "|");
  597. System.out.println("|" + eightt[0] + "|" + eightt[1] + "|" + eightt[2]
  598. + "|" + eightt[3] + "|" + eightt[4] + "|" + eightt[5] + "|"
  599. + eightt[6] + "|" + eightt[7] + "|8");
  600. System.out.println("|" + seven[0] + "|" + seven[1] + "|" + seven[2]
  601. + "|" + seven[3] + "|" + seven[4] + "|" + seven[5] + "|"
  602. + seven[6] + "|" + seven[7] + "|");
  603. System.out.println("|" + sevent[0] + "|" + sevent[1] + "|" + sevent[2]
  604. + "|" + sevent[3] + "|" + sevent[4] + "|" + sevent[5] + "|"
  605. + sevent[6] + "|" + sevent[7] + "|7");
  606. System.out.println("|" + six[0] + "|" + six[1] + "|" + six[2] + "|"
  607. + six[3] + "|" + six[4] + "|" + six[5] + "|" + six[6] + "|"
  608. + six[7] + "|");
  609. System.out.println("|" + sixt[0] + "|" + sixt[1] + "|" + sixt[2] + "|"
  610. + sixt[3] + "|" + sixt[4] + "|" + sixt[5] + "|" + sixt[6] + "|"
  611. + sixt[7] + "|6");
  612. System.out.println("|" + five[0] + "|" + five[1] + "|" + five[2] + "|"
  613. + five[3] + "|" + five[4] + "|" + five[5] + "|" + five[6] + "|"
  614. + five[7] + "|");
  615. System.out.println("|" + fivet[0] + "|" + fivet[1] + "|" + fivet[2]
  616. + "|" + fivet[3] + "|" + fivet[4] + "|" + fivet[5] + "|"
  617. + fivet[6] + "|" + fivet[7] + "|5");
  618. System.out.println("|" + four[0] + "|" + four[1] + "|" + four[2] + "|"
  619. + four[3] + "|" + four[4] + "|" + four[5] + "|" + four[6] + "|"
  620. + four[7] + "|");
  621. System.out.println("|" + fourt[0] + "|" + fourt[1] + "|" + fourt[2]
  622. + "|" + fourt[3] + "|" + fourt[4] + "|" + fourt[5] + "|"
  623. + fourt[6] + "|" + fourt[7] + "|4");
  624. System.out.println("|" + three[0] + "|" + three[1] + "|" + three[2]
  625. + "|" + three[3] + "|" + three[4] + "|" + three[5] + "|"
  626. + three[6] + "|" + three[7] + "|");
  627. System.out.println("|" + threet[0] + "|" + threet[1] + "|" + threet[2]
  628. + "|" + threet[3] + "|" + threet[4] + "|" + threet[5] + "|"
  629. + threet[6] + "|" + threet[7] + "|3");
  630. System.out.println("|" + two[0] + "|" + two[1] + "|" + two[2] + "|"
  631. + two[3] + "|" + two[4] + "|" + two[5] + "|" + two[6] + "|"
  632. + two[7] + "|");
  633. System.out.println("|" + twot[0] + "|" + twot[1] + "|" + twot[2] + "|"
  634. + twot[3] + "|" + twot[4] + "|" + twot[5] + "|" + twot[6] + "|"
  635. + twot[7] + "|2");
  636. System.out.println("|" + one[0] + "|" + one[1] + "|" + one[2] + "|"
  637. + one[3] + "|" + one[4] + "|" + one[5] + "|" + one[6] + "|"
  638. + one[7] + "|");
  639. System.out.println("|" + onet[0] + "|" + onet[1] + "|" + onet[2] + "|"
  640. + onet[3] + "|" + onet[4] + "|" + onet[5] + "|" + onet[6] + "|"
  641. + onet[7] + "|1");
  642. System.out.println(" 1 2 3 4 5 6 7 8");
  643. if (start == false) {
  644. turn++;
  645. start();
  646. }
  647. }
  648.  
  649. public static String readLine(String prompt) {
  650. String input = "";
  651. System.out.print(prompt);
  652. InputStreamReader isr = new InputStreamReader(System.in);
  653. BufferedReader br = new BufferedReader(isr);
  654. try {
  655.  
  656. input = br.readLine();
  657.  
  658. } catch (IOException ioe) {
  659. }
  660. return input;
  661. }
  662. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement