Advertisement
AlexElg

Othello (PRE CHANGES)

Jan 27th, 2020
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 50.42 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10.  
  11. namespace Othello
  12. {
  13.  
  14. /*
  15. *
  16. * Othello
  17. * Alex Elguezabal
  18. * 1/13/2019
  19. *
  20. */
  21.  
  22. public partial class Othello : Form
  23. {
  24. //Boolean for if a game is active
  25. private bool playing;
  26. //True if it is blacks turn, false if not
  27. private bool black_turn;
  28.  
  29. //Amount of pieces that black or white has left
  30. private int black_pieces_left;
  31. private int white_pieces_left;
  32.  
  33. //2D array for the 8x8 board.
  34. private int[,] board;
  35.  
  36.  
  37. /*
  38. *
  39. * Empty spaces on the board are set to -1
  40. * Black spaces are set to 0
  41. * White spaces are set to 1
  42. *
  43. */
  44.  
  45.  
  46. public Othello()
  47. {
  48. InitializeComponent();
  49. newGame();
  50. scoreBoxBlack.Image = Properties.Resources.black;
  51. scoreBoxWhite.Image = Properties.Resources.white;
  52. }
  53.  
  54. private void newGame()
  55. {
  56. if(playing)
  57. {
  58. clearBoard();
  59. }
  60.  
  61. this.playing = true;
  62. this.black_pieces_left = 30;
  63. this.white_pieces_left = 30;
  64.  
  65. //Made the board extra big to prevent out of bounds errors
  66. this.board = new int[8, 8];
  67.  
  68. //Sets each space to an empty space.
  69. for (int i = 0; i < 8; i++)
  70. {
  71. for (int q = 0; q < 8; q++)
  72. {
  73. this.board[i, q] = -1;
  74. }
  75. }
  76.  
  77. //Sets the four spaces in the middle
  78. setSpace(3, 3, 0, box28);
  79. setSpace(3, 4, 1, box29);
  80. setSpace(4, 3, 0, box36);
  81. setSpace(4, 4, 1, box37);
  82.  
  83. //Sets the starting score
  84. scoreBlack.Text = "" + 2;
  85. scoreWhite.Text = "" + 2;
  86.  
  87. //Sets the game to blacks turn
  88. this.black_turn = true;
  89. //Sets the winnerLabel to hidden
  90. winnerLabel.Visible = false;
  91. }
  92.  
  93.  
  94. /*
  95. * SetSpace Method
  96. *
  97. * @title: SetSpace
  98. * @description: Used to set the spaces on the board when clicked on by the user.
  99. * @param: row: row of the space
  100. * @param: colum: column of the space
  101. * @param: color of the space to change the color.
  102. *
  103. */
  104.  
  105. private bool setSpace(int row, int colum, int color, PictureBox pictureBox)
  106. {
  107. bool is_black = false;
  108. if (color == 0)
  109. is_black = true;
  110.  
  111. if(!placementNextTo(row,colum,is_black))
  112. {
  113. return false;
  114. }
  115.  
  116. pictureBox = getBoxFromRowAndColum(row, colum);
  117. if (color == 0) //Black
  118. {
  119. this.board[row, colum] = 0;
  120. pictureBox.SizeMode = PictureBoxSizeMode.StretchImage;
  121. pictureBox.Image = Properties.Resources.black;
  122.  
  123. }
  124. else //White
  125. {
  126. this.board[row, colum] = 1;
  127. pictureBox.SizeMode = PictureBoxSizeMode.StretchImage;
  128. pictureBox.Image = Properties.Resources.white;
  129.  
  130. }
  131. return true;
  132. }
  133.  
  134.  
  135. private bool placementNextTo(int row, int colum, bool is_black)
  136. {
  137. int opposite = is_black ? 0 : 1;
  138.  
  139. try
  140. {
  141. if (this.board[row - 1, colum - 1] == opposite)
  142. return true;
  143. } catch(IndexOutOfRangeException e)
  144. {
  145.  
  146. }
  147.  
  148. try
  149. {
  150. if (this.board[row - 1, colum] == opposite)
  151. return true;
  152. }
  153. catch (IndexOutOfRangeException e)
  154. {
  155.  
  156. }
  157.  
  158. try
  159. {
  160. if (this.board[row - 1, colum + 1] == opposite)
  161. return true;
  162. }
  163. catch (IndexOutOfRangeException e)
  164. {
  165.  
  166. }
  167. try
  168. {
  169. if (this.board[row + 1, colum - 1] == opposite)
  170. return true;
  171. }
  172. catch (IndexOutOfRangeException e)
  173. {
  174.  
  175. }
  176.  
  177. try
  178. {
  179. if (this.board[row + 1, colum + 1] == opposite)
  180. return true;
  181. }
  182. catch (IndexOutOfRangeException e)
  183. {
  184.  
  185. }
  186. try
  187. {
  188. if (this.board[row, colum - 1] == opposite)
  189. return true;
  190. }
  191. catch (IndexOutOfRangeException e)
  192. {
  193.  
  194. }
  195. try
  196. {
  197. if (this.board[row, colum + 1] == opposite)
  198. return true;
  199. }
  200. catch (IndexOutOfRangeException e)
  201. {
  202.  
  203. }
  204. try
  205. {
  206. if (this.board[row - 1, colum + 1] == opposite)
  207. return true;
  208. }
  209. catch (IndexOutOfRangeException e)
  210. {
  211.  
  212. }
  213.  
  214. return false;
  215. }
  216.  
  217. //Gets the amount of Black controlled spaces on the board.
  218. private int getBlacks()
  219. {
  220. int count = 0;
  221.  
  222. for (int i = 0; i < 8; i++)
  223. {
  224. for (int q = 0; q < 8; q++)
  225. {
  226. if (this.board[i, q] == 0)
  227. count++;
  228. }
  229. }
  230.  
  231. return count;
  232. }
  233.  
  234. //Gets the amount of White controlled spaces on the board.
  235. private int getWhites()
  236. {
  237. int count = 0;
  238.  
  239. for (int i = 0; i < 8; i++)
  240. {
  241. for (int q = 0; q < 8; q++)
  242. {
  243. if (this.board[i, q] == 1)
  244. count++;
  245. }
  246. }
  247.  
  248. return count;
  249. }
  250.  
  251. /*
  252. * CheckForOverTurns Method
  253. *
  254. * @title: CheckForOverTurns
  255. * @description: On each move the method is called and it checks to see if any spaces can be overturned.
  256. * @param: row: row of the space.
  257. * @param: colum: column of the space.
  258. *
  259. */
  260.  
  261. private void checkForOverTurns(int row, int colum)
  262. {
  263. //Color of the space
  264. int color = this.board[row,colum];
  265. //If the space is empty it returns
  266. if (color == -1)
  267. return;
  268.  
  269. //Goes from the space, left and checks the rows, if one has the space at the end it flips.
  270. int s1 = row - 1;
  271. int ss1 = -1;
  272. for (int i = s1; i > -1; i--)
  273. {
  274. if(this.board[i,colum] == -1)
  275. {
  276. break;
  277. } else if(this.board[i, colum] == color)
  278. {
  279. ss1 = i;
  280. for(int q = s1; q > ss1; q--)
  281. {
  282. setSpace(q, colum, color, null);
  283. }
  284. }
  285. }
  286.  
  287. //Goes from the space, right and checks the rows, if one has the space at the end it flips.
  288. int s2 = row + 1;
  289. int ss2 = -1;
  290. for (int i = s2; i < 8; i++)
  291. {
  292. if (this.board[i, colum] == -1)
  293. {
  294. break;
  295. }
  296. else if (this.board[i, colum] == color)
  297. {
  298. ss2 = i;
  299. for (int q = s2; q < ss2; q++)
  300. {
  301. setSpace(q, colum, color, null);
  302. }
  303. }
  304. }
  305.  
  306. //Goes from the space, down and checks the columns, if one has the space at the end it flips.
  307. int s3 = colum - 1;
  308. int ss3 = -1;
  309. for (int i = s3; i > -1; i--)
  310. {
  311. if (this.board[row, i] == -1)
  312. {
  313. break;
  314. }
  315. else if (this.board[row, i] == color)
  316. {
  317. ss3 = i;
  318. for (int q = s3; q > ss3; q--)
  319. {
  320. setSpace(row, q, color, null);
  321. }
  322. }
  323. }
  324.  
  325. //Goes from the space, up and checks the columns, if one has the space at the end it flips.
  326. int s4 = colum + 1;
  327. int ss4 = -1;
  328. for (int i = s4; i < 8; i++)
  329. {
  330. if (this.board[row, i] == -1)
  331. {
  332. break;
  333. }
  334. else if (this.board[row, i] == color)
  335. {
  336. ss4 = i;
  337. for (int q = s4; q < ss4; q++)
  338. {
  339. setSpace(row, q, color, null);
  340. }
  341. }
  342. }
  343.  
  344. }
  345.  
  346.  
  347. //Switches the turn
  348. private void switchTurn()
  349. {
  350. //Changes the turn and sets the pieces to -1;
  351. if (black_turn)
  352. {
  353. white_pieces_left--;
  354. black_turn = false;
  355. }
  356. else
  357. {
  358. black_pieces_left--;
  359. black_turn = true;
  360. }
  361.  
  362. //Updates the score card
  363. scoreBlack.Text = "" + getBlacks();
  364. scoreWhite.Text = "" + getWhites();
  365.  
  366. //If the board is filled it runs the endGame() method
  367. if (white_pieces_left == 0 && black_pieces_left == 0 || boardFilled())
  368. {
  369. int winner = -2;
  370. if(getBlacks() < getWhites())
  371. {
  372. winner = 1;
  373. } else if(getBlacks() > getWhites())
  374. {
  375. winner = 0;
  376. } else
  377. {
  378. winner = -1;
  379. }
  380. endGame(winner);
  381. }
  382. }
  383.  
  384. //Returns true if the board is filled.
  385. private bool boardFilled()
  386. {
  387. for(int i = 0; i < 8; i++)
  388. {
  389. for(int q = 0; q < 8; q++)
  390. {
  391. if (this.board[i,q] == -1)
  392. return false;
  393. }
  394. }
  395. return true;
  396. }
  397.  
  398. //Clears the board
  399. private void clearBoard()
  400. {
  401. for(int i = 0; i < 8; i++)
  402. {
  403. for(int q = 0; q < 8; q++)
  404. {
  405. this.board[i, q] = -1;
  406. PictureBox box = getBoxFromRowAndColum(i, q);
  407. box.Image = null;
  408. }
  409. }
  410. }
  411.  
  412. //Needs to be finished
  413. private void endGame(int winner /* 0 == black 1 == white -1 == tie */)
  414. {
  415. switch(winner)
  416. {
  417. case 1:
  418. {
  419. winnerLabel.BackColor = Color.Black;
  420. winnerLabel.ForeColor = Color.White;
  421. winnerLabel.Text = "Winner: White!";
  422. } break;
  423. case 0:
  424. {
  425. winnerLabel.BackColor = Color.White;
  426. winnerLabel.ForeColor = Color.Black;
  427. winnerLabel.Text = "Winner: Black!";
  428. } break;
  429. case -1:
  430. {
  431. winnerLabel.BackColor = Color.Yellow;
  432. winnerLabel.ForeColor = Color.Blue;
  433. winnerLabel.Text = "Winner: Tie!";
  434. } break;
  435. }
  436. winnerLabel.Visible = true;
  437. }
  438.  
  439.  
  440.  
  441.  
  442.  
  443.  
  444.  
  445.  
  446.  
  447.  
  448.  
  449.  
  450.  
  451.  
  452.  
  453.  
  454.  
  455.  
  456.  
  457.  
  458.  
  459. /*
  460. * Listeners
  461. */
  462.  
  463. private void GetPiecesLeft_Click(object sender, EventArgs e)
  464. {
  465. MessageBox.Show("" + black_pieces_left + " " + white_pieces_left);
  466. }
  467.  
  468. private void Othello_FormClosed(object sender, FormClosedEventArgs e)
  469. {
  470. //exit application when form is closed
  471. Application.Exit();
  472. }
  473.  
  474. private void NewGameButton_Click(object sender, EventArgs e)
  475. {
  476. clearBoard();
  477. newGame();
  478. }
  479.  
  480. /*
  481. * 1st Row Listeners
  482. */
  483.  
  484. private void Box1_Click(object sender, EventArgs e)
  485. {
  486. //if() //Check to see if space is == -1, if is continue
  487.  
  488. if (this.board[0, 0] != -1)
  489. return;
  490.  
  491. bool evt_cancled = false;
  492.  
  493. if (black_turn)
  494. {
  495. evt_cancled = setSpace(0, 0, 0, box1);
  496. }
  497. else
  498. {
  499. evt_cancled = setSpace(0, 0, 1, box1);
  500. }
  501.  
  502. if (!evt_cancled)
  503. return;
  504.  
  505. checkForOverTurns(0,0);
  506. switchTurn();
  507. }
  508.  
  509. private void Box2_Click(object sender, EventArgs e)
  510. {
  511. if (this.board[1, 0] != -1)
  512. return;
  513.  
  514. bool evt_cancled = false;
  515.  
  516. if (black_turn)
  517. {
  518. evt_cancled = setSpace(1, 0, 0, box1);
  519. }
  520. else
  521. {
  522. evt_cancled = setSpace(1, 0, 1, box1);
  523. }
  524.  
  525. if (!evt_cancled)
  526. return;
  527.  
  528. checkForOverTurns(1,0);
  529. switchTurn();
  530. }
  531.  
  532. private void Box3_Click(object sender, EventArgs e)
  533. {
  534. if (this.board[2, 0] != -1)
  535. return;
  536.  
  537. bool evt_cancled = false;
  538.  
  539. if (black_turn)
  540. {
  541. evt_cancled = setSpace(2, 0, 0, box1);
  542. }
  543. else
  544. {
  545. evt_cancled = setSpace(2, 0, 1, box1);
  546. }
  547.  
  548. if (!evt_cancled)
  549. return;
  550.  
  551. checkForOverTurns(2,0);
  552. switchTurn();
  553. }
  554.  
  555. private void Box4_Click(object sender, EventArgs e)
  556. {
  557. if (this.board[3, 0] != -1)
  558. return;
  559.  
  560. if (black_turn)
  561. {
  562. setSpace(3, 0, 0, box1);
  563. }
  564. else
  565. {
  566. setSpace(3, 0, 1, box1);
  567. }
  568.  
  569. checkForOverTurns(3,0);
  570. switchTurn();
  571. }
  572.  
  573. private void Box5_Click(object sender, EventArgs e)
  574. {
  575. if (this.board[4, 0] != -1)
  576. return;
  577.  
  578. if (black_turn)
  579. {
  580. setSpace(4, 0, 0, box1);
  581. }
  582. else
  583. {
  584. setSpace(4, 0, 1, box1);
  585. }
  586.  
  587. checkForOverTurns(4,0);
  588. switchTurn();
  589. }
  590.  
  591. private void Box6_Click(object sender, EventArgs e)
  592. {
  593. if (this.board[5, 0] != -1)
  594. return;
  595.  
  596. if (black_turn)
  597. {
  598. setSpace(5, 0, 0, box1);
  599. }
  600. else
  601. {
  602. setSpace(5, 0, 1, box1);
  603. }
  604.  
  605. checkForOverTurns(5,0);
  606. switchTurn();
  607. }
  608.  
  609. private void Box7_Click(object sender, EventArgs e)
  610. {
  611. if (this.board[6, 0] != -1)
  612. return;
  613.  
  614. if (black_turn)
  615. {
  616. setSpace(6, 0, 0, box1);
  617. }
  618. else
  619. {
  620. setSpace(6, 0, 1, box1);
  621. }
  622.  
  623. checkForOverTurns(6,0);
  624. switchTurn();
  625. }
  626.  
  627. private void Box8_Click(object sender, EventArgs e)
  628. {
  629. if (this.board[7, 0] != -1)
  630. return;
  631.  
  632. if (black_turn)
  633. {
  634. setSpace(7, 0, 0, box1);
  635. }
  636. else
  637. {
  638. setSpace(7, 0, 1, box1);
  639. }
  640.  
  641. checkForOverTurns(7,0);
  642. switchTurn();
  643. }
  644.  
  645. /*
  646. * 2nd Row Listeners
  647. */
  648.  
  649. private void Box9_Click(object sender, EventArgs e)
  650. {
  651. if (this.board[0, 1] != -1)
  652. return;
  653.  
  654. if (black_turn)
  655. {
  656. setSpace(0, 1, 0, box1);
  657. }
  658. else
  659. {
  660. setSpace(0, 1, 1, box1);
  661. }
  662.  
  663. checkForOverTurns(0,1);
  664. switchTurn();
  665. }
  666.  
  667. private void Box10_Click(object sender, EventArgs e)
  668. {
  669. if (this.board[1, 1] != -1)
  670. return;
  671.  
  672. if (black_turn)
  673. {
  674. setSpace(1, 1, 0, box1);
  675. }
  676. else
  677. {
  678. setSpace(1, 1, 1, box1);
  679. }
  680.  
  681. checkForOverTurns(1,1);
  682. switchTurn();
  683. }
  684.  
  685. private void Box11_Click(object sender, EventArgs e)
  686. {
  687. if (this.board[2, 1] != -1)
  688. return;
  689.  
  690. if (black_turn)
  691. {
  692. setSpace(2, 1, 0, box1);
  693. }
  694. else
  695. {
  696. setSpace(2, 1, 1, box1);
  697. }
  698.  
  699. checkForOverTurns(2,1);
  700. switchTurn();
  701. }
  702.  
  703. private void Box12_Click(object sender, EventArgs e)
  704. {
  705. if (this.board[3, 1] != -1)
  706. return;
  707.  
  708. if (black_turn)
  709. {
  710. setSpace(3, 1, 0, box1);
  711. }
  712. else
  713. {
  714. setSpace(3, 1, 1, box1);
  715. }
  716.  
  717. checkForOverTurns(3,1);
  718. switchTurn();
  719. }
  720.  
  721. private void Box13_Click(object sender, EventArgs e)
  722. {
  723. if (this.board[4, 1] != -1)
  724. return;
  725.  
  726. if (black_turn)
  727. {
  728. setSpace(4, 1, 0, box1);
  729. }
  730. else
  731. {
  732. setSpace(4, 1, 1, box1);
  733. }
  734.  
  735. checkForOverTurns(4,1);
  736. switchTurn();
  737. }
  738.  
  739. private void Box14_Click(object sender, EventArgs e)
  740. {
  741. if (this.board[5, 1] != -1)
  742. return;
  743.  
  744. if (black_turn)
  745. {
  746. setSpace(5, 1, 0, box1);
  747. }
  748. else
  749. {
  750. setSpace(5, 1, 1, box1);
  751. }
  752.  
  753. checkForOverTurns(5,1);
  754. switchTurn();
  755. }
  756.  
  757. private void Box15_Click(object sender, EventArgs e)
  758. {
  759. if (this.board[6, 1] != -1)
  760. return;
  761.  
  762. if (black_turn)
  763. {
  764. setSpace(6, 1, 0, box1);
  765. }
  766. else
  767. {
  768. setSpace(6, 1, 1, box1);
  769. }
  770.  
  771. checkForOverTurns(6,1);
  772. switchTurn();
  773. }
  774.  
  775. private void Box16_Click(object sender, EventArgs e)
  776. {
  777. if (this.board[7, 1] != -1)
  778. return;
  779.  
  780. if (black_turn)
  781. {
  782. setSpace(7, 1, 0, box1);
  783. }
  784. else
  785. {
  786. setSpace(7, 1, 1, box1);
  787. }
  788.  
  789. checkForOverTurns(7,1);
  790. switchTurn();
  791. }
  792.  
  793. /*
  794. * 3rd Row Listseners
  795. */
  796.  
  797. private void Box17_Click(object sender, EventArgs e)
  798. {
  799. if (this.board[0, 2] != -1)
  800. return;
  801.  
  802. if (black_turn)
  803. {
  804. setSpace(0, 2, 0, box1);
  805. }
  806. else
  807. {
  808. setSpace(0, 2, 1, box1);
  809. }
  810.  
  811. checkForOverTurns(0, 2);
  812. switchTurn();
  813. }
  814.  
  815. private void Box18_Click(object sender, EventArgs e)
  816. {
  817. if (this.board[1, 2] != -1)
  818. return;
  819.  
  820. if (black_turn)
  821. {
  822. setSpace(1, 2, 0, box1);
  823. }
  824. else
  825. {
  826. setSpace(1, 2, 1, box1);
  827. }
  828.  
  829. checkForOverTurns(1, 2);
  830. switchTurn();
  831. }
  832.  
  833. private void Box19_Click(object sender, EventArgs e)
  834. {
  835. if (this.board[2, 2] != -1)
  836. return;
  837.  
  838. if (black_turn)
  839. {
  840. setSpace(2, 2, 0, box1);
  841. }
  842. else
  843. {
  844. setSpace(2, 2, 1, box1);
  845. }
  846.  
  847. checkForOverTurns(2, 2);
  848. switchTurn();
  849. }
  850.  
  851. private void Box20_Click(object sender, EventArgs e)
  852. {
  853. if (this.board[3, 2] != -1)
  854. return;
  855.  
  856. if (black_turn)
  857. {
  858. setSpace(3, 2, 0, box1);
  859. }
  860. else
  861. {
  862. setSpace(3, 2, 1, box1);
  863. }
  864.  
  865. checkForOverTurns(3, 2);
  866. switchTurn();
  867. }
  868.  
  869. private void Box21_Click(object sender, EventArgs e)
  870. {
  871. if (this.board[4, 2] != -1)
  872. return;
  873.  
  874. if (black_turn)
  875. {
  876. setSpace(4, 2, 0, box1);
  877. }
  878. else
  879. {
  880. setSpace(4, 2, 1, box1);
  881. }
  882.  
  883. checkForOverTurns(4, 2);
  884. switchTurn();
  885. }
  886.  
  887. private void Box22_Click(object sender, EventArgs e)
  888. {
  889. if (this.board[5, 2] != -1)
  890. return;
  891.  
  892. if (black_turn)
  893. {
  894. setSpace(5, 2, 0, box1);
  895. }
  896. else
  897. {
  898. setSpace(5, 2, 1, box1);
  899. }
  900.  
  901. checkForOverTurns(5, 2);
  902. switchTurn();
  903. }
  904.  
  905. private void Box23_Click(object sender, EventArgs e)
  906. {
  907. if (this.board[6, 2] != -1)
  908. return;
  909.  
  910. if (black_turn)
  911. {
  912. setSpace(6, 2, 0, box1);
  913. }
  914. else
  915. {
  916. setSpace(6, 2, 1, box1);
  917. }
  918.  
  919. checkForOverTurns(6, 2);
  920. switchTurn();
  921. }
  922.  
  923. private void Box24_Click(object sender, EventArgs e)
  924. {
  925. if (this.board[7, 2] != -1)
  926. return;
  927.  
  928. if (black_turn)
  929. {
  930. setSpace(7, 2, 0, box1);
  931. }
  932. else
  933. {
  934. setSpace(7, 2, 1, box1);
  935. }
  936.  
  937. checkForOverTurns(7, 2);
  938. switchTurn();
  939. }
  940.  
  941. /*
  942. * 4th Row
  943. */
  944.  
  945. private void Box25_Click(object sender, EventArgs e)
  946. {
  947. if (this.board[0, 3] != -1)
  948. return;
  949.  
  950. if (black_turn)
  951. {
  952. setSpace(0, 3, 0, box1);
  953. }
  954. else
  955. {
  956. setSpace(0, 3, 1, box1);
  957. }
  958.  
  959. checkForOverTurns(0, 3);
  960. switchTurn();
  961. }
  962.  
  963. private void Box26_Click(object sender, EventArgs e)
  964. {
  965. if (this.board[1, 3] != -1)
  966. return;
  967.  
  968. if (black_turn)
  969. {
  970. setSpace(1, 3, 0, box1);
  971. }
  972. else
  973. {
  974. setSpace(1, 3, 1, box1);
  975. }
  976.  
  977. checkForOverTurns(1, 3);
  978. switchTurn();
  979. }
  980.  
  981. private void Box27_Click(object sender, EventArgs e)
  982. {
  983. if (this.board[2, 3] != -1)
  984. return;
  985.  
  986. if (black_turn)
  987. {
  988. setSpace(2, 3, 0, box1);
  989. }
  990. else
  991. {
  992. setSpace(2, 3, 1, box1);
  993. }
  994.  
  995. checkForOverTurns(2, 3);
  996. switchTurn();
  997. }
  998.  
  999. private void Box28_Click(object sender, EventArgs e)
  1000. {
  1001. if (this.board[3, 3] != -1)
  1002. return;
  1003.  
  1004. if (black_turn)
  1005. {
  1006. setSpace(3, 3, 0, box1);
  1007. }
  1008. else
  1009. {
  1010. setSpace(3, 3, 1, box1);
  1011. }
  1012.  
  1013. checkForOverTurns(3, 3);
  1014. switchTurn();
  1015. }
  1016.  
  1017. private void Box29_Click(object sender, EventArgs e)
  1018. {
  1019. if (this.board[4, 3] != -1)
  1020. return;
  1021.  
  1022. if (black_turn)
  1023. {
  1024. setSpace(4, 3, 0, box1);
  1025. }
  1026. else
  1027. {
  1028. setSpace(4, 3, 1, box1);
  1029. }
  1030.  
  1031. checkForOverTurns(4, 3);
  1032. switchTurn();
  1033. }
  1034.  
  1035. private void Box30_Click(object sender, EventArgs e)
  1036. {
  1037. if (this.board[5, 3] != -1)
  1038. return;
  1039.  
  1040. if (black_turn)
  1041. {
  1042. setSpace(5, 3, 0, box1);
  1043. }
  1044. else
  1045. {
  1046. setSpace(5, 3, 1, box1);
  1047. }
  1048.  
  1049. checkForOverTurns(5, 3);
  1050. switchTurn();
  1051. }
  1052.  
  1053. private void Box31_Click(object sender, EventArgs e)
  1054. {
  1055. if (this.board[6, 3] != -1)
  1056. return;
  1057.  
  1058. if (black_turn)
  1059. {
  1060. setSpace(6, 3, 0, box1);
  1061. }
  1062. else
  1063. {
  1064. setSpace(6, 3, 1, box1);
  1065. }
  1066.  
  1067. checkForOverTurns(6, 3);
  1068. switchTurn();
  1069. }
  1070.  
  1071. private void Box32_Click(object sender, EventArgs e)
  1072. {
  1073. if (this.board[7, 3] != -1)
  1074. return;
  1075.  
  1076. if (black_turn)
  1077. {
  1078. setSpace(7, 3, 0, box1);
  1079. }
  1080. else
  1081. {
  1082. setSpace(7, 3, 1, box1);
  1083. }
  1084.  
  1085. checkForOverTurns(7, 3);
  1086. switchTurn();
  1087. }
  1088.  
  1089. /*
  1090. * 5th Row
  1091. */
  1092.  
  1093. private void Box33_Click(object sender, EventArgs e)
  1094. {
  1095. if (this.board[0, 4] != -1)
  1096. return;
  1097.  
  1098. if (black_turn)
  1099. {
  1100. setSpace(0, 4, 0, box1);
  1101. }
  1102. else
  1103. {
  1104. setSpace(0, 4, 1, box1);
  1105. }
  1106.  
  1107. checkForOverTurns(0, 4);
  1108. switchTurn();
  1109. }
  1110.  
  1111. private void Box34_Click(object sender, EventArgs e)
  1112. {
  1113. if (this.board[1, 4] != -1)
  1114. return;
  1115.  
  1116. if (black_turn)
  1117. {
  1118. setSpace(1, 4, 0, box1);
  1119. }
  1120. else
  1121. {
  1122. setSpace(1, 4, 1, box1);
  1123. }
  1124.  
  1125. checkForOverTurns(1, 4);
  1126. switchTurn();
  1127. }
  1128.  
  1129. private void Box35_Click(object sender, EventArgs e)
  1130. {
  1131. if (this.board[2, 4] != -1)
  1132. return;
  1133.  
  1134. if (black_turn)
  1135. {
  1136. setSpace(2, 4, 0, box1);
  1137. }
  1138. else
  1139. {
  1140. setSpace(2, 4, 1, box1);
  1141. }
  1142.  
  1143. checkForOverTurns(2, 4);
  1144. switchTurn();
  1145. }
  1146.  
  1147. private void Box36_Click(object sender, EventArgs e)
  1148. {
  1149. if (this.board[3, 4] != -1)
  1150. return;
  1151.  
  1152. if (black_turn)
  1153. {
  1154. setSpace(3, 4, 0, box1);
  1155. }
  1156. else
  1157. {
  1158. setSpace(3, 4, 1, box1);
  1159. }
  1160.  
  1161. checkForOverTurns(3, 4);
  1162. switchTurn();
  1163. }
  1164.  
  1165. private void Box37_Click(object sender, EventArgs e)
  1166. {
  1167. if (this.board[4, 4] != -1)
  1168. return;
  1169.  
  1170. if (black_turn)
  1171. {
  1172. setSpace(4, 4, 0, box1);
  1173. }
  1174. else
  1175. {
  1176. setSpace(4, 4, 1, box1);
  1177. }
  1178.  
  1179. checkForOverTurns(4, 4);
  1180. switchTurn();
  1181. }
  1182.  
  1183. private void Box38_Click(object sender, EventArgs e)
  1184. {
  1185. if (this.board[5, 4] != -1)
  1186. return;
  1187.  
  1188. if (black_turn)
  1189. {
  1190. setSpace(5, 4, 0, box1);
  1191. }
  1192. else
  1193. {
  1194. setSpace(5, 4, 1, box1);
  1195. }
  1196.  
  1197. checkForOverTurns(5, 4);
  1198. switchTurn();
  1199. }
  1200.  
  1201. private void Box39_Click(object sender, EventArgs e)
  1202. {
  1203. if (this.board[6, 4] != -1)
  1204. return;
  1205.  
  1206. if (black_turn)
  1207. {
  1208. setSpace(6, 4, 0, box1);
  1209. }
  1210. else
  1211. {
  1212. setSpace(6, 4, 1, box1);
  1213. }
  1214.  
  1215. checkForOverTurns(6, 4);
  1216. switchTurn();
  1217. }
  1218.  
  1219. private void Box40_Click(object sender, EventArgs e)
  1220. {
  1221. if (this.board[7, 4] != -1)
  1222. return;
  1223.  
  1224. if (black_turn)
  1225. {
  1226. setSpace(7, 4, 0, box1);
  1227. }
  1228. else
  1229. {
  1230. setSpace(7, 4, 1, box1);
  1231. }
  1232.  
  1233. checkForOverTurns(7, 4);
  1234. switchTurn();
  1235. }
  1236.  
  1237. /*
  1238. * 6th Row Listeners
  1239. */
  1240.  
  1241. private void Box41_Click(object sender, EventArgs e)
  1242. {
  1243. if (this.board[0, 5] != -1)
  1244. return;
  1245.  
  1246. if (black_turn)
  1247. {
  1248. setSpace(0, 5, 0, box1);
  1249. }
  1250. else
  1251. {
  1252. setSpace(0, 5, 1, box1);
  1253. }
  1254.  
  1255. checkForOverTurns(0, 5);
  1256. switchTurn();
  1257. }
  1258.  
  1259. private void Box42_Click(object sender, EventArgs e)
  1260. {
  1261. if (this.board[1, 5] != -1)
  1262. return;
  1263.  
  1264. if (black_turn)
  1265. {
  1266. setSpace(1, 5, 0, box1);
  1267. }
  1268. else
  1269. {
  1270. setSpace(1, 5, 1, box1);
  1271. }
  1272.  
  1273. checkForOverTurns(1,5);
  1274. switchTurn();
  1275. }
  1276.  
  1277. private void Box43_Click(object sender, EventArgs e)
  1278. {
  1279. if (this.board[2, 5] != -1)
  1280. return;
  1281.  
  1282. if (black_turn)
  1283. {
  1284. setSpace(2, 5, 0, box1);
  1285. }
  1286. else
  1287. {
  1288. setSpace(2, 5, 1, box1);
  1289. }
  1290.  
  1291. checkForOverTurns(2,5);
  1292. switchTurn();
  1293. }
  1294.  
  1295. private void Box44_Click(object sender, EventArgs e)
  1296. {
  1297. if (this.board[3, 5] != -1)
  1298. return;
  1299.  
  1300. if (black_turn)
  1301. {
  1302. setSpace(3, 5, 0, box1);
  1303. }
  1304. else
  1305. {
  1306. setSpace(3, 5, 1, box1);
  1307. }
  1308.  
  1309. checkForOverTurns(3,5);
  1310. switchTurn();
  1311. }
  1312.  
  1313. private void Box45_Click(object sender, EventArgs e)
  1314. {
  1315. if (this.board[4, 5] != -1)
  1316. return;
  1317.  
  1318. if (black_turn)
  1319. {
  1320. setSpace(4, 5, 0, box1);
  1321. }
  1322. else
  1323. {
  1324. setSpace(4, 5, 1, box1);
  1325. }
  1326.  
  1327. checkForOverTurns(4,5);
  1328. switchTurn();
  1329. }
  1330.  
  1331. private void Box46_Click(object sender, EventArgs e)
  1332. {
  1333. if (this.board[5, 5] != -1)
  1334. return;
  1335.  
  1336. if (black_turn)
  1337. {
  1338. setSpace(5, 5, 0, box1);
  1339. }
  1340. else
  1341. {
  1342. setSpace(5, 5, 1, box1);
  1343. }
  1344.  
  1345. checkForOverTurns(5,5);
  1346. switchTurn();
  1347. }
  1348.  
  1349. private void Box47_Click(object sender, EventArgs e)
  1350. {
  1351. if (this.board[6, 5] != -1)
  1352. return;
  1353.  
  1354. if (black_turn)
  1355. {
  1356. setSpace(6, 5, 0, box1);
  1357. }
  1358. else
  1359. {
  1360. setSpace(6, 5, 1, box1);
  1361. }
  1362.  
  1363. checkForOverTurns(6,5);
  1364. switchTurn();
  1365. }
  1366.  
  1367. private void Box48_Click(object sender, EventArgs e)
  1368. {
  1369. if (this.board[7, 5] != -1)
  1370. return;
  1371.  
  1372. if (black_turn)
  1373. {
  1374. setSpace(7, 5, 0, box1);
  1375. }
  1376. else
  1377. {
  1378. setSpace(7, 5, 1, box1);
  1379. }
  1380.  
  1381. checkForOverTurns(7,5);
  1382. switchTurn();
  1383. }
  1384.  
  1385. /*
  1386. * 7th Row Listeners
  1387. */
  1388.  
  1389. private void Box49_Click(object sender, EventArgs e)
  1390. {
  1391. if (this.board[0, 6] != -1)
  1392. return;
  1393.  
  1394. if (black_turn)
  1395. {
  1396. setSpace(0, 6, 0, box1);
  1397. }
  1398. else
  1399. {
  1400. setSpace(0, 6, 1, box1);
  1401. }
  1402.  
  1403. checkForOverTurns(0, 6);
  1404. switchTurn();
  1405. }
  1406.  
  1407. private void Box50_Click(object sender, EventArgs e)
  1408. {
  1409. if (this.board[1, 6] != -1)
  1410. return;
  1411.  
  1412. if (black_turn)
  1413. {
  1414. setSpace(1, 6, 0, box1);
  1415. }
  1416. else
  1417. {
  1418. setSpace(1, 6, 1, box1);
  1419. }
  1420.  
  1421. checkForOverTurns(1, 6);
  1422. switchTurn();
  1423. }
  1424.  
  1425. private void Box51_Click(object sender, EventArgs e)
  1426. {
  1427. if (this.board[2, 6] != -1)
  1428. return;
  1429.  
  1430. if (black_turn)
  1431. {
  1432. setSpace(2, 6, 0, box1);
  1433. }
  1434. else
  1435. {
  1436. setSpace(2, 6, 1, box1);
  1437. }
  1438.  
  1439. checkForOverTurns(2, 6);
  1440. switchTurn();
  1441. }
  1442.  
  1443. private void Box52_Click(object sender, EventArgs e)
  1444. {
  1445. if (this.board[3, 6] != -1)
  1446. return;
  1447.  
  1448. if (black_turn)
  1449. {
  1450. setSpace(3, 6, 0, box1);
  1451. }
  1452. else
  1453. {
  1454. setSpace(3, 6, 1, box1);
  1455. }
  1456.  
  1457. checkForOverTurns(3, 6);
  1458. switchTurn();
  1459. }
  1460.  
  1461. private void Box53_Click(object sender, EventArgs e)
  1462. {
  1463. if (this.board[4, 6] != -1)
  1464. return;
  1465.  
  1466. if (black_turn)
  1467. {
  1468. setSpace(4, 6, 0, box1);
  1469. }
  1470. else
  1471. {
  1472. setSpace(4, 6, 1, box1);
  1473. }
  1474.  
  1475. checkForOverTurns(4, 6);
  1476. switchTurn();
  1477. }
  1478.  
  1479. private void Box54_Click(object sender, EventArgs e)
  1480. {
  1481. if (this.board[5, 6] != -1)
  1482. return;
  1483.  
  1484. if (black_turn)
  1485. {
  1486. setSpace(5, 6, 0, box1);
  1487. }
  1488. else
  1489. {
  1490. setSpace(5, 6, 1, box1);
  1491. }
  1492.  
  1493. checkForOverTurns(5, 6);
  1494. switchTurn();
  1495. }
  1496.  
  1497. private void Box55_Click(object sender, EventArgs e)
  1498. {
  1499. if (this.board[6, 6] != -1)
  1500. return;
  1501.  
  1502. if (black_turn)
  1503. {
  1504. setSpace(6, 6, 0, box1);
  1505. }
  1506. else
  1507. {
  1508. setSpace(6, 6, 1, box1);
  1509. }
  1510.  
  1511. checkForOverTurns(6, 6);
  1512. switchTurn();
  1513. }
  1514.  
  1515. private void Box56_Click(object sender, EventArgs e)
  1516. {
  1517. if (this.board[7, 6] != -1)
  1518. return;
  1519.  
  1520. if (black_turn)
  1521. {
  1522. setSpace(7, 6, 0, box1);
  1523. }
  1524. else
  1525. {
  1526. setSpace(7, 6, 1, box1);
  1527. }
  1528.  
  1529. checkForOverTurns(7, 6);
  1530. switchTurn();
  1531. }
  1532.  
  1533. /*
  1534. * 8th Row Listeners
  1535. */
  1536.  
  1537. private void Box57_Click(object sender, EventArgs e)
  1538. {
  1539. if (this.board[0, 7] != -1)
  1540. return;
  1541.  
  1542. if (black_turn)
  1543. {
  1544. setSpace(0, 7, 0, box1);
  1545. }
  1546. else
  1547. {
  1548. setSpace(0, 7, 1, box1);
  1549. }
  1550.  
  1551. checkForOverTurns(0, 7);
  1552. switchTurn();
  1553. }
  1554.  
  1555. private void Box58_Click(object sender, EventArgs e)
  1556. {
  1557. if (this.board[1, 7] != -1)
  1558. return;
  1559.  
  1560. if (black_turn)
  1561. {
  1562. setSpace(1, 7, 0, box1);
  1563. }
  1564. else
  1565. {
  1566. setSpace(1, 7, 1, box1);
  1567. }
  1568.  
  1569. checkForOverTurns(1, 7);
  1570. switchTurn();
  1571. }
  1572.  
  1573. private void Box59_Click(object sender, EventArgs e)
  1574. {
  1575. if (this.board[2, 7] != -1)
  1576. return;
  1577.  
  1578. if (black_turn)
  1579. {
  1580. setSpace(2, 7, 0, box1);
  1581. }
  1582. else
  1583. {
  1584. setSpace(2, 7, 1, box1);
  1585. }
  1586.  
  1587. checkForOverTurns(2, 7);
  1588. switchTurn();
  1589. }
  1590.  
  1591. private void Box60_Click(object sender, EventArgs e)
  1592. {
  1593. if (this.board[3, 7] != -1)
  1594. return;
  1595.  
  1596. if (black_turn)
  1597. {
  1598. setSpace(3, 7, 0, box1);
  1599. }
  1600. else
  1601. {
  1602. setSpace(3, 7, 1, box1);
  1603. }
  1604.  
  1605. checkForOverTurns(3, 7);
  1606. switchTurn();
  1607. }
  1608.  
  1609. private void Box61_Click(object sender, EventArgs e)
  1610. {
  1611. if (this.board[4, 7] != -1)
  1612. return;
  1613.  
  1614. if (black_turn)
  1615. {
  1616. setSpace(4, 7, 0, box1);
  1617. }
  1618. else
  1619. {
  1620. setSpace(4, 7, 1, box1);
  1621. }
  1622.  
  1623. checkForOverTurns(4, 7);
  1624. switchTurn();
  1625. }
  1626.  
  1627. private void Box62_Click(object sender, EventArgs e)
  1628. {
  1629. if (this.board[5, 7] != -1)
  1630. return;
  1631.  
  1632. if (black_turn)
  1633. {
  1634. setSpace(5, 7, 0, box1);
  1635. }
  1636. else
  1637. {
  1638. setSpace(5, 7, 1, box1);
  1639. }
  1640.  
  1641. checkForOverTurns(5, 7);
  1642. switchTurn();
  1643. }
  1644.  
  1645. private void Box63_Click(object sender, EventArgs e)
  1646. {
  1647. if (this.board[6, 7] != -1)
  1648. return;
  1649.  
  1650. if (black_turn)
  1651. {
  1652. setSpace(6, 7, 0, box1);
  1653. }
  1654. else
  1655. {
  1656. setSpace(6, 7, 1, box1);
  1657. }
  1658.  
  1659. checkForOverTurns(6, 7);
  1660. switchTurn();
  1661. }
  1662.  
  1663. private void Box64_Click(object sender, EventArgs e)
  1664. {
  1665. if (this.board[7, 7] != -1)
  1666. return;
  1667.  
  1668. if (black_turn)
  1669. {
  1670. setSpace(7, 7, 0, box1);
  1671. }
  1672. else
  1673. {
  1674. setSpace(7, 7, 1, box1);
  1675. }
  1676.  
  1677. checkForOverTurns(7, 7);
  1678. switchTurn();
  1679. }
  1680.  
  1681. //Returns the PictureBox for the corisponding row / column.
  1682. private PictureBox getBoxFromRowAndColum(int row, int colum)
  1683. {
  1684. switch (row)
  1685. {
  1686. /*
  1687. * First Row
  1688. */
  1689. case 0 when colum == 0:
  1690. {
  1691. return box1;
  1692. }
  1693. break;
  1694. case 1 when colum == 0:
  1695. {
  1696. return box2;
  1697. }
  1698. break;
  1699. case 2 when colum == 0:
  1700. {
  1701. return box3;
  1702. }
  1703. break;
  1704. case 3 when colum == 0:
  1705. {
  1706. return box4;
  1707. }
  1708. break;
  1709. case 4 when colum == 0:
  1710. {
  1711. return box5;
  1712. }
  1713. break;
  1714. case 5 when colum == 0:
  1715. {
  1716. return box6;
  1717. }
  1718. break;
  1719. case 6 when colum == 0:
  1720. {
  1721. return box7;
  1722. }
  1723. break;
  1724. case 7 when colum == 0:
  1725. {
  1726. return box8;
  1727. }
  1728. break;
  1729.  
  1730. /*
  1731. * Seccond Row
  1732. */
  1733.  
  1734. case 0 when colum == 1:
  1735. {
  1736. return box9;
  1737. }
  1738. break;
  1739. case 1 when colum == 1:
  1740. {
  1741. return box10;
  1742. }
  1743. break;
  1744. case 2 when colum == 1:
  1745. {
  1746. return box11;
  1747. }
  1748. break;
  1749. case 3 when colum == 1:
  1750. {
  1751. return box12;
  1752. }
  1753. break;
  1754. case 4 when colum == 1:
  1755. {
  1756. return box13;
  1757. }
  1758. break;
  1759. case 5 when colum == 1:
  1760. {
  1761. return box14;
  1762. }
  1763. break;
  1764. case 6 when colum == 1:
  1765. {
  1766. return box15;
  1767. }
  1768. break;
  1769. case 7 when colum == 1:
  1770. {
  1771. return box16;
  1772. }
  1773. break;
  1774.  
  1775. /*
  1776. * Third Row
  1777. */
  1778.  
  1779. case 0 when colum == 2:
  1780. {
  1781. return box17;
  1782. }
  1783. break;
  1784. case 1 when colum == 2:
  1785. {
  1786. return box18;
  1787. }
  1788. break;
  1789. case 2 when colum == 2:
  1790. {
  1791. return box19;
  1792. }
  1793. break;
  1794. case 3 when colum == 2:
  1795. {
  1796. return box20;
  1797. }
  1798. break;
  1799. case 4 when colum == 2:
  1800. {
  1801. return box21;
  1802. }
  1803. break;
  1804. case 5 when colum == 2:
  1805. {
  1806. return box22;
  1807. }
  1808. break;
  1809. case 6 when colum == 2:
  1810. {
  1811. return box23;
  1812. }
  1813. break;
  1814. case 7 when colum == 2:
  1815. {
  1816. return box24;
  1817. }
  1818. break;
  1819.  
  1820. /*
  1821. * Fourth Row
  1822. */
  1823.  
  1824. case 0 when colum == 3:
  1825. {
  1826. return box25;
  1827. }
  1828. break;
  1829. case 1 when colum == 3:
  1830. {
  1831. return box26;
  1832. }
  1833. break;
  1834. case 2 when colum == 3:
  1835. {
  1836. return box27;
  1837. }
  1838. break;
  1839. case 3 when colum == 3:
  1840. {
  1841. return box28;
  1842. }
  1843. break;
  1844. case 4 when colum == 3:
  1845. {
  1846. return box29;
  1847. }
  1848. break;
  1849. case 5 when colum == 3:
  1850. {
  1851. return box30;
  1852. }
  1853. break;
  1854. case 6 when colum == 3:
  1855. {
  1856. return box31;
  1857. }
  1858. break;
  1859. case 7 when colum == 3:
  1860. {
  1861. return box32;
  1862. }
  1863. break;
  1864.  
  1865. /*
  1866. * Fifth Row
  1867. */
  1868.  
  1869. case 0 when colum == 4:
  1870. {
  1871. return box33;
  1872. }
  1873. break;
  1874. case 1 when colum == 4:
  1875. {
  1876. return box34;
  1877. }
  1878. break;
  1879. case 2 when colum == 4:
  1880. {
  1881. return box35;
  1882. }
  1883. break;
  1884. case 3 when colum == 4:
  1885. {
  1886. return box36;
  1887. }
  1888. break;
  1889. case 4 when colum == 4:
  1890. {
  1891. return box37;
  1892. }
  1893. break;
  1894. case 5 when colum == 4:
  1895. {
  1896. return box38;
  1897. }
  1898. break;
  1899. case 6 when colum == 4:
  1900. {
  1901. return box39;
  1902. }
  1903. break;
  1904. case 7 when colum == 4:
  1905. {
  1906. return box40;
  1907. }
  1908. break;
  1909.  
  1910. /*
  1911. * Sixth Row
  1912. */
  1913.  
  1914. case 0 when colum == 5:
  1915. {
  1916. return box41;
  1917. }
  1918. break;
  1919. case 1 when colum == 5:
  1920. {
  1921. return box42;
  1922. }
  1923. break;
  1924. case 2 when colum == 5:
  1925. {
  1926. return box43;
  1927. }
  1928. break;
  1929. case 3 when colum == 5:
  1930. {
  1931. return box44;
  1932. }
  1933. break;
  1934. case 4 when colum == 5:
  1935. {
  1936. return box45;
  1937. }
  1938. break;
  1939. case 5 when colum == 5:
  1940. {
  1941. return box46;
  1942. }
  1943. break;
  1944. case 6 when colum == 5:
  1945. {
  1946. return box47;
  1947. }
  1948. break;
  1949. case 7 when colum == 5:
  1950. {
  1951. return box48;
  1952. }
  1953. break;
  1954.  
  1955. /*
  1956. * Seventh Row
  1957. */
  1958.  
  1959. case 0 when colum == 6:
  1960. {
  1961. return box49;
  1962. }
  1963. break;
  1964. case 1 when colum == 6:
  1965. {
  1966. return box50;
  1967. }
  1968. break;
  1969. case 2 when colum == 6:
  1970. {
  1971. return box51;
  1972. }
  1973. break;
  1974. case 3 when colum == 6:
  1975. {
  1976. return box52;
  1977. }
  1978. break;
  1979. case 4 when colum == 6:
  1980. {
  1981. return box53;
  1982. }
  1983. break;
  1984. case 5 when colum == 6:
  1985. {
  1986. return box54;
  1987. }
  1988. break;
  1989. case 6 when colum == 6:
  1990. {
  1991. return box55;
  1992. }
  1993. break;
  1994. case 7 when colum == 6:
  1995. {
  1996. return box56;
  1997. }
  1998. break;
  1999.  
  2000.  
  2001. /*
  2002. * Eigth Row
  2003. */
  2004.  
  2005. case 0 when colum == 7:
  2006. {
  2007. return box57;
  2008. }
  2009. break;
  2010. case 1 when colum == 7:
  2011. {
  2012. return box58;
  2013. }
  2014. break;
  2015. case 2 when colum == 7:
  2016. {
  2017. return box59;
  2018. }
  2019. break;
  2020. case 3 when colum == 7:
  2021. {
  2022. return box60;
  2023. }
  2024. break;
  2025. case 4 when colum == 7:
  2026. {
  2027. return box61;
  2028. }
  2029. break;
  2030. case 5 when colum == 7:
  2031. {
  2032. return box62;
  2033. }
  2034. break;
  2035. case 6 when colum == 7:
  2036. {
  2037. return box63;
  2038. }
  2039. break;
  2040. case 7 when colum == 7:
  2041. {
  2042. return box64;
  2043. }
  2044. break;
  2045. }
  2046.  
  2047. return null;
  2048. }
  2049.  
  2050. //Unused Class
  2051.  
  2052. public class Boardspace
  2053. {
  2054. private int row;
  2055. private int colum;
  2056. private bool isfirstplaced;
  2057.  
  2058. public Boardspace(int row, int colum, bool isfirstplaced)
  2059. {
  2060. this.row = row;
  2061. this.colum = colum;
  2062. this.isfirstplaced = isfirstplaced;
  2063. }
  2064.  
  2065. public int getRow()
  2066. {
  2067. return row;
  2068. }
  2069.  
  2070. public int getColum()
  2071. {
  2072. return colum;
  2073. }
  2074.  
  2075. private bool isFirstPlaced()
  2076. {
  2077. return isfirstplaced;
  2078. }
  2079. }
  2080.  
  2081.  
  2082. }
  2083. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement