
-----------------------------------
ssmiley
Wed Jan 07, 2009 9:01 am

Battleship Help!!!!
-----------------------------------
Hey, It has been a long time since i've used turing so i've forgot a lot of stuff... I need with with a project (Battleship), So far i have a main menu with a 1 player link, 2 player link and a instructions button. I'm working on both the 1 and 2 player buttons.. So far what it does is places ships in a specific spot (which i want to make so that the user can place them) also it tells you if it hits or misses then goes to other player, doesn't keep the ones you've hit or missed... So mainly i want to make both users place ships and it to save the hits and misses without changing too much.
Thanks for your help in advance

Here is the program i have so far

% Battleship
% Steven Smiley

%===============Importing GUI==================

import GUI

%======================Text=============

var Font2 : int

%================Constants=====================

const size := 10
const boxWidth := 50

%===========Global Data Structure============

type matrix : array 0 .. size, 0 .. size of string (4)

%====================variables==============

%==========Puddle===============

var puddle1 : matrix
var puddle2 : matrix

%=======Global Values For Ship Lengths========

var aclen, bslen, dslen, sblen : int

%============Vital Global Cords===============

var urow, ucol : int

%=====Variables For Player 1 And Player 2=====

var achits1, bshits1, dshits1, sbhits1 : int := 0
var onewins : boolean

var achits2, bshits2, dshits2, sbhits2 : int := 0
var twowins : boolean

%=================Procedures===================   

%==========Read Mouse========

proc readMouse (var mrow, mcol : int)
    loop
        var xmouse, ymouse, button, updown : int
        buttonwait ("down", xmouse, ymouse, button, updown)
        mcol := xmouse div boxWidth
        % ymouse := ymouse - boxWidth
        mrow := (maxy - ymouse) div boxWidth
        exit when mrow > 0 and mrow  0 and mcol 