It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming Visual Basic Forum

data entry restrictions

Moderator: dafunkymunky

data entry restrictions

Postby charndex on Thu May 12, 2005 2:02 pm

hie guys, i`m almost done with snakes and ladders thanx to you. i need a bit of help though.
i need to specify the following restrictions in data entry.
;a square can only contain one of
the top of a ladder
the foot of a ladder
the head of a snake
the tail of a snake
No ladder goes off the board
no snake goes off the board
how do i go about it. i simply need the code for this.
any help would be solely appreciated
charndex
 
Posts: 3
Joined: Fri Apr 29, 2005 10:14 am
Location: leeds

Postby dafunkymunky on Fri May 13, 2005 2:27 pm

see this is what you do

declare a two dimensional array and initially save all the entries to zero
the no of rows and columns in your array should be equal to the no of rows and columns in your board , i think i told you in youyr earlier post how to redeclare the size of the array
this is done by

for i = 0 to <the no of rows in your array>
for j=0 to <no of columns in your array>
array(i,j)=0
next j
next i

now as the user or whoever puts something store a certain value like say if the square contains the head or tail store 1 or 2 and if ti contains the foot or the end of the ladder store 3 or 4 to the corresponding row and col of the array as that of the board

this way every time the user begins is ladder or ends his ladder you just check if the value in the array element of that row and column is 0 otherwise display error mesage

and the snake and ladder going out of the box can be checked by checking if the row or coulmn the ladder or snake begins or ends is outside the arrray limits remember the ubound and lbound tags
and man please ask for the eact code if you reaaly dont understand evenafter my post or atleasst tick solved and post you solution so that one can understand the discussion is complete

i think it would be bettter if you would post a link to you game once it is completed everyone can see and appriciate you work
--------DAFUNKYMUNKY--------
::THE::NECESSARY::[D]EVIL::
....errr i mean munky....
User avatar
dafunkymunky
100+ Club
 
Posts: 183
Joined: Fri Apr 08, 2005 7:32 am
Location: India


Who is online

Users browsing this forum: No registered users and 7 guests