There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Tag Cloud
blue screen boot computer connection cpu crash css dell display driver drivers email error ethernet excel firefox firefox 3 game hard drive hardware internet internet explorer itunes laptop malware monitor network networking nvidia outlook outlook 2003 outlook express partition printer problem problems router security slow software sound sprtcmd.exe trojan usb video virus vista windows windows xp wireless
Software Development
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Software & Hardware > Software Development >
Solved: simple quick question on two-dimensional arrays


HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free! Click here to join today! We highly recommend that you print a copy of our Guide for New Members. Enjoy!

Closed Thread
 
Thread Tools
RHY-07's Avatar
Junior Member with 17 posts.
 
Join Date: May 2007
Experience: intermediate - advanced.. at some things
18-Mar-2008, 07:35 AM #1
Solved: simple quick question on two-dimensional arrays
well i hope it is, basically i am created a game of reversi/othello in college using VB.net and i am using a two-dimensional array grid for the game board. checked help and a few websites n cant seem to find what i need.

what i need to know is how i could check the surrounding tiles when a tile is placed on the game board. basically i need the code to tell the program to check where the sleected tile is on the grid, then check whats to the left, right, above and below it. I realise this would be done by telling the program to minus/add one to the co-ords of the selected tile but im not sure how to code this. any pointers?

if you need any more info for whatever just leave a message and ill reply asap

thanks in advance.

Last edited by RHY-07 : 19-Mar-2008 05:51 AM. Reason: forgot to say i was using VB.net, sorry
pjhutch's Avatar
Senior Member with 319 posts.
 
Join Date: Aug 2005
Experience: Advanced
18-Mar-2008, 01:05 PM #2
Try this (pseudo code): xpos and ypos are your current positions

For x=-1 to 1
For y=-1 to 1
' ignore current position
If not (x=0 and y=0) then
' check if position used
if board(xpos + x, ypos + y) <> 0 then
print "This position is used"
end if
end if
next y
nexy x
Closed Thread

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who help people like you solve computer problems. See our Welcome Guide to get started.



Thread Tools


You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 02:55 AM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.