Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void play()
- {
- while(!player.isDefeated() && !opponent.isDefeated())
- {
- player clicks location
- Gui tells boardhandler to change marker
- if(transfer(loc).equals("red") || transfer(loc).equals("white"))
- prompt user to click on another spot
- opponent.putMarker(loc);//boardhandler changes marker on opponentboard
- boardhandler tells gui to update graphics([r]c = red or white)//(oppboard)
- int r = (int) 10 * Math.random();
- int c = (int) 10 * Math.random();
- Location temp = boardhandler plays for opponent- chooses square
- //Location loc1 = transfer(temp);//keep reference to last hit
- if(transfer(temp.equals("red")))
- {
- int d = 360 / (int)(4 * Math.random() + 1);
- temp.getLocationToward(d);
- if(temp2.equals("red"))
- temp = new location;
- }
- else if(hadn't looked in all 4 directions)
- randomly select another adjacent location
- }
Add Comment
Please, Sign In to add comment