From: Michael A. <out...@gm...> - 2013-08-28 20:52:18
|
Here's what I ended up with so far: compA is the private investor compB is the company to check to see if there is a connection with PublicCompanyI compA = operatingCompany.get(); ... NetworkGraphBuilder nwGraph = NetworkGraphBuilder.create(gameManager); NetworkCompanyGraph companyGraph = NetworkCompanyGraph.create(nwGraph, compA); SimpleGraph<NetworkVertex, NetworkEdge> graph = companyGraph.createRouteGraph(true); Set<NetworkVertex> verticies = graph.vertexSet(); ... for (TokenI token : compB.getTokens()) { TokenHolder holder = token.getHolder(); if (!(holder instanceof Stop)) continue; Stop city = (Stop) holder; Station station = city.getRelatedStation(); for (NetworkVertex vert : verticies) { if (vert.getType() == NetworkVertex.VertexType.STATION) { Station vertStation = vert.getStation(); if (station == vertStation) { // There is a link between the companies! Hooray! } } } } ... This seems to work for simple cases, however, I suspect (without digging too much) that it will get blocked by tokens, which I can't have. I bet it won't be too hard to fix, tho. Mike On Wed, Aug 28, 2013 at 2:38 PM, brett lentz <bre...@gm...> wrote: > In order to do tile rotations, there is already logic that is aware of the > "exits" of a tile. There's also the route suggestion code. > > It might be possible to leverage that same code to create a route graph > that enables detection of destination runs. > > It probably needs a fair bit of work to adapt for this purpose, but those > are at least places in the code to start looking. > > ---Brett. > > > ---Brett. > > > On Wed, Aug 28, 2013 at 9:50 AM, Chris Shaffer <chr...@gm...>wrote: > >> There are games where tokens do block destinations, so whatever code >> you write should allow for that possibility. There are also games >> where connections are considered complete as soon as the tile is laid, >> and others where the check occurs during the relevant company's >> operating turn. >> >> -- >> Chris >> >> Please consider the environment before printing this e-mail. >> >> >> On Wed, Aug 28, 2013 at 6:35 AM, Michael Alexander >> <out...@gm...> wrote: >> > Both Major Companies in 1856 and Foreign Investors in 1880 have the >> idea of >> > needing to reach a destination. Both are implemented by having the game >> > player use a special action to tell the game engine that a connection >> has >> > taken place. Once the connection exists, some one time event occurs. >> It >> > seems like if there is code that could be used to determine if a >> connection >> > exists, the game could automatically determine that without relying on >> the >> > player to tell it. >> > >> > So I actually want something slightly different than what I said. It's >> not >> > that the current company can make a run between two hexes that I want to >> > know, it's that a connection exists (regardless of tokens). >> > >> > Mike >> > >> > >> > On Wed, Aug 28, 2013 at 9:28 AM, Chris Shaffer <chr...@gm... >> > >> > wrote: >> >> >> >> Would this be for games where companies are limited to building track >> >> where their trains can actually reach, or some other purpose? >> >> >> >> -- >> >> Chris >> >> >> >> Please consider the environment before printing this e-mail. >> >> >> >> >> >> On Tue, Aug 27, 2013 at 11:24 PM, Michael Alexander >> >> <out...@gm...> wrote: >> >> > Everyone, >> >> > >> >> > I'd like to add a check to see if the currently operating company >> >> > can >> >> > run from specific MapHex to another. It seems like there should be a >> >> > way to >> >> > do this, since a similar calculation would have to be made when >> >> > determining >> >> > what MapHexs are eligible to have a tile placed, but I can't seem to >> >> > figure >> >> > out how to do it. What am I missing? >> >> > >> >> > Thanks, >> >> > >> >> > Michael Alexander >> >> > >> >> > >> >> > >> ------------------------------------------------------------------------------ >> >> > Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, >> more! >> >> > Discover the easy way to master current and previous Microsoft >> >> > technologies >> >> > and advance your career. Get an incredible 1,500+ hours of >> step-by-step >> >> > tutorial videos with LearnDevNow. Subscribe today and save! >> >> > >> >> > >> http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk >> >> > _______________________________________________ >> >> > Rails-devel mailing list >> >> > Rai...@li... >> >> > https://lists.sourceforge.net/lists/listinfo/rails-devel >> >> > >> >> >> >> >> >> >> ------------------------------------------------------------------------------ >> >> Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more! >> >> Discover the easy way to master current and previous Microsoft >> >> technologies >> >> and advance your career. Get an incredible 1,500+ hours of step-by-step >> >> tutorial videos with LearnDevNow. Subscribe today and save! >> >> >> >> >> http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk >> >> _______________________________________________ >> >> Rails-devel mailing list >> >> Rai...@li... >> >> https://lists.sourceforge.net/lists/listinfo/rails-devel >> > >> > >> > >> > >> ------------------------------------------------------------------------------ >> > Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more! >> > Discover the easy way to master current and previous Microsoft >> technologies >> > and advance your career. Get an incredible 1,500+ hours of step-by-step >> > tutorial videos with LearnDevNow. Subscribe today and save! >> > >> http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk >> > _______________________________________________ >> > Rails-devel mailing list >> > Rai...@li... >> > https://lists.sourceforge.net/lists/listinfo/rails-devel >> > >> >> >> ------------------------------------------------------------------------------ >> Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more! >> Discover the easy way to master current and previous Microsoft >> technologies >> and advance your career. Get an incredible 1,500+ hours of step-by-step >> tutorial videos with LearnDevNow. Subscribe today and save! >> >> http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk >> _______________________________________________ >> Rails-devel mailing list >> Rai...@li... >> https://lists.sourceforge.net/lists/listinfo/rails-devel >> > > > > ------------------------------------------------------------------------------ > Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more! > Discover the easy way to master current and previous Microsoft technologies > and advance your career. Get an incredible 1,500+ hours of step-by-step > tutorial videos with LearnDevNow. Subscribe today and save! > http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk > _______________________________________________ > Rails-devel mailing list > Rai...@li... > https://lists.sourceforge.net/lists/listinfo/rails-devel > > |