Jump to content

3D Array Beginner (Console)

- - - - -

  • Please log in to reply
6 replies to this topic

#1
Combinu

Combinu

    Newbie

  • Members
  • Pip
  • 9 posts
Hi to all,

I am doing an assignment for my C# course.
This assignment is to build a battleship game.
Attached with this post there is my fool code, it is all working fine.
I achieved the pass criteria but to get a perfect score a distinction i need to have a better thinking.
The aim to get this score is to make this game work in 3D arrays.

I am still a beginner but i really would like to know more about how can i do this.
Fortunately when speaking to programming I am a fast learner and i can really manipulate what i am shown.

Can anyone please help me achieve this task the exact questions are these:

Change your battleship coding and instead of 2d array you should manipulate and use a 3D array.

My full working game is attached to this post.
If anyone could help i really need an explenation on how to do it or if possible what should i change to make this work.

Thanks in advance for your help, hope i get an answer as soon as possible as it is due in 2 days.

Thanks Again
Combinu

PS: I am using Visual Studio 2005

Attached Files


Edited by Combinu, 18 January 2011 - 08:51 AM.
Using...


#2
Vswe

Vswe

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 9,552 posts
  • Programming Language:Java, C#, PHP, Python, JavaScript, PL/SQL, Visual Basic .NET, Lua, ActionScript
I'm a little bit confused here, why would a battleship game needs a 3D array? Is this some future-version where you have airships floating around in a three dimensional space?

#3
Combinu

Combinu

    Newbie

  • Members
  • Pip
  • 9 posts
Yes sort of... just instead of floating on an area they are in the area...

#4
Vswe

Vswe

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 9,552 posts
  • Programming Language:Java, C#, PHP, Python, JavaScript, PL/SQL, Visual Basic .NET, Lua, ActionScript
The first question that comes in my mind is: Since this is console based, how have you planned to show the game area with a 3D area?

#5
Combinu

Combinu

    Newbie

  • Members
  • Pip
  • 9 posts
THere is no need to show it... The problem is just to solve this concept and thats all

#6
Vswe

Vswe

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 9,552 posts
  • Programming Language:Java, C#, PHP, Python, JavaScript, PL/SQL, Visual Basic .NET, Lua, ActionScript
Then you can just add a third dimension to the array and repeat everything you did for the first two dimension on the third. But since some parts of your code is the selection of the coordinates I can't see how you will do that when using 3 dimensions.

#7
sam_l

sam_l

    Learning Programmer

  • Members
  • PipPipPip
  • 52 posts
The result of me taking 3 seconds to Google C# arrays. Perhaps you should do your own [easy] work.

Arrays Tutorial (C#)




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users