Traveller Store CotI Features New Posts Mark Forums Read Register

Go Back > Citizens of the Imperium > General Traveller Discussions > Software Solutions

Software Solutions Discussions on Traveller related software.

Thread Tools Display Modes
Old October 17th, 2017, 04:23 PM
robject's Avatar
robject robject is offline
Join Date: Mar 2002
Posts: 13,803
Gallery : 9
Visit robject's Blog
robject has disabled reputation
Default T5 Spec Cargo

I'm designing the speculative cargo code.

I don't want it to be too clever, but I need it to handle the rules.

I think building the cargo is easy, and in fact it seems like a CargoBuilder is in order here. Let me give you an example.

Speculative cargo in Traveller is sold based on the source world's trade codes, and potentially other modifiers (like whether or not a broker is available and contracted for example). If I packed all of this into a constructor, it would be a big honking constructor. On the other hand, a Builder pattern lets me chunk construction into e.g. chained methods ("fluent interface").

Cargo cargo = CargoBuilder.newCargo().isNa().isRi().build();
In fact, I should be doing this with world data, ship data, and player data as well, but I currently don't.

Of course it won't work that way. It will iterate over trade code strings.
I could just hand the trade codes in a string to the builder.

Cargo cargo = "Na Ni Po De" );
Imperiallines magazine
My Helpful Stuff for Traveller5
IMTU tc+ t5++ 3i(+) au ls+ / OTU 44% an+ dt+ ge- j- jf+ n- pi+ pp+ tr+ tv- uwp+ xb+
Tools Link

Last edited by robject; October 17th, 2017 at 04:50 PM..
Reply With Quote

To see more of this thread, please login or register.


Thread Tools
Display Modes

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 On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Huge Wealth from Spec Trading PsiTraveller Mongoose Traveller 36 May 5th, 2015 03:56 AM
Family grav car spec Andrew Boulton Imperial Research Station 26 April 12th, 2011 04:18 AM

This website and its contents are copyright ©2010-2013 Far Future Enterprises. All rights reserved. Traveller is a registered trademark of Far Future Enterprises .
Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
Copyright (c) 2010-2013, Far Future Enterprises. All Rights Reserved.