1. The Euphoria Sub Commander project

Al Getz wrote:
> 
> ChrisBurch3 wrote:
> > 
> > Hi
> > 
> > Euphoria should be able to handle this quite nicely. Checking on the net,
> > they
> > are fairly
> > minimal block graphics, with character displays, and the concept is a fairly
> > simple large repetitive loop with strategic elements within that (balancing
> > resources damage etc). You should be able to produce either a fairly
> > accurate
> > reproduction, or enhance it with photos of ships and explosions seen through
> > the periscope.
> > 
> > euallegro, and eusdl, would be able to handle these quite nicely.
> > 
> > Tell you what Don, if your up for it, you create the graphics (some ships, a
> > series of explosion graphics,
> > and the large lettering / numbers - this will determine the overall look), 
> > I'll source some sub sounds (pings, explosions, white noise), 
> > and we'll put some code together.
> > 
> > Al, interested?
> > 
> > Chris
> 
> Hi Chris,
> 
> It does sound interesting.  Way back i used to have the 'plastic'
> version.  It was fairly large.
> Who's going to start the code?
> What library would you want to use, if any?
> 
> Al
> 
> E boa sorte com sua programacao Euphoria!
> 
> 
> My bumper sticker: "I brake for LED's"
> 

Hi

I propose using the euallegro graphics library - its simple and agile enough
for this project.

I've already sourced the sounds, and have an outline of structure in my head.

I'll outline the code. Hopefully will be able to modularise it so that separate
authors can work on their modules.

Hopefully this is a simple enough collabarative project that won't
become bogged in bureaucratic shennanigans.

I need a free repository, where I can upload and download code mods and media,
that other members can also do the same - any suggestions - SourceForge is
way too top heavy. I had thought about using esnips, but its terms of use is for
single use only. 

Chris

new topic     » topic index » view message » categorize

2. Re: The Euphoria Sub Commander project

CChris wrote:
> 
> 
> I remember there is a polyglot package in the archive by I. Kachan, which is
> about a submarine cockpit and control. You may take useful hints from there.
> I'd bet IK knows his business pretty well.
> 
> CChris

Hi

I almost got quite excited then - correct me if I'm wrong, but I thought it was
about dos code page fonts, and it mentions that the package is free as in air
around a submarine. Yup, just searched through it, no other mention of submarine
cockpits.

Thanks for looking though Chris

Chris

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

3. Re: The Euphoria Sub Commander project

ChrisBurch2 wrote:
> 
> CChris wrote:
> > 
> > 
> > I remember there is a polyglot package in the archive by I. Kachan, which is
> > about a submarine cockpit and control. You may take useful hints from there.
> > I'd bet IK knows his business pretty well.
> > 
> > CChris
> 
> Hi
> 
> I almost got quite excited then - correct me if I'm wrong, but I thought it
> was
> about dos code page fonts, and it mentions that the package is free as in air
> around a submarine. Yup, just searched through it, no other mention of
> submarine
> cockpits.
> 
> Thanks for looking though Chris
> 
> Chris

lol
I can't access the user contrib page right now. But I do remember Igor had
contributed something about submarines, and cited it as an example of big
projects that could be developed in Eu as it was.

On Aug 27, 2002 (message #21 looking for "submarine"), Igor wrote:

One of my programs in EU was a historical model of 
one old ship's control panel - about 400 buttons on 
4 screens, 35000 EU operators, developed in EU 2.1 PD 
with 300 statements limitation on run time diagnostics.
After translation to C with E2C translator, that proggy 
had 2.5M C source code in 50 files. I am not owner of 
that code now, but you can see some chunks in the 
polyglot package.

Perhaps can you get your hands on this?

CChris

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

4. Re: The Euphoria Sub Commander project

CChris wrote:
> 
> ChrisBurch2 wrote:
> > 
> > CChris wrote:
> > > 
> > > 
> > > I remember there is a polyglot package in the archive by I. Kachan, which
> > > is
> > > about a submarine cockpit and control. You may take useful hints from
> > > there.
> > > I'd bet IK knows his business pretty well.
> > > 
> > > CChris
> > 
> > Hi
> > 
> > I almost got quite excited then - correct me if I'm wrong, but I thought it
> > was
> > about dos code page fonts, and it mentions that the package is free as in
> > air
> > around a submarine. Yup, just searched through it, no other mention of
> > submarine
> > cockpits.
> > 
> > Thanks for looking though Chris
> > 
> > Chris
> 
> lol
> I can't access the user contrib page right now. But I do remember Igor had
> contributed
> something about submarines, and cited it as an example of big projects that
> could be developed in Eu as it was.
> 
> On Aug 27, 2002 (message #21 looking for "submarine"), Igor wrote:
> 
> One of my programs in EU was a historical model of 
> one old ship's control panel - about 400 buttons on 
> 4 screens, 35000 EU operators, developed in EU 2.1 PD 
> with 300 statements limitation on run time diagnostics.
> After translation to C with E2C translator, that proggy 
> had 2.5M C source code in 50 files. I am not owner of 
> that code now, but you can see some chunks in the 
> polyglot package.
> 
> Perhaps can you get your hands on this?

OK, that polyglot package was developed on the GUI
base (buttons, leds etc) of my big historical model
of an old xUSSR sonar of the *surface* ship, not of
a submarine. (At first, I served on subs, 8 years,
but then my job was related to the antisub equipment
of the surface ships). And I developed that model,
when I was already retired. Just my friend asked
me to help him with that codeing and I helped.

I served on the "Victor" class Soviet submarines,
671 project. All these submarines are scrapped now.
But that time they were the world fastest and deepest
ones. My last submergence was in 1977.
Just 30 years ago   smile

Let me give you some links about subs here:

http://www.milparade.com/
http://legion.wplus.net/
http://www.fegi.ru/PRIMORYE/flot/index.htm
http://reborn.ru/
http://www.battleships.spb.ru/
http://admiral.centro.ru/start_e.htm
http://www.armscontrol.ru/subs/collisions/debates.htm
http://www.mmt.ru/win/ships/
http://www.webcom.com/~amraam/rnav.html
http://www.neva.ru/EXPO96/contents.html
http://www.geocities.com/CapeCanaveral/Lab/1745/russian_pins.html
http://www.geocities.com/CapeCanaveral/Lab/1745/
http://www.warships1.com/
http://ship.bsu.by/
http://www.naval-technology.com/projects/nssn/
http://www.naval-technology.com/projects/delta/
http://www.navy.mil/swf/index.asp
http://www.militaryinfo.com/
http://www.uscg.mil/
http://www.ibiblio.org/hyperwar/USN/USN-ships.html
http://www.microworks.net/pacific/index.htm
http://www.pbs.org/wgbh/nova/subsecrets/
http://www.pbs.org/wgbh/nova/subsecrets/spriconhi.html
http://www.royal-navy.mod.uk/
http://www.dropbears.com/w/ww1subs/index.htm
http://uboat.net/
http://www.marine.nl/
http://www.submarinos.net/
http://geocities.com/Pentagon/Bunker/7704/battle.html
http://www.hellas.org/military/navy/
http://www.worldnavy.info/

And there is an interesting game, Danger from the Deep,
an opensource ww2 german submarine simulator

http://dangerdeep.sourceforge.net/

It is some SDL project, SDL is good for EU.


Regards,
Igor Kachan
kinz at peterlink.ru

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

5. Re: The Euphoria Sub Commander project

<snip>



   Sorry about the snipping or lack there of.
I got the sonar screen done now I have to do the beam and scan.
I'll read Chris's posts in detail later.

 Don Cole

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

6. Re: The Euphoria Sub Commander project

Igor Kachan wrote:
<snip>
 
> OK, that polyglot package was developed on the GUI
> base (buttons, leds etc) of my big historical model
> of an old xUSSR sonar of the *surface* ship, not of
> a submarine. (At first, I served on subs, 8 years,
> but then my job was related to the antisub equipment
> of the surface ships). And I developed that model,
> when I was already retired. Just my friend asked
> me to help him with that codeing and I helped.
> 
> I served on the "Victor" class Soviet submarines,
> 671 project. All these submarines are scrapped now.
> But that time they were the world fastest and deepest
> ones. My last submergence was in 1977.
> Just 30 years ago   smile
> 
> Let me give you some links about subs here:
> 
> <a href="http://www.milparade.com/">http://www.milparade.com/</a>
> <a href="http://legion.wplus.net/">http://legion.wplus.net/</a>
> <a
> href="http://www.fegi.ru/PRIMORYE/flot/index.htm">http://www.fegi.ru/PRIMORYE/flot/index.htm</a>
> <a href="http://reborn.ru/">http://reborn.ru/</a>
> <a href="http://www.battleships.spb.ru/">http://www.battleships.spb.ru/</a>
> <a
> href="http://admiral.centro.ru/start_e.htm">http://admiral.centro.ru/start_e.htm</a>
> <a
> href="http://www.armscontrol.ru/subs/collisions/debates.htm">http://www.armscontrol.ru/subs/collisions/debates.htm</a>
> <a href="http://www.mmt.ru/win/ships/">http://www.mmt.ru/win/ships/</a>
> <a
> href="http://www.webcom.com/~amraam/rnav.html">http://www.webcom.com/~amraam/rnav.html</a>
> <a
> href="http://www.neva.ru/EXPO96/contents.html">http://www.neva.ru/EXPO96/contents.html</a>
> <a
> href="http://www.geocities.com/CapeCanaveral/Lab/1745/russian_pins.html">http://www.geocities.com/CapeCanaveral/Lab/1745/russian_pins.html</a>
> <a
> href="http://www.geocities.com/CapeCanaveral/Lab/1745/">http://www.geocities.com/CapeCanaveral/Lab/1745/</a>
> <a href="http://www.warships1.com/">http://www.warships1.com/</a>
> <a href="http://ship.bsu.by/">http://ship.bsu.by/</a>
> <a
> href="http://www.naval-technology.com/projects/nssn/">http://www.naval-technology.com/projects/nssn/</a>
> <a
> href="http://www.naval-technology.com/projects/delta/">http://www.naval-technology.com/projects/delta/</a>
> <a
> href="http://www.navy.mil/swf/index.asp">http://www.navy.mil/swf/index.asp</a>
> <a href="http://www.militaryinfo.com/">http://www.militaryinfo.com/</a>
> <a href="http://www.uscg.mil/">http://www.uscg.mil/</a>
> <a
> href="http://www.ibiblio.org/hyperwar/USN/USN-ships.html">http://www.ibiblio.org/hyperwar/USN/USN-ships.html</a>
> <a
> href="http://www.microworks.net/pacific/index.htm">http://www.microworks.net/pacific/index.htm</a>
> <a
> href="http://www.pbs.org/wgbh/nova/subsecrets/">http://www.pbs.org/wgbh/nova/subsecrets/</a>
> <a
> href="http://www.pbs.org/wgbh/nova/subsecrets/spriconhi.html">http://www.pbs.org/wgbh/nova/subsecrets/spriconhi.html</a>
> <a href="http://www.royal-navy.mod.uk/">http://www.royal-navy.mod.uk/</a>
> <a
> href="http://www.dropbears.com/w/ww1subs/index.htm">http://www.dropbears.com/w/ww1subs/index.htm</a>
> <a href="http://uboat.net/">http://uboat.net/</a>
> <a href="http://www.marine.nl/">http://www.marine.nl/</a>
> <a href="http://www.submarinos.net/">http://www.submarinos.net/</a>
> <a
> href="http://geocities.com/Pentagon/Bunker/7704/battle.html">http://geocities.com/Pentagon/Bunker/7704/battle.html</a>
> <a
> href="http://www.hellas.org/military/navy/">http://www.hellas.org/military/navy/</a>
> <a href="http://www.worldnavy.info/">http://www.worldnavy.info/</a>
> 
> And there is an interesting game, Danger from the Deep,
> an opensource ww2 german submarine simulator
> 
> <a
> href="http://dangerdeep.sourceforge.net/">http://dangerdeep.sourceforge.net/</a>
> 
> It is some SDL project, SDL is good for EU.
> 
> 

gulp

> Regards,
> Igor Kachan
> kinz at peterlink.ru
> 

Chris

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

7. Re: The Euphoria Sub Commander project

Hi

Uploading first stage code - a splash screen, and some initialisation.

Note, you need euallegro 0.3 (Ray Smith)

Chris

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

8. Re: The Euphoria Sub Commander project

Hi

It seems that I have fallen at the first hurdle of copyright.

The splash screen is a graphic from a website, www.sunbmarineresearch.com ,
so I emailed the contact, very coureously I may point out, to request the
use of the graphic, explaining the use, and pointing to the location of the
files.

This is the reply I received

"All of the images and written material on www.submarineresearch.com are
copyrighted.  I am constrained to expressly forbid any duplication of the
images or material on the subject website including electronic or otherwise
duplication.  Your request is denied and any infringement may lead to
litigation.  Edward Monroe-Jones, Director."

So, Rob, could you please remove the project from the recent user contributions
. I apologise for any inconvenience this may have caused. I shall draw the
splash screen myself, avoiding looking at any images of any submarines, and
shall endeavour to seek approval before posting any copyrighted images.

I would also request that anybody who has downloaded the file re format their
hard drives immediately, and send a letter of grovelling apology to
Edward Monroe-Jones.

If any one thinks they see a note of slight bitterness, they are absolutely
right, while I fully support the right of anyone to protect their work, I 
believe this attitude was high handed and aggressive, and not using the 
graphic will now not lead anyone who use the program to the site, whereas I
was more than willing to not make any money from it, and give full accreditation
to the author and the site.

But that's just my opinion.

Chris

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

9. Re: The Euphoria Sub Commander project

ChrisBurch2 wrote:
> So, Rob, could you please remove the project from the recent user
> contributions

Done.
  
> I apologise for any inconvenience this may have caused. 

No problem.

> I shall draw the
> splash screen myself, avoiding looking at any images of any submarines, and
> shall endeavour to seek approval before posting any copyrighted images.
> 
> I would also request that anybody who has downloaded the file re format their
> hard drives immediately, and send a letter of grovelling apology to
> Edward Monroe-Jones.
> 
> If any one thinks they see a note of slight bitterness, they are absolutely
> right, while I fully support the right of anyone to protect their work, I 
> believe this attitude was high handed and aggressive, and not using the 
> graphic will now not lead anyone who use the program to the site, whereas I
> was more than willing to not make any money from it, and give full
> accreditation
> to the author and the site.
> 
> But that's just my opinion.

A lot of people think their biggest threat is
that someone might copy their work, and make money from it. 
In reality, a much bigger threat is that the world 
will simply ignore them.

Regards,
   Rob Craig
   Rapid Deployment Software
   http://www.RapidEuphoria.com

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

10. Re: The Euphoria Sub Commander project

Robert Craig wrote:
> 
> ChrisBurch2 wrote:
> > So, Rob, could you please remove the project from the recent user
> > contributions
> 
> Done.
>   
> > I apologise for any inconvenience this may have caused. 
> 
> No problem.
> 
> > I shall draw the
> > splash screen myself, avoiding looking at any images of any submarines, and
> > shall endeavour to seek approval before posting any copyrighted images.
> > 
> > I would also request that anybody who has downloaded the file re format
> > their
> > hard drives immediately, and send a letter of grovelling apology to
> > Edward Monroe-Jones.
> > 
> > If any one thinks they see a note of slight bitterness, they are absolutely
> > right, while I fully support the right of anyone to protect their work, I 
> > believe this attitude was high handed and aggressive, and not using the 
> > graphic will now not lead anyone who use the program to the site, whereas I
> > was more than willing to not make any money from it, and give full
> > accreditation
> > to the author and the site.
> > 
> > But that's just my opinion.
> 
> A lot of people think their biggest threat is
> that someone might copy their work, and make money from it. 
> In reality, a much bigger threat is that the world 
> will simply ignore them.
> 
> Regards,
>    Rob Craig
>    Rapid Deployment Software
>    <a href="http://www.RapidEuphoria.com">http://www.RapidEuphoria.com</a>

Yes.  It was Oscar Wilde's little-know brother, Fred from Sheboygan who said 
"The only thing worse than having your code copied, is not having your code
copied".

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

11. Re: The Euphoria Sub Commander project

Brian Clark wrote:
> Robert Craig wrote:
> > A lot of people think their biggest threat is
> > that someone might copy their work, and make money from it. 
> > In reality, a much bigger threat is that the world 
> > will simply ignore them.
> Yes.  It was Oscar Wilde's little-know brother, Fred from Sheboygan who said
> "The only thing worse than having your code copied, is not having your code
> copied".

LOL. But true.

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

12. Re: The Euphoria Sub Commander project

ChrisBurch2 wrote:
> 
> Hi
> 
> It seems that I have fallen at the first hurdle of copyright.
> 
> The splash screen is a graphic from a website, www.sunbmarineresearch.com ,
> so I emailed the contact, very coureously I may point out, to request the
> use of the graphic, explaining the use, and pointing to the location of the
> files.
> 
> This is the reply I received
> 
> "All of the images and written material on www.submarineresearch.com are
> copyrighted.  I am constrained to expressly forbid any duplication of the
> images or material on the subject website including electronic or otherwise
> duplication.  Your request is denied and any infringement may lead to
> litigation.  Edward Monroe-Jones, Director."
> 
> So, Rob, could you please remove the project from the recent user
> contributions
> . I apologise for any inconvenience this may have caused. I shall draw the
> splash screen myself, avoiding looking at any images of any submarines, and
> shall endeavour to seek approval before posting any copyrighted images.
> 
> I would also request that anybody who has downloaded the file re format their
> hard drives immediately, and send a letter of grovelling apology to
> Edward Monroe-Jones.
> 
> If any one thinks they see a note of slight bitterness, they are absolutely
> right, while I fully support the right of anyone to protect their work, I 
> believe this attitude was high handed and aggressive, and not using the 
> graphic will now not lead anyone who use the program to the site, whereas I
> was more than willing to not make any money from it, and give full
> accreditation
> to the author and the site.
> 
> But that's just my opinion.
> 
> Chris


Hi Chris,


Geeze, sounds nasty to me.  Dont forget to write back to them after the
content has been removed and proclaim, "Just kidding" smile

Oh yeah, BTW, since you guys seem to already have a game plan in
action maybe i'll chime out for now and chime back in as a debugger
once some code becomes available.
If you are into some specialized hardware via serial port or USB to work
with the game once it gets going (keypad, etc.) let me know...perhaps
i can cook something up for relatively low cost and open source (open
source hardware too).



Take care,
Al

E boa sorte com sua programacao Euphoria!


My bumper sticker: "I brake for LED's"

 From "Black Knight":
"I can live with losing the good fight,
 but i can not live without fighting it".
"Well on second thought, maybe not."

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

13. Re: The Euphoria Sub Commander project

Could someone please explain the following code to me in detail? I'm especially
confused by the
{} brackets.

k=player --1 or 2
cen={{120,360},{520,360}},     -- centers of clock
r=100,     -- radius of clock
rt=remaining time in secs



Don Cole
 
function p2xy(atom r, atom a)   -- polar to xy
   return {-r*sin(a),-r*cos(a)}
end function

draw_line(colors[k],{cen[[k],cen[k]+p2xy(r,rt/1800*PI)})



This code comes from       : Simple Chess Clock / Countdown Timer
                             Author     : Ernest Cheam  
                             
                             
In the Archives.

Thank you,

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

14. Re: The Euphoria Sub Commander project

don cole wrote:
> 
> 
> Could someone please explain the following code to me in detail? I'm
> especially
> confused by the
> {} brackets.
> 
> }}}
<eucode>
> 
> k=player --1 or 2
> cen={{120,360},{520,360}},     -- centers of clock
Two clocks, center of 1 is {120,360} and the centre of 2 is {520,360}

> r=100,     -- radius of clock
> rt=remaining time in secs
> 
> 
> Don Cole
>  
> function p2xy(atom r, atom a)   -- polar to xy
>    return {-r*sin(a),-r*cos(a)}
> end function
> 
> draw_line(colors[k],{cen[k],cen[k]+p2xy(r,rt/1800*PI)})

Draws a line from the centre of the clock to somewhere on the edge.

As sin/cos expect arguments in radians, 0..2*PI, and rt is 0..3600, the number
of seconds in an hour, it is coded as /1800*PI rather than /3600*2*PI.

Now imagine a clock with the second hand pointing at 10 seconds past the hour,
drop a line to the horizontal through the centre to make a right angled triange
whose longest side is the second hand. For a picture, see eg
http://www.mathsrevision.net/gcse/pages.php?page=39

From basic trig, the height of this triangle is r*sin(a) and the width is
 r*cos(a). (I almost always get such the wrong way round on first attempt.)

Lastly, rt is the remaining time, a hand pointing at 2 o'clock would be
(10/12)*3600 or 3000 seconds which should explain why the offsets from the clock
centre to the tip of the arm are both returned as -ve.

Hope that is enough detail for you there,
Pete

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

15. Re: The Euphoria Sub Commander project

don cole wrote:
> 
> 
> Could someone please explain the following code to me in detail? I'm
> especially
> confused by the
> {} brackets.
> 
> }}}
<eucode>
> 
> k=player --1 or 2
> cen={{120,360},{520,360}},     -- centers of clock

This is a sequence (outer pair of braces) containing two pairs of integers (the
two inner pairs of braces). Each pair is the {x,y} cartesian coordinates of a
point on the screen.

> r=100,     -- radius of clock
> rt=remaining time in secs

This last line confuses me, something must be missing.

> 
> 
> Don Cole
>  
> function p2xy(atom r, atom a)   -- polar to xy
>    return {-r*sin(a),-r*cos(a)}
> end function

Basic trigonometry to go from polar (radius,angle) coords to cartesian (x,y)
coords. The returned value is negative, because the author wished to
write "+p2xy()" rather than "-p2xy()".

> 
> draw_line(colors[k],{cen[[k],cen[k]+p2xy(r,rt/1800*PI)})
> 

cen[[k] must be cen[k], or else the code simply wasn't tested at all.

draw_line() takes an integer (a color) and a sequence of points. A point is
given by its coordinates expressed as {x,y}. This builtin, DOS specific procedure
joins the points in the order given, with a line of unspecified thickness and
supplied color. You can look it up in the docs for Euphoria.

p2xy() returns a pair of offsets, and cen[k] is a pair of coordinates.
cen[k]+p2xy() is the point cen[k] translated by the offset vector p2xy() returns.
Hence both cen[k] and cen[k]+p2xy() are pairs of coordinates, which can appear
in a sequence passed to draw_line().

sin() and cos() expect an argument expressed in radians. A radian is a
measurement unit for angles. A right angle is PI/2 radian long, so a full circle
is 2*PI radian long (PI is defined in misc.e). As a result, PI radians are 180
degrees, so the conversion formula from degrees to radians is rad = deg/180*PI.
So I assume rt is a number of tenths of degree, very likely. Examine the code
further for confirmation of this.

Contrary to standard mathematical conventions, * and / have the same precedence
in Euphoria, so that "x/y*z" is (x/y)*z, not x/(y*z). This is sometimes a problem
when porting math formulas to Euphoria.

> </eucode>
{{{

> 
> 
> This code comes from       : Simple Chess Clock / Countdown Timer
>                              Author     : Ernest Cheam  
>                              
>                              
> In the Archives.
> 
> Thank you,

I wasn't sure what was confusing you in the code; I hope the above has made
things clearer.

CChris

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

16. Re: The Euphoria Sub Commander project

CChris wrote:
> Contrary to standard mathematical conventions, * and / have the same
> precedence
> in Euphoria, so that "x/y*z" is (x/y)*z, not x/(y*z). This is sometimes a
> problem
> when porting math formulas to Euphoria.

Do you know of any programming language in which
* and / do not have the same precedence?

Regards,
   Rob Craig
   Rapid Deployment Software
   http://www.RapidEuphoria.com

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

17. Re: The Euphoria Sub Commander project

Pete Lomax wrote:
> 
> don cole wrote:
> > 
> > 
> > Could someone please explain the following code to me in detail? I'm
> > especially
> > confused by the
> > {} brackets.
> > 
> > }}}
<eucode>
> > 
> > k=player --1 or 2
> > cen={{120,360},{520,360}},     -- centers of clock
> Two clocks, center of 1 is {120,360} and the centre of 2 is {520,360}
> 
> > r=100,     -- radius of clock
> > rt=remaining time in secs
> > 
> > 
> > Don Cole
> >  
> > function p2xy(atom r, atom a)   -- polar to xy
> >    return {-r*sin(a),-r*cos(a)}
> > end function
> > 
> > draw_line(colors[k],{cen[k],cen[k]+p2xy(r,rt/1800*PI)})
> 
> Draws a line from the centre of the clock to somewhere on the edge.
> 
> As sin/cos expect arguments in radians, 0..2*PI, and rt is 0..3600, the number
> of seconds in an hour, it is coded as /1800*PI rather than /3600*2*PI.
> 
> Now imagine a clock with the second hand pointing at 10 seconds past the hour,
> drop a line to
> the horizontal through the centre to make a right angled triange whose longest
> side is the second
> hand. For a picture, see eg <a
> href="http://www.mathsrevision.net/gcse/pages.php?page=39">http://www.mathsrevision.net/gcse/pages.php?page=39</a>
> 
>  From basic trig, the height of this triangle is r*sin(a) and the width is
>  r*cos(a).
> (I almost always get such the wrong way round on first attempt.) 
> 
> Lastly, rt is the remaining time, a hand pointing at 2 o'clock would be
> (10/12)*3600
> or 3000 seconds which should explain why the offsets from the clock centre to
> the tip of the arm are both returned as -ve.
> 
> Hope that is enough detail for you there,
> Pete

  I want to thank everyone who responded.

I kind of figured it out after I went to bed last night. It was the adding to
cen[k] that confused me. cen[k] is a two element sequence the starting point of
the line. The return of p2xy() is also a two element sequence. I guess you can
add sequences together if they are the same length. This gives a third sequence
which is where to put the end of the line.


Don Cole

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

18. Re: The Euphoria Sub Commander project

don cole wrote:
> 
> Pete Lomax wrote:
> > 
> > don cole wrote:
> > > 
> > > 
> > > Could someone please explain the following code to me in detail? I'm
> > > especially
> > > confused by the
> > > {} brackets.
> > > 
> > > }}}
<eucode>
> > > 
> > > k=player --1 or 2
> > > cen={{120,360},{520,360}},     -- centers of clock
> > Two clocks, center of 1 is {120,360} and the centre of 2 is {520,360}
> > 
> > > r=100,     -- radius of clock
> > > rt=remaining time in secs
> > > 
> > > 
> > > Don Cole
> > >  
> > > function p2xy(atom r, atom a)   -- polar to xy
> > >    return {-r*sin(a),-r*cos(a)}
> > > end function
> > > 
> > > draw_line(colors[k],{cen[k],cen[k]+p2xy(r,rt/1800*PI)})
> > 
> > Draws a line from the centre of the clock to somewhere on the edge.
> > 
> > As sin/cos expect arguments in radians, 0..2*PI, and rt is 0..3600, the
> > number
> > of seconds in an hour, it is coded as /1800*PI rather than /3600*2*PI.
> > 
> > Now imagine a clock with the second hand pointing at 10 seconds past the
> > hour, drop
> a line to
> > the horizontal through the centre to make a right angled triange whose
> > longest
> side is the second</i>
> > hand. For a picture, see eg <a
> > href="http://www.mathsrevision.net/gcse/pages.php?page=39">http://www.mathsrevision.net/gcse/pages.php?page=39</a>
> > 
> >  From basic trig, the height of this triangle is r*sin(a) and the width is
> >  r*cos(a).
> > (I almost always get such the wrong way round on first attempt.) 
> > 
> > Lastly, rt is the remaining time, a hand pointing at 2 o'clock would be
> > (10/12)*3600
> > or 3000 seconds which should explain why the offsets from the clock centre
> > to
> > the tip of the arm are both returned as -ve.
> > 
> > Hope that is enough detail for you there,
> > Pete
> 
>   I want to thank everyone who responded.
> 
> I kind of figured it out after I went to bed last night. It was the adding to
> cen[k] that confused me. cen[k] is a two element sequence the starting point
> of the line. The return of p2xy() is also a two element sequence. I guess you
> can add sequences together if they are the same length. This gives a third
> sequence
> which is where to put the end of the line.
> 
> 
> Don Cole

Well yes, it is actually one of the strengths of Euphoria that you can do s = s1
+ s2 and that this adds the two vectors together, provided their structures
match. This works with and, or, xor,-,* and /, but not & unfortunately. All math
operations (tan(), sqrt() and friends) also work like this. You'll get a complete
picture in the docs, section 2.2.4 (Operations on sequences).

For some background on sequence operations in Eu, see
 
http://www.openeuphoria.org/cgi-bin/esearch.exu?fromMonth=6&fromYear=1&toMonth=B&toYear=C&postedBy=robert+craig&keywords=background+on+sequence+operations

(URL wraps, see post #1 there). Strangely, I cannot find this post on Topica,
even though the replies do appear. The post is too old to be viewed here, even
with the several pages recent enhancement.

CChris

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

19. Re: The Euphoria Sub Commander project

CChris wrote:

<snip> <snip> <snip>

> Well yes, it is actually one of the strengths of Euphoria that you can do s
> = s1 + s2 and that this adds the two vectors together, provided their
> structures
> match. This works with and, or, xor,-,* and /, but not & unfortunately.
> All math operations (tan(), sqrt() and friends) also work like this. You'll
> get a complete picture in the docs, section 2.2.4 (Operations on sequences).
> 
> 
> For some background on sequence operations in Eu, see
>  
> <a
> href="http://www.openeuphoria.org/cgi-bin/esearch.exu?fromMonth=6&fromYear=1&toMonth=B&toYear=C&postedBy=robert+craig&keywords=background+on+sequence+operations">http://www.openeuphoria.org/cgi-bin/esearch.exu?fromMonth=6&fromYear=1&toMonth=B&toYear=C&postedBy=robert+craig&keywords=background+on+sequence+operations</a>
> 
> (URL wraps, see post #1 there). Strangely, I cannot find this post on Topica,
> even though the replies do appear. The post is too old to be viewed here, even
> with the several pages recent enhancement.
> 
> CChris

I'm glad you made this post. It seems you understand what I missed. The
    adding of two sequences. It's not that clear in the statment,

draw_line(colors[k],{cen[k],cen[k]+p2xy(r,rt/1800*PI)}).

After studying it I see it. It's so simple now.

I read some of Rob's old posts you put up a link to. Although a lot of it is 
above my head I get the gist. I know this was well covered in David Gay's
tutorial, but it has been about four years since I read it.

Don Cole

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

20. Re: The Euphoria Sub Commander project

Hi Don

Are you using DOS routines to draw the sonar screen? Ideally you should be 
creating a bitmap that allegro can blit to a section of the main screen.

Chris

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

21. Re: The Euphoria Sub Commander project

Hi

Al, or anyone else who wants to participate.

I need a map generating routine, that generates a random map, with coastline
and sea bed depths.

I would like it to be a grid of approximately 1000 * 1000, I anticipate
a euphoria sequence, each cell holding info about depth of seabed, or whether
it is land or not. There should also be an element for thermocline depth, 
although this may or may not be implemented.

Each cell would equate to approximately 1km square.

There should be clear passage through the map from one edge, to at least the
opposite edge. Islands and channels are not excluded.

The depth of the see bad, and sea bed to coast, should make sense, ie, sea bed
depth next to coast shouldn't be, for instance, 200m, then next to that 10m

Each grid cell should have an element how much variability there is within the
grid for the depth. For instance, a variability of 0 would be very flat, 
whereas a variability of 10 may indicate a 10m rise and fall within the grid
generated on the fly.

Global variables for sequence element ids should be prefixed by MAP_
These will be put into the global include file.

The routine should return the map sequence to me.

I will take care of the graphics handling aspect.

Any takers?

Chris

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

22. Re: The Euphoria Sub Commander project

ChrisBurch3 wrote:
> 
> I need a map generating routine, that generates a random map, with coastline
> and sea bed depths.

You could make each point in the grid represents the relative sea level,
so for land it can go as high as 20' above sea level (20) and for water
it can go as low as 600' below sea level (-600). That way you have one
value giving you land or sea. Thermocline values would not need to be
set in the grid. It could just be something like {-100,-50} to represent
the lower and upper boundaries of the layer.

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

23. Re: The Euphoria Sub Commander project

Hi CK

I know how to do it, or how it could be done (slow as I may be!). As part of 
the project, I'm just seeing if anyone else wants to get involved, while I
knit it all together.

An experiment in social engineering / team building if you will.

There will be other small requests later, eg the hydrophone (distance, tone,
etc),
and the target ship ai (that will be a fun one).

Bear in mind this is meant to be a fun, no strings, few spare cycles project,
gives me something to think about while I'm driving between jobs.

eg - the periscope view - ships distance - stretching the ship bitmap before
blitting it, rotating it for sinking, and so on.

One thing I've seen with team requests before, is that the requests have been
too broad, too vague, or the instigator has been unwilling, or unable, to put
the work in - this isn't the case here - if no-one does, I'll still do it
anyway, just for fun!

Chris

Ps - I tried long and hard to draw a submarine - just didn't look right. If
anyone else can do some original artwork, then you can have the splash screen.

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

24. Re: The Euphoria Sub Commander project

c.k.lester wrote:
> 
> ChrisBurch3 wrote:
> > 
> > I need a map generating routine, that generates a random map, with coastline
> > and sea bed depths.
> 
> You could make each point in the grid represents the relative sea level,
> so for land it can go as high as 20' above sea level (20) and for water
> it can go as low as 600' below sea level (-600). That way you have one
> value giving you land or sea. Thermocline values would not need to be
> set in the grid. It could just be something like {-100,-50} to represent
> the lower and upper boundaries of the layer.


Why don't you assign different colors to +20 to 0 would be brown and

0 to 10 would be light brown and etc.  Then when you draw a map you

could just display a color as you scan each cell in a given area.

Bernie

My files in archive:
WMOTOR, XMOTOR, W32ENGIN, MIXEDLIB, EU_ENGIN, WIN32ERU, WIN32API 

Can be downloaded here:
http://www.rapideuphoria.com/cgi-bin/asearch.exu?dos=on&win=on&lnx=on&gen=on&keywords=bernie+ryan

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

25. Re: The Euphoria Sub Commander project

Bernie Ryan wrote:
> 
> c.k.lester wrote:
> > 
> > ChrisBurch3 wrote:
> > > 
> > > I need a map generating routine, that generates a random map, with
> > > coastline
> > > and sea bed depths.
> > 
> > You could make each point in the grid represents the relative sea level,
> > so for land it can go as high as 20' above sea level (20) and for water
> > it can go as low as 600' below sea level (-600). That way you have one
> > value giving you land or sea. Thermocline values would not need to be
> > set in the grid. It could just be something like {-100,-50} to represent
> > the lower and upper boundaries of the layer.
> 
> 
> Why don't you assign different colors to +20 to 0 would be brown and
> 
> 0 to 10 would be light brown and etc.  Then when you draw a map you
> 
> could just display a color as you scan each cell in a given area.
> 
> Bernie
> 
> My files in archive:
> WMOTOR, XMOTOR, W32ENGIN, MIXEDLIB, EU_ENGIN, WIN32ERU, WIN32API 
> 
> Can be downloaded here:
> <a
> href="http://www.rapideuphoria.com/cgi-bin/asearch.exu?dos=on&win=on&lnx=on&gen=on&keywords=bernie+ryan">http://www.rapideuphoria.com/cgi-bin/asearch.exu?dos=on&win=on&lnx=on&gen=on&keywords=bernie+ryan</a>

gotta luv this forum!

Chris

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

26. Re: The Euphoria Sub Commander project

ChrisBurch2 wrote:
> 
> I know how to do it, or how it could be done (slow as I may be!).

I know... I was just thinking out loud in case I wanted to attempt to write
a map generator program. :)

> Ps - I tried long and hard to draw a submarine - just didn't look right. If
> anyone else can do some original artwork, then you can have the splash screen.

What's the screen resolution for the game?

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

27. Re: The Euphoria Sub Commander project

c.k.lester wrote:
> 
> ChrisBurch2 wrote:
> > 
> > I know how to do it, or how it could be done (slow as I may be!).
> 
> I know... I was just thinking out loud in case I wanted to attempt to write
> a map generator program. :)

go on, I know you want to, you really want to, go on ..........

> 
> > Ps - I tried long and hard to draw a submarine - just didn't look right. If
> > anyone else can do some original artwork, then you can have the splash
> > screen.
> 
> What's the screen resolution for the game?

640 * 480, but thats unimportant as far as a splash screen goes, because it
can all be resized either before, or on the fly.

Chris

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

28. Re: The Euphoria Sub Commander project

ChrisBurch3 wrote:
> 
> Hi Don
> 
> Are you using DOS routines to draw the sonar screen? Ideally you should be 
> creating a bitmap that allegro can blit to a section of the main screen.
> 
> Chris

   No I'm using Windows but I can covert it to DOS if that's what you want.

Don Cole

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

29. Re: The Euphoria Sub Commander project

ChrisBurch3 wrote:
> 
> Hi Don
> 
> Are you using DOS routines to draw the sonar screen? Ideally you should be 
> creating a bitmap that allegro can blit to a section of the main screen.
> 
> Chris

I should say I'm using a Pixmap in a Window with win32lib.ew. I could easily
   convert it to DOS. I don't really know what Allegro is.

Don Cole

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

30. Re: The Euphoria Sub Commander project

ChrisBurch3 wrote:
> c.k.lester wrote:
> > ChrisBurch2 wrote:
> > > I know how to do it, or how it could be done (slow as I may be!).
> > I know... I was just thinking out loud in case I wanted to attempt to write
> > a map generator program. :)
> go on, I know you want to, you really want to, go on ..........

HAHA. :P

Do you have the map display code yet so I can test my algorithm?

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

31. Re: The Euphoria Sub Commander project

don cole wrote:
> 
> ChrisBurch3 wrote:
> > 
> > Hi Don
> > 
> > Are you using DOS routines to draw the sonar screen? Ideally you should be 
> > creating a bitmap that allegro can blit to a section of the main screen.
> > 
> > Chris
> 
>    I should say I'm using a Pixmap in a Window with win32lib.ew. I could
>    easily
> convert it to DOS. I don't really know what Allegro is.
> 
> Don Cole

Hi Don

Allegro is the game / graphic library I'm using as the basis for the program.

It is written under windows.

The basic loop will be

while 1 do
    --move sub
    --move targets
    --move torpedoes
    --display display stuff
    --if selected display sonar by pinging for ships in line with the sonar beam
end while


Hopefully, what your module will do will take the locations of the ships, and
return the bitmap / pixmap of the entire sonar, so that the display module
can display the sonar on the relevant part of the screen. All I need your
module to do is to return a bitmap.

Hi CK

No, you're ahead of me there, give me a day or two smile

Chris

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

32. The Euphoria Sub Commander project

Hi

Added a basic console, controls yet to be added, with a screen showing,
currently, random noise. (awaiting the more intelligent map algorithm PROMISED
by CK) (no pressure like)

This will also be the screen for the sonar, and the periscope.

 From the main menu select new, and press escape to exit the console.

This is also now full screen - there will be options for full screen or
windowed later.

Chris

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

33. Re: The Euphoria Sub Commander project

ChrisBurch3 wrote:
> 
> Added a basic console, controls yet to be added, with a screen showing,
> currently, random noise. (awaiting the more intelligent map algorithm PROMISED
> by CK) (no pressure like)

Uh oh! I'm outta town for a few days and will send you what I have when I
return. :)

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

34. Re: The Euphoria Sub Commander project

c.k.lester wrote:
> 
> ChrisBurch3 wrote:
> > 
> > Added a basic console, controls yet to be added, with a screen showing,
> > currently, random noise. (awaiting the more intelligent map algorithm
> > PROMISED
> > by CK) (no pressure like)
> 
> Uh oh! I'm outta town for a few days and will send you what I have when I
> return. :)

No problem.

This is being deducted from your wages.

Chris smile

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

Search



Quick Links

User menu

Not signed in.

Misc Menu