Note that there are some explanatory texts on larger screens.

plurals
  1. POMarbles program not removing
    primarykey
    data
    text
    <p>I'm having some problems with a program I'm playing around with. I am trying to do this marble game where the player plays against the computer and remove marbles until the board is empty. My problem is that the class I have for removing the marbles doesn't seem to be removing it. I think it's something simple, but I just don't see it. The part where I THINK I'm having trouble with is in CAPITAL letters:</p> <pre><code>Pile tiles = new Pile(); tiles.createMarbles(); marbles = tiles.getMarbles(); System.out.println("There are now " + marbles + " left!"); HumanPlayer hum = new HumanPlayer(); SmartMode cpu = new SmartMode(); StupidMode badcpu = new StupidMode(); //ComputerMove cpu = new ComputerMove(); //PlayerMove hum = new PlayerMove(); do { if (compMove == true &amp;&amp; marbles &gt; 1) { if (compSmart) { //marbles = cpu.move(marbles); tiles.removesMarbles(cpu.move(marbles)); //THIS RIGHT HERE System.out.println("There are now " + marbles + " left!"); compMove = false; } if (!compSmart) { //marbles = badcpu.move(marbles); tiles.removesMarbles(badcpu.move(marbles)); // THIS RIGHT HERE System.out.println("There are now " + marbles + " left!"); compMove = false; } /* marbles = (cpu.ComputerMove(marbles, compSmart)); System.out.println("There are now " + marbles + " left!"); compMove = false;*/ } else if (compMove == false &amp;&amp; marbles &gt; 1) { //marbles = (hum.move(marbles)); tiles.removesMarbles(hum.move(marbles)); // THIS RIGHT HERE System.out.println("There are now " + marbles + " left!"); compMove = true; } } while (marbles &gt; 1); </code></pre> <p>The rest is not needed for answer</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload