LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-01-2003, 05:52 PM   #1
Gerardoj
Member
 
Registered: May 2003
Location: Somewhere over the Rainbow
Distribution: Slackware 9.x, Knoppix, Damn Small Linux, RedHat.
Posts: 465

Rep: Reputation: 30
Array Question?


I have downloaded this example code of pascal, and I would like to know what it do? or the explanation . Thanks for your help.

Code:
num2:array[0..18] of pchar = (				(
'16 16 2 1',
'       c none',
'.      c #00008B8B0000',
'                ',
'                ',
'                ',
'                ',
'      ....      ',
'     ..  ..     ',
'         ..     ',
'        ...     ',
'       ...      ',
'      ..        ',
'     ..         ',
'     ......     ',
'     ......     ',
'                ',
'                ',
'                '
);
 
Old 10-01-2003, 06:01 PM   #2
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: Debian
Posts: 2,536

Rep: Reputation: 111Reputation: 111
It stores a bitmap picture in an array of (C-type) strings.
 
Old 10-01-2003, 06:41 PM   #3
Gerardoj
Member
 
Registered: May 2003
Location: Somewhere over the Rainbow
Distribution: Slackware 9.x, Knoppix, Damn Small Linux, RedHat.
Posts: 465

Original Poster
Rep: Reputation: 30
Thanks for your reply, Last question, what is c #00008B8B0000? why have a number 2 the figure in quotes?
 
Old 10-01-2003, 08:06 PM   #4
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 374Reputation: 374Reputation: 374Reputation: 374
This is just a guess:
The first couple of number are probably telling you specifics about the bitmap; color for instance. More than likely, the "c #00008B8B0000" does something similar. You will need to trace down where this array is used in the code. It will probably be sent to a function or procedure, and you'll have to either read the documentation of that function/procedure to understand how it interprets those values, or look at the code itself. Those numbers could mean just about anything.

If I understand the program's purpose, this is a minesweeper type of game, yes? I assume you've played minesweeper before. Think back to when you select an unknown tile. If there is no mine underneath it, then it tells you how many mines are adjacent to that tile. I would be willing to bet a lot of money that this array simply tells the program what to display in that tile. That's why there are arrays for "1", "2", "3", "4", etc. The program defines what each number will look like, and when the player chooses a tile, it determines how many mines are adjacent, selects the array for the appropriate number, and redraws the screen with the chosen array instead of an unknown tile.
 
Old 10-02-2003, 12:21 AM   #5
Gerardoj
Member
 
Registered: May 2003
Location: Somewhere over the Rainbow
Distribution: Slackware 9.x, Knoppix, Damn Small Linux, RedHat.
Posts: 465

Original Poster
Rep: Reputation: 30
Thanks a lot for the replys.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
quick array question ftgow Programming 5 05-24-2005 02:52 AM
a question about array pointers in C veritas Programming 12 07-18-2004 06:31 PM
c++ structure-array question deveraux83 Programming 2 01-01-2004 08:55 AM
C Array question in REdhat 8 cyberswami Programming 5 12-23-2003 02:13 PM
Raid array question RecoilUK Linux - Hardware 6 06-01-2002 11:48 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:12 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration