Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

Re: ASCII Battleship Program

by davido (Cardinal)
on Feb 04, 2012 at 07:28 UTC ( #951769=note: print w/replies, xml ) Need Help??

in reply to ASCII Battleship Program

Bug report: When you try to place an entity on the board that has a width of less than five (the largest piece), the smaller piece shows up at an offset from where you actually try to place it.

Example: Place a sub (three chars wide) at A7r. You can't. You must place it at A5r, in which case it appears at A6r, extends right three places, and leaves a blank slot in A10.

It also seems (in the one game I played) that the computer placed two pieces overlapping. I could be wrong on that though.


Replies are listed 'Best First'.
Re^2: ASCII Battleship Program
by perlStuck (Sexton) on Feb 04, 2012 at 15:25 UTC

    Yeah, I think I found a partial solution at least. It would appear that two of the conditionals that would allow the return of a properly placed ship was faulty. In 'sub place_ship' there's a line that reads:

    return 0 if $x<0 or $y<0 or $x>9 or $y>9;

    Changing it to:

    return 0 if $x<0 or $y<0 or $x>10 or $y>10;
    That seems to work.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://951769]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (7)
As of 2021-03-02 21:42 GMT
Find Nodes?
    Voting Booth?
    My favorite kind of desktop background is:

    Results (63 votes). Check out past polls.