1. map = repeat(repeat(....

I am working on a trek game that uses 8x8 sector grids, and an 8x8 quadrant
grid.
I would like to make a sequence called map to contain all the info for the
quadrant 
and all the sectors inside each quadrant.  

Information for each quadrant will consist of it's x-y position and a flag
stating
if that quadrant has been explored yet. (0 = NO, 1 = YES)
Each sector will consist of an 8x8 grid and what type of object (if any) is
in 
each x-y location...

----------------------------------/  here's what I'm at so far

constant quadX = 1,    quadY = 2,      explored = 3,  
         sectorX = 4,  sectorY = 5,    object = 6, 
         fedship = 1,  klingship = 2,  starbase = 3,
         base = 4

sequence map

map = repeat(repeat({0,0,0}, --/  makes an 8x8 quadrant map 
     (repeat(repeat({0,0,0}, --/  makes an 8x8 sector map in each quadrant map
      8),8),8)),8)           --/  It don't work. I rewrite it and keep
getting  
                             --/  the same error message

ex. -  map[3][4][1][7][6][object] = fedship 
in quadrant 3,4-sector 7,6 the object is the players ship,
when the ship moves out of sector 7,6 and up to sector 3,6 then
  
   map[3][4][1][7][6][object] = 0
       and
   map[3][4][1][3][6][object] = 1

---------------------------------/ 

Well that's about what I'v been working on for this weekend. .   .
Anybody got any suggestions how to make it work???

thanks...
>"LIVE LONG AND PROSPEROUS." - quote from 'Startrek'

new topic     » topic index » view message » categorize

2. Re: map = repeat(repeat(....

I think it should actually turn out like this:

map = repeat(repeat(repeat(repeat({0, 0, 0}, -- x-y position and flag
      8),              -- 8 columns of the sector
      8),              -- 8 rows of 8 columns of the sector
      8),              -- 8 sectors in a row (columns) to one grid position
      8)               -- 8 rows of 8 sectors to form grid

-- Reference a point by:
  map[grid_row][grid_column][sector_row][sector_column][(x, y, or flag)]
  Eg:
    map[4][6][2][5][1] = 3 -- x-coordinate of sector at pos (2, 5) of grid 
at pos. (4, 6)

I hope that didn't confuse you. (or me!)
Try looking at the Language War demo that comes wth Euphoria.

>From: timelord at zebra.net
>Reply-To: EUforum at topica.com
>To: EUforum <EUforum at topica.com>
>Subject: map = repeat(repeat(....
>Date: Sun, 13 Jan 2002 17:23:50 -0600
>
>
>I am working on a trek game that uses 8x8 sector grids, and an 8x8 quadrant
>grid.
>I would like to make a sequence called map to contain all the info for the
>quadrant
>and all the sectors inside each quadrant.
>
>Information for each quadrant will consist of it's x-y position and a flag
>stating
>if that quadrant has been explored yet. (0 = NO, 1 = YES)
>Each sector will consist of an 8x8 grid and what type of object (if any) is
>in
>each x-y location...
>
>----------------------------------/  here's what I'm at so far
>
>constant quadX = 1,    quadY = 2,      explored = 3,
>          sectorX = 4,  sectorY = 5,    object = 6,
>          fedship = 1,  klingship = 2,  starbase = 3,
>          base = 4
>
>sequence map
>
>map = repeat(repeat({0,0,0}, --/  makes an 8x8 quadrant map
>      (repeat(repeat({0,0,0}, --/  makes an 8x8 sector map in each quadrant 
>map
>       8),8),8)),8)           --/  It don't work. I rewrite it and keep
>getting
>                              --/  the same error message
>
>ex. -  map[3][4][1][7][6][object] = fedship
>in quadrant 3,4-sector 7,6 the object is the players ship,
>when the ship moves out of sector 7,6 and up to sector 3,6 then
>
>    map[3][4][1][7][6][object] = 0
>        and
>    map[3][4][1][3][6][object] = 1
>
>---------------------------------/
>
>Well that's about what I'v been working on for this weekend. .   .
>Anybody got any suggestions how to make it work???
>
>thanks...
> >"LIVE LONG AND PROSPEROUS." - quote from 'Startrek'
>
>
>
>

new topic     » goto parent     » topic index » view message » categorize

3. Re: map = repeat(repeat(....

>
>I think it should actually turn out like this:
>
>map = repeat(repeat(repeat(repeat({0, 0, 0}, -- x-y position and flag
>      8),              -- 8 columns of the sector
>      8),              -- 8 rows of 8 columns of the sector
>      8),              -- 8 sectors in a row (columns) to one grid position
>      8)               -- 8 rows of 8 sectors to form grid
>
>I hope that didn't confuse you. (or me!)
>Try looking at the Language War demo that comes wth Euphoria.

Thanks for the help. I'll try it out today...
Also,  I've looked at language war to get ideas of how to write 
this program, and it has helped increase my skill in this language... 
InCon., seems like it took me forever just to catch on to how sequences
work.  
But I did.
I have to testify, that if an old dog like me can learn a new trick, 
then anybody can learn to write programs using Euphoria.   


>"LIVE LONG AND PROSPEROUS." - quote from 'Startrek'

new topic     » goto parent     » topic index » view message » categorize

4. Re: map = repeat(repeat(....

Hi,
I think this is close to what you wanted...
-----------------------------------------
include get.e
include graphics.e

constant EMPTY     = 0,
         FEDSHIP   = 1,
         KLINGSHIP = 2,
         STARBASE  = 3,
         BASE      = 4

constant SECTOR   = 1,
         EXPLORED = 2

integer qx,qy,k
sequence map

map = repeat(repeat({repeat(repeat(0,8),8),0},8),8)

qx = 3
qy = 4

map[qx][qy][EXPLORED] = 1
map[3][4][SECTOR][7][6] = FEDSHIP

-- and a quadrant display loop just for fun....
while 1 do
    position(1,1)
    cursor(#2000)  -- Cursor Off
    puts(1,"  ")
    for x = 1 to 8 do
        printf(1,"%d ",{x})
    end for
    puts(1,"\n")

    for x = 1 to 8 do
        printf(1,"%d ",{x})
        for y = 1 to 8 do
            if map[x][y][EXPLORED] then
                puts(1,"* ")
            else
                puts(1,". ")
            end if
        end for
        puts(1,"\n")
    end for

    k = wait_key()

    map[qx][qy][EXPLORED] = 0
    if k = 328 then                    -- up
        qx -= 1
    elsif k = 336 then                 -- dn
        qx += 1
    elsif k = 331 then                 -- left
        qy -= 1
    elsif k = 333 then                 -- right
        qy += 1
    elsif k = 27 then
        exit
    end if
    qx = and_bits(qx-1,#7)+1
    qy = and_bits(qy-1,#7)+1

    map[qx][qy][EXPLORED] = 1

end while

----- Original Message -----
From: <timelord at zebra.net>
To: "EUforum" <EUforum at topica.com>
Sent: Tuesday, January 15, 2002 1:58 AM
Subject: Re: map = repeat(repeat(....


>
> >
> >I think it should actually turn out like this:
> >
> >map = repeat(repeat(repeat(repeat({0, 0, 0}, -- x-y position and flag
> >      8),              -- 8 columns of the sector
> >      8),              -- 8 rows of 8 columns of the sector
> >      8),              -- 8 sectors in a row (columns) to one grid
position
> >      8)               -- 8 rows of 8 sectors to form grid
> >
> >I hope that didn't confuse you. (or me!)
> >Try looking at the Language War demo that comes wth Euphoria.
>
> Thanks for the help. I'll try it out today...
> Also,  I've looked at language war to get ideas of how to write
> this program, and it has helped increase my skill in this language...
> InCon., seems like it took me forever just to catch on to how
sequences
> work.
> But I did.
> I have to testify, that if an old dog like me can learn a new trick,
> then anybody can learn to write programs using Euphoria.
>
>
> >"LIVE LONG AND PROSPEROUS." - quote from 'Startrek'

new topic     » goto parent     » topic index » view message » categorize

5. Re: map = repeat(repeat(....

Well I got to put my 2 cents in on star trek games. The best one I ever
played was vgatrek you can get it here 
http://www2.tripnet.se/~head/games/dos/vgatrek.htm
I'd love to see a port done to Euphoria and win32. I'm eyebrow deep in
another Euphoria project so I decied not to tackel it. If you haven't
tried vgatrek yet, please do. You'll love the interface. Good luck and
keep us updated.
Alvin
--- timelord at zebra.net wrote:
> 
> >
> >I think it should actually turn out like this:
> >
> >map = repeat(repeat(repeat(repeat({0, 0, 0}, -- x-y position and
> flag
> >      8),              -- 8 columns of the sector
> >      8),              -- 8 rows of 8 columns of the sector
> >      8),              -- 8 sectors in a row (columns) to one grid
> position
> >      8)               -- 8 rows of 8 sectors to form grid
> >
> >I hope that didn't confuse you. (or me!)
> >Try looking at the Language War demo that comes wth Euphoria.
> 
> Thanks for the help. I'll try it out today...
> Also,  I've looked at language war to get ideas of how to write 
> this program, and it has helped increase my skill in this language...
> 
> InCon., seems like it took me forever just to catch on to how
> sequences
> work.  
> But I did.
> I have to testify, that if an old dog like me can learn a new trick, 
> then anybody can learn to write programs using Euphoria.   
> 
> 
> >"LIVE LONG AND PROSPEROUS." - quote from 'Startrek' 
> 
> 
> 
> 


=====
See my homepage at
http://ka9qlq.tripod.com/home/
and where I live at
http://ka9qlq.tripod.com/CCC/

This is a 256 Megabyte 400 Mhz 13 Gig. plug and pray system.

new topic     » goto parent     » topic index » view message » categorize

6. Re: map = repeat(repeat(....

>I think this is close to what you wanted...
>-----------------------------------------
>
>constant EMPTY     = 0,
>         FEDSHIP   = 1,
>         KLINGSHIP = 2,
>         STARBASE  = 3,
>         BASE      = 4
>
>constant SECTOR   = 1,
>         EXPLORED = 2
>
>integer qx,qy,k
>sequence map
>
>map = repeat(repeat({repeat(repeat(0,8),8),0},8),8)
>

That's it...  Thanks a zillion.... 
>"LIVE LONG AND PROSPEROUS." - quote from 'Startrek'

new topic     » goto parent     » topic index » view message » categorize

7. Re: map = repeat(repeat(....

>I'd love to see a port done to Euphoria and win32. I'm eyebrow deep in
>another Euphoria project so I decied not to tackel it. If you haven't
>tried vgatrek yet, please do. You'll love the interface. Good luck and
>keep us updated.
>Alvin

I will, and the game will use the win32lib  <--(makes win programming easy:)


>"LIVE LONG AND PROSPEROUS." - quote from 'Startrek'

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu