You can subscribe to this list here.
2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(3) |
Nov
(46) |
Dec
(57) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2009 |
Jan
(51) |
Feb
(10) |
Mar
|
Apr
|
May
(14) |
Jun
|
Jul
(13) |
Aug
(30) |
Sep
(83) |
Oct
(56) |
Nov
(148) |
Dec
(107) |
2010 |
Jan
(260) |
Feb
(164) |
Mar
(183) |
Apr
(99) |
May
(160) |
Jun
(40) |
Jul
(33) |
Aug
(48) |
Sep
(22) |
Oct
(24) |
Nov
(1) |
Dec
(12) |
2011 |
Jan
(6) |
Feb
(15) |
Mar
(13) |
Apr
(37) |
May
(27) |
Jun
(29) |
Jul
(33) |
Aug
(20) |
Sep
(17) |
Oct
(20) |
Nov
(33) |
Dec
(17) |
2012 |
Jan
(39) |
Feb
(38) |
Mar
(20) |
Apr
(21) |
May
(17) |
Jun
(22) |
Jul
(16) |
Aug
(3) |
Sep
(9) |
Oct
(10) |
Nov
|
Dec
|
From: Stefan F. <ste...@us...> - 2010-05-26 19:49:06
|
Update of /cvsroot/rails/18xx/rails/game/specific/_18AL In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv2064/rails/game/specific/_18AL Modified Files: OperatingRound_18AL.java NamedTrainRevenueModifier.java Log Message: Added optimizing option for named trains in 18AL Index: OperatingRound_18AL.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/specific/_18AL/OperatingRound_18AL.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** OperatingRound_18AL.java 7 Oct 2009 19:00:38 -0000 1.7 --- OperatingRound_18AL.java 26 May 2010 19:48:57 -0000 1.8 *************** *** 18,22 **** @Override protected void setGameSpecificPossibleActions() { ! for (NameTrains stl : getSpecialProperties(NameTrains.class)) { List<TrainI> trains = --- 18,24 ---- @Override protected void setGameSpecificPossibleActions() { ! // if optimized no need to assign ! if (getGameOption("18ALOptimizeNamedTrains").equalsIgnoreCase("yes")) return; ! for (NameTrains stl : getSpecialProperties(NameTrains.class)) { List<TrainI> trains = Index: NamedTrainRevenueModifier.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/specific/_18AL/NamedTrainRevenueModifier.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** NamedTrainRevenueModifier.java 20 May 2010 19:57:01 -0000 1.1 --- NamedTrainRevenueModifier.java 26 May 2010 19:48:57 -0000 1.2 *************** *** 1,14 **** package rails.game.specific._18AL; import rails.algorithms.NetworkTrain; import rails.algorithms.NetworkVertex; import rails.algorithms.RevenueAdapter; import rails.algorithms.RevenueBonus; import rails.algorithms.RevenueStaticModifier; import rails.game.TrainI; ! public class NamedTrainRevenueModifier implements RevenueStaticModifier { public void modifyCalculator(RevenueAdapter revenueAdapter) { // 1. check all Trains for name Tokens --- 1,38 ---- package rails.game.specific._18AL; + import java.util.ArrayList; + import java.util.List; + import rails.algorithms.NetworkTrain; import rails.algorithms.NetworkVertex; import rails.algorithms.RevenueAdapter; import rails.algorithms.RevenueBonus; + import rails.algorithms.RevenueDynamicModifier; import rails.algorithms.RevenueStaticModifier; + import rails.algorithms.RevenueTrainRun; + import rails.game.ConfigurableComponentI; + import rails.game.ConfigurationException; + import rails.game.GameManagerI; import rails.game.TrainI; + import rails.util.Tag; ! public class NamedTrainRevenueModifier implements RevenueStaticModifier, RevenueDynamicModifier, ConfigurableComponentI { + private boolean dynamic; + private List<RevenueBonus> bonuses; + private int bonusMaximum; + + public void configureFromXML(Tag tag) throws ConfigurationException { + // do nothing + } + + public void finishConfiguration(GameManagerI parent) + throws ConfigurationException { + dynamic = parent.getGameOption("18ALOptimizeNamedTrains").equalsIgnoreCase("yes"); + } + public void modifyCalculator(RevenueAdapter revenueAdapter) { + // static modifier + if (dynamic) return; // 1. check all Trains for name Tokens *************** *** 29,31 **** --- 53,114 ---- } + public boolean prepareModifier(RevenueAdapter revenueAdapter) { + // dynamic modifier + if (!dynamic) return false; + + // 1. check if name trains special properties is available + List<NameTrains> sp = revenueAdapter.getCompany().getPortfolio().getSpecialProperties(NameTrains.class, false); + if (sp.isEmpty()) return false; + + // 2. prepare by defining the vertices + bonuses = new ArrayList<RevenueBonus>(); + bonusMaximum = 0; + // 3. there is only one special property in 18AL, thus get tokens from it + for (NamedTrainToken token:sp.get(0).getTokens()) { + RevenueBonus bonus = new RevenueBonus(token.getValue(), token.getLongName()); + // 4. define vertices + for (NetworkVertex vertex:NetworkVertex.getVerticesByHexes(revenueAdapter.getVertices(), token.getHexesToPass())) { + if (!vertex.isStation()) continue; + bonus.addVertex(vertex); + } + bonuses.add(bonus); + bonusMaximum += token.getValue(); + } + return true; + } + + public int predictionValue(RevenueAdapter revenueAdapter) { + return bonusMaximum; + } + + public int evaluationValue(RevenueAdapter revenueAdapter) { + List<RevenueTrainRun> runs = revenueAdapter.getCurrentRun(); + int bonusValue = 0; + // due to the geography each train can only score one bonus + for (RevenueBonus bonus:bonuses) { + for (RevenueTrainRun run:runs) { + if (run.getUniqueVertices().containsAll(bonus.getVertices())) { + bonusValue += bonus.getValue(); + continue; // each bonus can only be scored once + } + } + } + return bonusValue; + } + + public String prettyPrint(RevenueAdapter revenueAdapter) { + List<RevenueTrainRun> runs = revenueAdapter.getOptimalRun(); + StringBuffer prettyPrint = new StringBuffer(); + for (RevenueBonus bonus:bonuses) { + for (RevenueTrainRun run:runs) { + if (run.getUniqueVertices().containsAll(bonus.getVertices())) { + prettyPrint.append(bonus.getName() + ": " + bonus.getValue() + "\n"); + continue; // each bonus can only be scored once + } + } + } + return prettyPrint.toString(); + } + + } |
From: Stefan F. <ste...@us...> - 2010-05-26 19:49:06
|
Update of /cvsroot/rails/18xx In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv2064 Modified Files: LocalisedText.properties Log Message: Added optimizing option for named trains in 18AL Index: LocalisedText.properties =================================================================== RCS file: /cvsroot/rails/18xx/LocalisedText.properties,v retrieving revision 1.134 retrieving revision 1.135 diff -C2 -d -r1.134 -r1.135 *** LocalisedText.properties 24 May 2010 20:37:58 -0000 1.134 --- LocalisedText.properties 26 May 2010 19:48:57 -0000 1.135 *************** *** 2,5 **** --- 2,6 ---- 1889PrivateBactive=Player {0} (owner of Private B) may lay port tile 1889PrivateCactive=Player {0} (previous owner of Private C) may lay tile on C4 immediately + 18ALOptimizeNamedTrains=Optimize named token assignment ActionNotAllowed=Action {0} is not allowed ALL=All |
From: Stefan F. <ste...@us...> - 2010-05-25 20:34:08
|
Update of /cvsroot/rails/18xx/rails/algorithms In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv16343/rails/algorithms Modified Files: RevenueCalculator.java RevenueTrainRun.java Log Message: Minor fixes to the revenue calculator Index: RevenueCalculator.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/algorithms/RevenueCalculator.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** RevenueCalculator.java 20 May 2010 23:13:21 -0000 1.16 --- RevenueCalculator.java 25 May 2010 20:33:58 -0000 1.17 *************** *** 291,295 **** maxMinorRevenues = new int[nbTrains][nbVertexes]; maxBonusRevenues = new int[nbTrains][nbVertexes + nbBonuses]; - int cumulatedRevenues = 0; for (int t=startTrain; t <= finalTrain; t++) { int[] majorValues = new int[nbVertexes]; --- 291,294 ---- *************** *** 318,324 **** maxMinorRevenues[t] = bestRevenues(minorValues, trainMaxMinors[t]); maxBonusRevenues[t] = bestRevenues(bonusValues, trainMaxBonuses[t]); ! cumulatedRevenues += maxMajorRevenues[t][trainMaxMajors[t]] + maxMinorRevenues[t][trainMaxMinors[t]] + maxBonusRevenues[t][trainMaxBonuses[t]]; ! maxCumulatedTrainRevenues[t] = cumulatedRevenues; } log.info("maxMajorRevenues = " + Arrays.deepToString(maxMajorRevenues)); --- 317,324 ---- maxMinorRevenues[t] = bestRevenues(minorValues, trainMaxMinors[t]); maxBonusRevenues[t] = bestRevenues(bonusValues, trainMaxBonuses[t]); ! // initially the cumulated train revenues are the individual run revenues ! int trainRevenues = maxMajorRevenues[t][trainMaxMajors[t]] + maxMinorRevenues[t][trainMaxMinors[t]] + maxBonusRevenues[t][trainMaxBonuses[t]]; ! maxCumulatedTrainRevenues[t] = trainRevenues; } log.info("maxMajorRevenues = " + Arrays.deepToString(maxMajorRevenues)); Index: RevenueTrainRun.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/algorithms/RevenueTrainRun.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** RevenueTrainRun.java 24 May 2010 20:37:17 -0000 1.7 --- RevenueTrainRun.java 25 May 2010 20:33:58 -0000 1.8 *************** *** 113,117 **** int majors = NetworkVertex.numberOfVertexType(uniqueVertices, VertexType.STATION, StationType.MAJOR); int minors = NetworkVertex.numberOfVertexType(uniqueVertices, VertexType.STATION, StationType.MINOR); ! if (train.ignoresMinors()) { runPrettyPrint.append(LocalText.getText("RevenueStationsIgnoreMinors", majors)); } else { --- 113,117 ---- int majors = NetworkVertex.numberOfVertexType(uniqueVertices, VertexType.STATION, StationType.MAJOR); int minors = NetworkVertex.numberOfVertexType(uniqueVertices, VertexType.STATION, StationType.MINOR); ! if (train.ignoresMinors() || minors == 0) { runPrettyPrint.append(LocalText.getText("RevenueStationsIgnoreMinors", majors)); } else { |
From: Erik V. <ev...@us...> - 2010-05-25 20:27:25
|
Update of /cvsroot/rails/18xx/rails/game In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv15090/rails/game Modified Files: Round.java StockRound.java PublicCompany.java Log Message: 18EU bankruptcy rules (Phase 4) - making a restarted company actually operate (!) Index: PublicCompany.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/PublicCompany.java,v retrieving revision 1.98 retrieving revision 1.99 diff -C2 -d -r1.98 -r1.99 *** PublicCompany.java 24 May 2010 11:42:35 -0000 1.98 --- PublicCompany.java 25 May 2010 20:27:17 -0000 1.99 *************** *** 871,875 **** hasStarted.set(true); if (hasStockPrice) buyable.set(true); ! if (startSpace != null) { setParSpace(startSpace); --- 871,878 ---- hasStarted.set(true); if (hasStockPrice) buyable.set(true); ! ! // In case of a restart: undo closing ! if (closedObject.booleanValue()) closedObject.set(false); ! if (startSpace != null) { setParSpace(startSpace); *************** *** 878,882 **** } ! if (homeBaseTokensLayTime == WHEN_STARTED) { layHomeBaseTokens(); } --- 881,886 ---- } ! ! if (homeBaseTokensLayTime == WHEN_STARTED) { layHomeBaseTokens(); } Index: Round.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/Round.java,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** Round.java 15 May 2010 16:36:09 -0000 1.41 --- Round.java 25 May 2010 20:27:17 -0000 1.42 *************** *** 114,117 **** --- 114,125 ---- return gameManager.getNumberOfPlayers(); } + + protected int getNumberOfActivePlayers () { + int number = 0; + for (Player player : getPlayers()) { + if (!player.isBankrupt()) number++; + } + return number; + } public PhaseI getCurrentPhase() { Index: StockRound.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/StockRound.java,v retrieving revision 1.73 retrieving revision 1.74 diff -C2 -d -r1.73 -r1.74 *** StockRound.java 9 Apr 2010 21:26:12 -0000 1.73 --- StockRound.java 25 May 2010 20:27:17 -0000 1.74 *************** *** 1224,1228 **** } ! if (numPasses.intValue() >= numberOfPlayers) { ReportBuffer.add(LocalText.getText("END_SR", --- 1224,1228 ---- } ! if (numPasses.intValue() >= getNumberOfActivePlayers()) { ReportBuffer.add(LocalText.getText("END_SR", |
From: Stefan F. <ste...@us...> - 2010-05-25 19:38:40
|
Update of /cvsroot/rails/18xx/rails/game/specific/_18AL In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv7719/rails/game/specific/_18AL Modified Files: AssignNamedTrains.java Log Message: Fixed 18AL issues: Double scoring of 4D and save of named trains Index: AssignNamedTrains.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/specific/_18AL/AssignNamedTrains.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** AssignNamedTrains.java 31 Jan 2010 22:22:32 -0000 1.7 --- AssignNamedTrains.java 25 May 2010 19:38:30 -0000 1.8 *************** *** 96,99 **** --- 96,109 ---- public void setPostTrainPerToken(List<NameableTrain> postTokensPerTrain) { this.postTrainPerToken = postTokensPerTrain; + // convert to postTrainIds + if (postTokensPerTrain != null) { + for (NameableTrain train : postTokensPerTrain) { + if (train == null) { + postTrainIds[postTokensPerTrain.indexOf(train)] = null; + } else { + postTrainIds[postTokensPerTrain.indexOf(train)] = train.getUniqueId(); + } + } + } } *************** *** 117,121 **** for (String trainId : preTrainIds) { if (trainId != null && trainId.length() > 0) { ! preTrainPerToken.add((NameableTrain) Token.getByUniqueId(trainId)); } else { preTrainPerToken.add(null); --- 127,132 ---- for (String trainId : preTrainIds) { if (trainId != null && trainId.length() > 0) { ! // preTrainPerToken.add((NameableTrain) Token.getByUniqueId(trainId)); ! preTrainPerToken.add((NameableTrain) trainManager.getTrainByUniqueId(trainId)); } else { preTrainPerToken.add(null); *************** *** 128,132 **** for (String trainId : postTrainIds) { if (trainId != null && trainId.length() > 0) { ! postTrainPerToken.add((NameableTrain) Token.getByUniqueId(trainId)); } else { postTrainPerToken.add(null); --- 139,144 ---- for (String trainId : postTrainIds) { if (trainId != null && trainId.length() > 0) { ! // postTrainPerToken.add((NameableTrain) Token.getByUniqueId(trainId)); ! postTrainPerToken.add((NameableTrain) trainManager.getTrainByUniqueId(trainId)); } else { postTrainPerToken.add(null); |
From: Stefan F. <ste...@us...> - 2010-05-25 19:38:39
|
Update of /cvsroot/rails/18xx/data/18AL In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv7719/data/18AL Modified Files: Game.xml Log Message: Fixed 18AL issues: Double scoring of 4D and save of named trains Index: Game.xml =================================================================== RCS file: /cvsroot/rails/18xx/data/18AL/Game.xml,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** Game.xml 23 May 2010 18:10:44 -0000 1.31 --- Game.xml 25 May 2010 19:38:30 -0000 1.32 *************** *** 69,73 **** </IfOption> <Reach countTowns="no"/> ! <Score cities="double"/> <Exchange cost="800"/> </Train> --- 69,73 ---- </IfOption> <Reach countTowns="no"/> ! <Score scoreCities="double"/> <Exchange cost="800"/> </Train> |
From: Stefan F. <ste...@us...> - 2010-05-24 20:38:06
|
Update of /cvsroot/rails/18xx In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv31059 Modified Files: LocalisedText.properties Log Message: Update localisedText Index: LocalisedText.properties =================================================================== RCS file: /cvsroot/rails/18xx/LocalisedText.properties,v retrieving revision 1.133 retrieving revision 1.134 diff -C2 -d -r1.133 -r1.134 *** LocalisedText.properties 18 May 2010 04:13:03 -0000 1.133 --- LocalisedText.properties 24 May 2010 20:37:58 -0000 1.134 *************** *** 406,409 **** --- 406,410 ---- PrivateIsNotOwnedByAPlayer=Private {0} is not owned by a player Public=Public + Pullman=Pullman-Car QUIT=Quit RandomizePlayers=Randomize Order *************** *** 416,419 **** --- 417,422 ---- REPORT=Report Window REVENUE=Revenue + RevenueStations=, Cities = {0}, Towns = {1} + RevenueStationsIgnoreMinors=, Cities = {0} ReceivesFor={0} receives {1} for {2}. RevenueWithNoTrains={0} owns no trains, so revenue is {1}. |
From: Stefan F. <ste...@us...> - 2010-05-24 20:37:26
|
Update of /cvsroot/rails/18xx/rails/algorithms In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv30941/rails/algorithms Modified Files: RevenueTrainRun.java NetworkVertex.java Log Message: Some minor improvements to pretty print Index: NetworkVertex.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/algorithms/NetworkVertex.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** NetworkVertex.java 23 May 2010 18:10:44 -0000 1.16 --- NetworkVertex.java 24 May 2010 20:37:17 -0000 1.17 *************** *** 31,34 **** --- 31,38 ---- HQ, } + public static enum StationType { + MAJOR, + MINOR + } // vertex types and flag for virtual (thus not related to a rails object) *************** *** 40,45 **** // general vertex properties ! private boolean major = false; ! private boolean minor = false; private int value = 0; private boolean sink = false; --- 44,48 ---- // general vertex properties ! private StationType stationType; private int value = 0; private boolean sink = false; *************** *** 107,111 **** void addToRevenueCalculator(RevenueCalculator rc, int vertexId) { ! rc.setVertex(vertexId, major, minor, sink); } --- 110,114 ---- void addToRevenueCalculator(RevenueCalculator rc, int vertexId) { ! rc.setVertex(vertexId, isMajor(), isMinor(), sink); } *************** *** 141,160 **** } - public boolean isMajor(){ ! return major; ! } ! ! public NetworkVertex setMajor(boolean major) { ! this.major = major; ! return this; } public boolean isMinor(){ ! return minor; } ! public NetworkVertex setMinor(boolean minor) { ! this.minor = minor; return this; } --- 144,161 ---- } public boolean isMajor(){ ! return (stationType != null && stationType == StationType.MAJOR); } public boolean isMinor(){ ! return (stationType != null && stationType == StationType.MINOR); ! } ! ! public StationType getStationType() { ! return stationType; } ! public NetworkVertex setStationType(StationType stationType) { ! this.stationType = stationType; return this; } *************** *** 166,172 **** public int getValueByTrain(NetworkTrain train) { int valueByTrain; ! if (major) { valueByTrain = value * train.getMultiplyMajors(); ! } else if (minor) { if (train.ignoresMinors()) { valueByTrain = 0; --- 167,173 ---- public int getValueByTrain(NetworkTrain train) { int valueByTrain; ! if (isMajor()) { valueByTrain = value * train.getMultiplyMajors(); ! } else if (isMinor()) { if (train.ignoresMinors()) { valueByTrain = 0; *************** *** 219,224 **** return side; } ! ! /** * Initialize for rails vertexes --- 220,228 ---- return side; } ! ! public boolean isOfType(VertexType vertexType, StationType stationType) { ! return (type == vertexType && (!isStation() || getStationType() == stationType)); ! } ! /** * Initialize for rails vertexes *************** *** 232,239 **** // check if it is a major or minor if (station.getType().equals(Station.CITY) || station.getType().equals(Station.OFF_MAP_AREA)) { ! major = true; } else if (station.getType().equals(Station.TOWN) || station.getType().equals(Station.PORT) || station.getType().equals(Station.HALT)) { ! minor = true; } --- 236,243 ---- // check if it is a major or minor if (station.getType().equals(Station.CITY) || station.getType().equals(Station.OFF_MAP_AREA)) { ! setStationType(StationType.MAJOR); } else if (station.getType().equals(Station.TOWN) || station.getType().equals(Station.PORT) || station.getType().equals(Station.HALT)) { ! setStationType(StationType.MINOR); } *************** *** 304,307 **** --- 308,321 ---- } + public static void initAllRailsVertices(Collection<NetworkVertex> vertices, + PublicCompanyI company, PhaseI phase) { + for (NetworkVertex v:vertices) { + if (company != null) + v.initRailsVertex(company); + if (phase != null) + v.setRailsVertexValue(phase); + } + } + /** * Returns the maximum positive value (lower bound zero) *************** *** 315,326 **** } ! public static void initAllRailsVertices(Collection<NetworkVertex> vertices, ! PublicCompanyI company, PhaseI phase) { ! for (NetworkVertex v:vertices) { ! if (company != null) ! v.initRailsVertex(company); ! if (phase != null) ! v.setRailsVertexValue(phase); } } --- 329,343 ---- } ! ! /** ! * Returns the number of specified vertex type in a vertex collection ! * If station then specify station type ! */ ! public static int numberOfVertexType(Collection<NetworkVertex> vertices, VertexType vertexType, StationType stationType) { ! int number = 0; ! for (NetworkVertex vertex:vertices) { ! if (vertex.isOfType(vertexType, stationType)) number++; } + return number; } *************** *** 333,338 **** NetworkVertex newVertex = NetworkVertex.getVirtualVertex(vertex.type, newIdentifier); // copy values ! newVertex.major = vertex.major; ! newVertex.minor = vertex.minor; newVertex.value = vertex.value; newVertex.sink = vertex.sink; --- 350,354 ---- NetworkVertex newVertex = NetworkVertex.getVirtualVertex(vertex.type, newIdentifier); // copy values ! newVertex.stationType = vertex.stationType; newVertex.value = vertex.value; newVertex.sink = vertex.sink; Index: RevenueTrainRun.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/algorithms/RevenueTrainRun.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** RevenueTrainRun.java 24 May 2010 07:49:26 -0000 1.6 --- RevenueTrainRun.java 24 May 2010 20:37:17 -0000 1.7 *************** *** 4,13 **** --- 4,18 ---- import java.awt.geom.Point2D; import java.util.ArrayList; + import java.util.HashSet; import java.util.List; import java.util.Map; + import java.util.Set; import org.apache.log4j.Logger; + import rails.algorithms.NetworkVertex.StationType; + import rails.algorithms.NetworkVertex.VertexType; import rails.ui.swing.hexmap.HexMap; + import rails.util.LocalText; /** *************** *** 20,23 **** --- 25,29 ---- private static final int PRETTY_PRINT_LENGTH = 100; + private static final int PRETTY_PRINT_INDENT = 10; protected static Logger log = *************** *** 37,44 **** } ! public List<NetworkVertex> getVertices() { return vertices; } public NetworkTrain getTrain() { return train; --- 43,54 ---- } ! public List<NetworkVertex> getRunVertices() { return vertices; } + public Set<NetworkVertex> getUniqueVertices() { + return new HashSet<NetworkVertex>(vertices); + } + public NetworkTrain getTrain() { return train; *************** *** 61,64 **** --- 71,84 ---- return value; } + + boolean hasButtomRun() { + boolean buttomRun = false; + NetworkVertex startVertex = null; + for (NetworkVertex vertex:vertices) { + if (startVertex == vertex) buttomRun = true; + if (startVertex == null) startVertex = vertex; + } + return buttomRun; + } void addVertex(NetworkVertex vertex) { *************** *** 75,82 **** private int prettyPrintNewLine(StringBuffer runPrettyPrint, int multiple, int initLength) { ! if (runPrettyPrint.length() / PRETTY_PRINT_LENGTH != multiple) { ! multiple = runPrettyPrint.length() / PRETTY_PRINT_LENGTH; runPrettyPrint.append("\n"); ! for (int i=0; i < initLength; i++) runPrettyPrint.append(" ") ; } --- 95,103 ---- private int prettyPrintNewLine(StringBuffer runPrettyPrint, int multiple, int initLength) { ! int length = runPrettyPrint.length() - initLength; ! if (length / PRETTY_PRINT_LENGTH != multiple) { ! multiple = length / PRETTY_PRINT_LENGTH; runPrettyPrint.append("\n"); ! for (int i=0; i < PRETTY_PRINT_INDENT; i++) runPrettyPrint.append(" ") ; } *************** *** 86,92 **** String prettyPrint() { StringBuffer runPrettyPrint = new StringBuffer(); ! runPrettyPrint.append("Train " + train + ": " + getRunValue() + " -> "); int initLength = runPrettyPrint.length(); ! int multiple = runPrettyPrint.length() / PRETTY_PRINT_LENGTH; String currentHexName = null; NetworkVertex startVertex = null; --- 107,124 ---- String prettyPrint() { StringBuffer runPrettyPrint = new StringBuffer(); ! runPrettyPrint.append(LocalText.getText("N_Train", train.toString())); ! runPrettyPrint.append(": " + getRunValue()); ! ! Set<NetworkVertex> uniqueVertices = getUniqueVertices(); ! int majors = NetworkVertex.numberOfVertexType(uniqueVertices, VertexType.STATION, StationType.MAJOR); ! int minors = NetworkVertex.numberOfVertexType(uniqueVertices, VertexType.STATION, StationType.MINOR); ! if (train.ignoresMinors()) { ! runPrettyPrint.append(LocalText.getText("RevenueStationsIgnoreMinors", majors)); ! } else { ! runPrettyPrint.append(LocalText.getText("RevenueStations", majors, minors)); ! } ! int initLength = runPrettyPrint.length(); ! int multiple = prettyPrintNewLine(runPrettyPrint, -1, initLength); String currentHexName = null; NetworkVertex startVertex = null; |
From: Stefan F. <ste...@us...> - 2010-05-24 20:37:26
|
Update of /cvsroot/rails/18xx/rails/game/specific/_18EU In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv30941/rails/game/specific/_18EU Modified Files: OffBoardRevenueModifier.java PullmanRevenueModifier.java Log Message: Some minor improvements to pretty print Index: PullmanRevenueModifier.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/specific/_18EU/PullmanRevenueModifier.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PullmanRevenueModifier.java 21 May 2010 16:15:24 -0000 1.2 --- PullmanRevenueModifier.java 24 May 2010 20:37:17 -0000 1.3 *************** *** 9,12 **** --- 9,13 ---- import rails.algorithms.RevenueDynamicModifier; import rails.algorithms.RevenueTrainRun; + import rails.util.LocalText; public class PullmanRevenueModifier implements RevenueDynamicModifier { *************** *** 39,43 **** int maximum = 0; for (RevenueTrainRun trainRun:trainRuns) { ! maximum = Math.max(maximum, maximumMajorValue(trainRun.getVertices())); if (maximum == maxValue) break; } --- 40,44 ---- int maximum = 0; for (RevenueTrainRun trainRun:trainRuns) { ! maximum = Math.max(maximum, maximumMajorValue(trainRun.getRunVertices())); if (maximum == maxValue) break; } *************** *** 50,54 **** public String prettyPrint(RevenueAdapter revenueAdapter) { ! return "Pullman: " + pullmanValue(revenueAdapter.getOptimalRun()); } --- 51,55 ---- public String prettyPrint(RevenueAdapter revenueAdapter) { ! return LocalText.getText("Pullman") + ": " + pullmanValue(revenueAdapter.getOptimalRun()); } Index: OffBoardRevenueModifier.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/specific/_18EU/OffBoardRevenueModifier.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** OffBoardRevenueModifier.java 24 May 2010 07:49:26 -0000 1.4 --- OffBoardRevenueModifier.java 24 May 2010 20:37:17 -0000 1.5 *************** *** 74,78 **** for (NetworkVertex offB:destOffBoard) { for (NetworkVertex base:bases) { ! RevenueBonus bonus = new RevenueBonus(bonusValue, "OFFBOARD"); bonus.addVertex(offA); bonus.addVertex(offB); bonus.addVertex(base); revenueAdapter.addRevenueBonus(bonus); --- 74,78 ---- for (NetworkVertex offB:destOffBoard) { for (NetworkVertex base:bases) { ! RevenueBonus bonus = new RevenueBonus(bonusValue, "Red-To-Red"); bonus.addVertex(offA); bonus.addVertex(offB); bonus.addVertex(base); revenueAdapter.addRevenueBonus(bonus); |
From: Stefan F. <ste...@us...> - 2010-05-24 20:37:25
|
Update of /cvsroot/rails/18xx/rails/game/specific/_1851 In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv30941/rails/game/specific/_1851 Modified Files: OffBoardRevenueModifier.java Log Message: Some minor improvements to pretty print Index: OffBoardRevenueModifier.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/specific/_1851/OffBoardRevenueModifier.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** OffBoardRevenueModifier.java 24 May 2010 07:49:26 -0000 1.2 --- OffBoardRevenueModifier.java 24 May 2010 20:37:17 -0000 1.3 *************** *** 34,42 **** destOffBoard.remove(offA); for (NetworkVertex offB:destOffBoard) { ! bonus = new RevenueBonus(2*BONUS_VALUE, "OFFBOARD"); bonus.addVertex(offA); bonus.addVertex(offB);; revenueAdapter.addRevenueBonus(bonus); for (NetworkVertex station:otherStations) { ! bonus = new RevenueBonus(BONUS_VALUE, "OFFBOARD"); bonus.addVertex(offA); bonus.addVertex(offB); bonus.addVertex(station); revenueAdapter.addRevenueBonus(bonus); --- 34,42 ---- destOffBoard.remove(offA); for (NetworkVertex offB:destOffBoard) { ! bonus = new RevenueBonus(2*BONUS_VALUE, "Red-To-Red"); bonus.addVertex(offA); bonus.addVertex(offB);; revenueAdapter.addRevenueBonus(bonus); for (NetworkVertex station:otherStations) { ! bonus = new RevenueBonus(BONUS_VALUE, "Red-To-Red"); bonus.addVertex(offA); bonus.addVertex(offB); bonus.addVertex(station); revenueAdapter.addRevenueBonus(bonus); |
From: Erik V. <ev...@us...> - 2010-05-24 11:42:43
|
Update of /cvsroot/rails/18xx/rails/ui/swing In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv2758/rails/ui/swing Modified Files: GridPanel.java GameStatus.java ORPanel.java Log Message: 18EU bankruptcy rules (Phase 3a) Index: GameStatus.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/ui/swing/GameStatus.java,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** GameStatus.java 24 May 2010 11:20:42 -0000 1.48 --- GameStatus.java 24 May 2010 11:42:35 -0000 1.49 *************** *** 298,302 **** companyIndex.put(c, new Integer(i)); rowVisibilityObservers[i] ! = new RowVisibility (this, certPerPlayerYOffset + i, c.getInGameModel()); boolean visible = rowVisibilityObservers[i].lastValue(); --- 298,302 ---- companyIndex.put(c, new Integer(i)); rowVisibilityObservers[i] ! = new RowVisibility (this, certPerPlayerYOffset + i, c.getInGameModel(), false); boolean visible = rowVisibilityObservers[i].lastValue(); Index: GridPanel.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/ui/swing/GridPanel.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** GridPanel.java 24 May 2010 11:20:42 -0000 1.7 --- GridPanel.java 24 May 2010 11:42:35 -0000 1.8 *************** *** 134,144 **** private int rowIndex; private boolean lastValue; ! public RowVisibility (GridPanel parent, int rowIndex, ModelObject model) { this.parent = parent; this.modelObject = model; this.rowIndex = rowIndex; modelObject.addObserver(this); ! lastValue = ((BooleanState)modelObject).booleanValue(); } --- 134,146 ---- private int rowIndex; private boolean lastValue; + private boolean reverseValue; ! public RowVisibility (GridPanel parent, int rowIndex, ModelObject model, boolean reverseValue) { this.parent = parent; this.modelObject = model; this.rowIndex = rowIndex; + this.reverseValue = reverseValue; modelObject.addObserver(this); ! lastValue = ((BooleanState)modelObject).booleanValue() != reverseValue; } Index: ORPanel.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/ui/swing/ORPanel.java,v retrieving revision 1.68 retrieving revision 1.69 diff -C2 -d -r1.68 -r1.69 *** ORPanel.java 24 May 2010 11:20:42 -0000 1.68 --- ORPanel.java 24 May 2010 11:42:35 -0000 1.69 *************** *** 394,398 **** c = companies[i]; rowVisibilityObservers[i] ! = new RowVisibility (this, leftCompNameYOffset + i, c.getInGameModel()); observers.add(rowVisibilityObservers[i]); --- 394,398 ---- c = companies[i]; rowVisibilityObservers[i] ! = new RowVisibility (this, leftCompNameYOffset + i, c.getInGameModel(), true); observers.add(rowVisibilityObservers[i]); |
From: Erik V. <ev...@us...> - 2010-05-24 11:42:43
|
Update of /cvsroot/rails/18xx/rails/game In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv2758/rails/game Modified Files: PublicCompanyI.java PublicCompany.java Log Message: 18EU bankruptcy rules (Phase 3a) Index: PublicCompany.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/PublicCompany.java,v retrieving revision 1.97 retrieving revision 1.98 diff -C2 -d -r1.97 -r1.98 *** PublicCompany.java 24 May 2010 11:20:42 -0000 1.97 --- PublicCompany.java 24 May 2010 11:42:35 -0000 1.98 *************** *** 1027,1030 **** --- 1027,1034 ---- } + public ModelObject getIsClosedModel () { + return closedObject; + } + /** * Set the company par price. <p> <i>Note: this method should <b>not</b> be Index: PublicCompanyI.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/PublicCompanyI.java,v retrieving revision 1.55 retrieving revision 1.56 diff -C2 -d -r1.55 -r1.56 *** PublicCompanyI.java 24 May 2010 11:20:42 -0000 1.55 --- PublicCompanyI.java 24 May 2010 11:42:35 -0000 1.56 *************** *** 359,362 **** --- 359,363 ---- public ModelObject getInGameModel (); + public ModelObject getIsClosedModel (); |
From: Erik V. <ev...@us...> - 2010-05-24 11:20:53
|
Update of /cvsroot/rails/18xx/rails/ui/swing In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv32483/rails/ui/swing Modified Files: GridPanel.java GameStatus.java ORPanel.java Log Message: 18EU bankruptcy rules (Phase 3) Index: GameStatus.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/ui/swing/GameStatus.java,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** GameStatus.java 9 Apr 2010 21:26:12 -0000 1.47 --- GameStatus.java 24 May 2010 11:20:42 -0000 1.48 *************** *** 298,303 **** companyIndex.put(c, new Integer(i)); rowVisibilityObservers[i] ! = new RowVisibility (this, certPerPlayerYOffset + i, c.getClosedModel()); ! boolean visible = !c.isClosed(); f = new Caption(c.getName()); --- 298,303 ---- companyIndex.put(c, new Integer(i)); rowVisibilityObservers[i] ! = new RowVisibility (this, certPerPlayerYOffset + i, c.getInGameModel()); ! boolean visible = rowVisibilityObservers[i].lastValue(); f = new Caption(c.getName()); Index: GridPanel.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/ui/swing/GridPanel.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** GridPanel.java 2 Apr 2010 20:03:54 -0000 1.6 --- GridPanel.java 24 May 2010 11:20:42 -0000 1.7 *************** *** 140,144 **** this.rowIndex = rowIndex; modelObject.addObserver(this); ! lastValue = !((BooleanState)modelObject).booleanValue(); } --- 140,144 ---- this.rowIndex = rowIndex; modelObject.addObserver(this); ! lastValue = ((BooleanState)modelObject).booleanValue(); } *************** *** 156,160 **** public void update(Observable o1, Object o2) { if (o2 instanceof Boolean) { ! lastValue = !(Boolean)o2; parent.setRowVisibility(rowIndex, lastValue); } --- 156,160 ---- public void update(Observable o1, Object o2) { if (o2 instanceof Boolean) { ! lastValue = (Boolean)o2; parent.setRowVisibility(rowIndex, lastValue); } Index: ORPanel.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/ui/swing/ORPanel.java,v retrieving revision 1.67 retrieving revision 1.68 diff -C2 -d -r1.67 -r1.68 *** ORPanel.java 24 May 2010 07:49:26 -0000 1.67 --- ORPanel.java 24 May 2010 11:20:42 -0000 1.68 *************** *** 394,398 **** c = companies[i]; rowVisibilityObservers[i] ! = new RowVisibility (this, leftCompNameYOffset + i, c.getClosedModel()); observers.add(rowVisibilityObservers[i]); --- 394,398 ---- c = companies[i]; rowVisibilityObservers[i] ! = new RowVisibility (this, leftCompNameYOffset + i, c.getInGameModel()); observers.add(rowVisibilityObservers[i]); *************** *** 985,987 **** ! } --- 985,987 ---- ! } \ No newline at end of file |
From: Erik V. <ev...@us...> - 2010-05-24 11:20:50
|
Update of /cvsroot/rails/18xx/data/18EU In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv32483/data/18EU Modified Files: CompanyManager.xml Log Message: 18EU bankruptcy rules (Phase 3) Index: CompanyManager.xml =================================================================== RCS file: /cvsroot/rails/18xx/data/18EU/CompanyManager.xml,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** CompanyManager.xml 15 Feb 2010 22:38:36 -0000 1.15 --- CompanyManager.xml 24 May 2010 11:20:42 -0000 1.16 *************** *** 15,34 **** <Trains initial="2" number="2,2,1" mandatory="no"/> </CompanyType> ! <CompanyType name="Major" class="rails.game.PublicCompany" capitalisation="incremental"> <Float percentage="50"/> ! <TreasuryCanHoldOwnShares maxPerc="80"/> ! <HomeBase lay="whenStarted"/> ! <StockPrice par="no"/> ! <ShareUnit percentage="10"/> ! <Certificate type="President" shares="2"/> ! <Certificate shares="1" number="8"/> ! <Capitalisation type="incremental"/> ! <BaseTokens> ! <BuyCost initialTokenCost="100"/> ! <HomeBase lay="whenStarted"/> ! </BaseTokens> ! <Payout split="allowed" mustExceedPriceToMove="yes"/> ! <Trains number="4,4,3,2"/> ! <TradeShares mustHaveOperated="yes"/> </CompanyType> --- 15,34 ---- <Trains initial="2" number="2,2,1" mandatory="no"/> </CompanyType> ! <CompanyType name="Major" class="rails.game.PublicCompany" capitalisation="incremental" restartable="yes"> <Float percentage="50"/> ! <TreasuryCanHoldOwnShares maxPerc="80"/> ! <HomeBase lay="whenStarted"/> ! <StockPrice par="no"/> ! <ShareUnit percentage="10"/> ! <Certificate type="President" shares="2"/> ! <Certificate shares="1" number="8"/> ! <Capitalisation type="incremental"/> ! <BaseTokens> ! <BuyCost initialTokenCost="100"/> ! <HomeBase lay="whenStarted"/> ! </BaseTokens> ! <Payout split="allowed" mustExceedPriceToMove="yes"/> ! <Trains number="4,4,3,2"/> ! <TradeShares mustHaveOperated="yes"/> </CompanyType> |
From: Erik V. <ev...@us...> - 2010-05-24 11:20:50
|
Update of /cvsroot/rails/18xx/rails/game/specific/_18EU In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv32483/rails/game/specific/_18EU Modified Files: StockRound_18EU.java Log Message: 18EU bankruptcy rules (Phase 3) Index: StockRound_18EU.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/specific/_18EU/StockRound_18EU.java,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** StockRound_18EU.java 15 May 2010 16:36:09 -0000 1.39 --- StockRound_18EU.java 24 May 2010 11:20:42 -0000 1.40 *************** *** 111,114 **** --- 111,115 ---- certs = map.get(compName); if (certs == null || certs.isEmpty()) continue; + /* Only the top certificate is buyable from the IPO */ cert = certs.get(0); |
From: Stefan F. <ste...@us...> - 2010-05-24 08:25:01
|
Update of /cvsroot/rails/18xx/rails/algorithms In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv14787/rails/algorithms Modified Files: NetworkGraphBuilder.java Log Message: Bug fix Index: NetworkGraphBuilder.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/algorithms/NetworkGraphBuilder.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** NetworkGraphBuilder.java 24 May 2010 07:49:26 -0000 1.13 --- NetworkGraphBuilder.java 24 May 2010 08:24:53 -0000 1.14 *************** *** 155,159 **** // add graph modifiers ! revenueManager.callGraphModifiers(this); } --- 155,161 ---- // add graph modifiers ! if (revenueManager != null) { ! revenueManager.callGraphModifiers(this); ! } } |
From: Stefan F. <ste...@us...> - 2010-05-24 07:49:34
|
Update of /cvsroot/rails/18xx/rails/game/specific/_1851 In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv10363/rails/game/specific/_1851 Modified Files: OffBoardRevenueModifier.java BirminghamTileModifier.java Log Message: Activated 1851 Birmingam modifier and several minor beauty changes Index: BirminghamTileModifier.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/specific/_1851/BirminghamTileModifier.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** BirminghamTileModifier.java 23 May 2010 18:10:44 -0000 1.1 --- BirminghamTileModifier.java 24 May 2010 07:49:26 -0000 1.2 *************** *** 3,6 **** --- 3,7 ---- import java.util.Set; + import org.apache.log4j.Logger; import org.jgrapht.graph.SimpleGraph; *************** *** 15,18 **** --- 16,22 ---- public class BirminghamTileModifier implements NetworkGraphModifier { + protected static Logger log = + Logger.getLogger(BirminghamTileModifier.class.getPackage().getName()); + public void modifyGraph(NetworkGraphBuilder graphBuilder) { *************** *** 23,27 **** // this is a violation of the assumption that the track network only dependents on the map configuration // but not on other things (like phases) ! if (gm.getCurrentPhase().getIndex() >= 2 ) return; // 2. retrieve Birmingham vertices ... --- 27,35 ---- // this is a violation of the assumption that the track network only dependents on the map configuration // but not on other things (like phases) ! int phaseIndex = gm.getCurrentPhase().getIndex(); ! if (phaseIndex >= 2 ) { ! log.debug("Birmingham active, index of phase = " + phaseIndex); ! return; ! } // 2. retrieve Birmingham vertices ... *************** *** 31,34 **** --- 39,43 ---- // 3 ... and remove them from the graph graph.removeAllVertices(birmingVertices); + log.debug("Birmingham inactive, index of phase = " + phaseIndex); } Index: OffBoardRevenueModifier.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/specific/_1851/OffBoardRevenueModifier.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** OffBoardRevenueModifier.java 21 May 2010 16:30:32 -0000 1.1 --- OffBoardRevenueModifier.java 24 May 2010 07:49:26 -0000 1.2 *************** *** 30,38 **** // always two offboard areas and one other Set<NetworkVertex> destOffBoard = new HashSet<NetworkVertex>(offBoard); for (NetworkVertex offA:offBoard) { destOffBoard.remove(offA); for (NetworkVertex offB:destOffBoard) { for (NetworkVertex station:otherStations) { ! RevenueBonus bonus = new RevenueBonus(BONUS_VALUE, "OB/" + station.toString()); bonus.addVertex(offA); bonus.addVertex(offB); bonus.addVertex(station); revenueAdapter.addRevenueBonus(bonus); --- 30,42 ---- // always two offboard areas and one other Set<NetworkVertex> destOffBoard = new HashSet<NetworkVertex>(offBoard); + RevenueBonus bonus; for (NetworkVertex offA:offBoard) { destOffBoard.remove(offA); for (NetworkVertex offB:destOffBoard) { + bonus = new RevenueBonus(2*BONUS_VALUE, "OFFBOARD"); + bonus.addVertex(offA); bonus.addVertex(offB);; + revenueAdapter.addRevenueBonus(bonus); for (NetworkVertex station:otherStations) { ! bonus = new RevenueBonus(BONUS_VALUE, "OFFBOARD"); bonus.addVertex(offA); bonus.addVertex(offB); bonus.addVertex(station); revenueAdapter.addRevenueBonus(bonus); |
From: Stefan F. <ste...@us...> - 2010-05-24 07:49:34
|
Update of /cvsroot/rails/18xx/data/1851 In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv10363/data/1851 Modified Files: Game.xml Log Message: Activated 1851 Birmingam modifier and several minor beauty changes Index: Game.xml =================================================================== RCS file: /cvsroot/rails/18xx/data/1851/Game.xml,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** Game.xml 23 May 2010 18:10:44 -0000 1.16 --- Game.xml 24 May 2010 07:49:27 -0000 1.17 *************** *** 104,108 **** </Component> <Component name="RevenueManager" class="rails.algorithms.RevenueManager"> ! <Modifier class="rails.game.specific._1851.OffBoardRevenueModifier" /> </Component> </ComponentManager> \ No newline at end of file --- 104,109 ---- </Component> <Component name="RevenueManager" class="rails.algorithms.RevenueManager"> ! <Modifier class="rails.game.specific._1851.OffBoardRevenueModifier" /> ! <Modifier class="rails.game.specific._1851.BirminghamTileModifier" /> </Component> </ComponentManager> \ No newline at end of file |
From: Stefan F. <ste...@us...> - 2010-05-24 07:49:34
|
Update of /cvsroot/rails/18xx/rails/ui/swing In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv10363/rails/ui/swing Modified Files: ORUIManager.java ORPanel.java Log Message: Activated 1851 Birmingam modifier and several minor beauty changes Index: ORUIManager.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/ui/swing/ORUIManager.java,v retrieving revision 1.74 retrieving revision 1.75 diff -C2 -d -r1.74 -r1.75 *** ORUIManager.java 15 May 2010 16:36:09 -0000 1.74 --- ORUIManager.java 24 May 2010 07:49:26 -0000 1.75 *************** *** 125,131 **** private SimpleGraph<NetworkVertex, NetworkEdge> getCompanyGraph(){ ! MapManager mapManager = gameUIManager.getGameManager().getMapManager(); ! NetworkGraphBuilder nwGraph = new NetworkGraphBuilder(); ! nwGraph.generateGraph(mapManager.getHexesAsList()); SimpleGraph<NetworkVertex, NetworkEdge> graph = nwGraph.getRailRoadGraph(orComp, true); --- 125,129 ---- private SimpleGraph<NetworkVertex, NetworkEdge> getCompanyGraph(){ ! NetworkGraphBuilder nwGraph = NetworkGraphBuilder.createMapGraph(gameUIManager.getGameManager()); SimpleGraph<NetworkVertex, NetworkEdge> graph = nwGraph.getRailRoadGraph(orComp, true); Index: ORPanel.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/ui/swing/ORPanel.java,v retrieving revision 1.66 retrieving revision 1.67 diff -C2 -d -r1.66 -r1.67 *** ORPanel.java 22 May 2010 18:42:26 -0000 1.66 --- ORPanel.java 24 May 2010 07:49:26 -0000 1.67 *************** *** 592,597 **** if (companyName.equals("All")) { ! NetworkGraphBuilder nwGraph = new NetworkGraphBuilder(); ! nwGraph.generateGraph(mapManager.getHexesAsList()); SimpleGraph<NetworkVertex, NetworkEdge> mapGraph = nwGraph.getMapGraph(); --- 592,596 ---- if (companyName.equals("All")) { ! NetworkGraphBuilder nwGraph = NetworkGraphBuilder.createMapGraph(gm); SimpleGraph<NetworkVertex, NetworkEdge> mapGraph = nwGraph.getMapGraph(); |
From: Stefan F. <ste...@us...> - 2010-05-24 07:49:34
|
Update of /cvsroot/rails/18xx/rails/game/specific/_18EU In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv10363/rails/game/specific/_18EU Modified Files: OffBoardRevenueModifier.java Log Message: Activated 1851 Birmingam modifier and several minor beauty changes Index: OffBoardRevenueModifier.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/specific/_18EU/OffBoardRevenueModifier.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** OffBoardRevenueModifier.java 21 May 2010 16:30:32 -0000 1.3 --- OffBoardRevenueModifier.java 24 May 2010 07:49:26 -0000 1.4 *************** *** 13,16 **** --- 13,17 ---- import rails.game.PhaseI; import rails.game.Station; + import rails.game.Tile; public class OffBoardRevenueModifier implements RevenueStaticModifier { *************** *** 25,33 **** PhaseI phase = revenueAdapter.getPhase(); int bonusValue; ! if (phase.isTileColourAllowed("gray")) { bonusValue = 30; ! } else if (phase.isTileColourAllowed("brown")) { bonusValue = 20; ! } else if (phase.isTileColourAllowed("green")) { bonusValue = 10; } else { --- 26,34 ---- PhaseI phase = revenueAdapter.getPhase(); int bonusValue; ! if (phase.isTileColourAllowed(Tile.GREY_COLOUR_NAME)) { bonusValue = 30; ! } else if (phase.isTileColourAllowed(Tile.BROWN_COLOUR_NAME)) { bonusValue = 20; ! } else if (phase.isTileColourAllowed(Tile.GREEN_COLOUR_NAME)) { bonusValue = 10; } else { *************** *** 73,77 **** for (NetworkVertex offB:destOffBoard) { for (NetworkVertex base:bases) { ! RevenueBonus bonus = new RevenueBonus(bonusValue, "OB/" + base.toString()); bonus.addVertex(offA); bonus.addVertex(offB); bonus.addVertex(base); revenueAdapter.addRevenueBonus(bonus); --- 74,78 ---- for (NetworkVertex offB:destOffBoard) { for (NetworkVertex base:bases) { ! RevenueBonus bonus = new RevenueBonus(bonusValue, "OFFBOARD"); bonus.addVertex(offA); bonus.addVertex(offB); bonus.addVertex(base); revenueAdapter.addRevenueBonus(bonus); |
From: Stefan F. <ste...@us...> - 2010-05-24 07:49:34
|
Update of /cvsroot/rails/18xx/rails/game/specific/_18Kaas In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv10363/rails/game/specific/_18Kaas Modified Files: RuhrRevenueModifier.java Log Message: Activated 1851 Birmingam modifier and several minor beauty changes Index: RuhrRevenueModifier.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/game/specific/_18Kaas/RuhrRevenueModifier.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** RuhrRevenueModifier.java 18 May 2010 04:12:23 -0000 1.1 --- RuhrRevenueModifier.java 24 May 2010 07:49:26 -0000 1.2 *************** *** 46,50 **** if (!ruhrGebied.contains(vertex) && vertex.isStation() && (vertex.isMajor() || !doublesOnlyMajors)) { for (NetworkVertex ruhrVertex:ruhrGebied) { ! RevenueBonus bonus = new RevenueBonus(vertex.getValue(), "Ruhr/" + vertex.toString()); bonus.addVertex(vertex); bonus.addVertex(ruhrVertex); --- 46,50 ---- if (!ruhrGebied.contains(vertex) && vertex.isStation() && (vertex.isMajor() || !doublesOnlyMajors)) { for (NetworkVertex ruhrVertex:ruhrGebied) { ! RevenueBonus bonus = new RevenueBonus(vertex.getValue(), "Ruhrgebied"); bonus.addVertex(vertex); bonus.addVertex(ruhrVertex); |
From: Stefan F. <ste...@us...> - 2010-05-24 07:49:34
|
Update of /cvsroot/rails/18xx/rails/algorithms In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv10363/rails/algorithms Modified Files: RevenueAdapter.java RevenueTrainRun.java RevenueBonus.java RevenueManager.java NetworkGraphBuilder.java Log Message: Activated 1851 Birmingam modifier and several minor beauty changes Index: RevenueBonus.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/algorithms/RevenueBonus.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** RevenueBonus.java 20 May 2010 19:57:01 -0000 1.3 --- RevenueBonus.java 24 May 2010 07:49:26 -0000 1.4 *************** *** 2,7 **** --- 2,9 ---- import java.util.Collection; + import java.util.HashMap; import java.util.List; import java.util.ArrayList; + import java.util.Map; import org.apache.log4j.Logger; *************** *** 172,175 **** --- 174,189 ---- } + public static Map<String, Integer> combineBonuses(Collection<RevenueBonus> bonuses){ + Map<String, Integer> combined = new HashMap<String, Integer>(); + for (RevenueBonus bonus:bonuses) { + String name = bonus.getName(); + if (combined.containsKey(name)) { + combined.put(name, combined.get(name) + bonus.getValue()); + } else { + combined.put(name, bonus.getValue()); + } + } + return combined; + } public static int getNumberNonSimpleBonuses(List<RevenueBonus> bonuses) { Index: RevenueTrainRun.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/algorithms/RevenueTrainRun.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** RevenueTrainRun.java 20 May 2010 23:13:21 -0000 1.5 --- RevenueTrainRun.java 24 May 2010 07:49:26 -0000 1.6 *************** *** 5,8 **** --- 5,9 ---- import java.util.ArrayList; import java.util.List; + import java.util.Map; import org.apache.log4j.Logger; *************** *** 121,132 **** // check revenueBonuses (complex) for (RevenueBonus bonus:revenueAdapter.getRevenueBonuses()) { if (bonus.checkComplexBonus(vertices, train.getRailsTrain(), revenueAdapter.getPhase())) { ! runPrettyPrint.append(" + "); ! runPrettyPrint.append(bonus.getName() + "(" + bonus.getValue() + ")"); ! multiple = prettyPrintNewLine(runPrettyPrint, multiple, initLength); } } ! runPrettyPrint.append("\n"); --- 122,137 ---- // check revenueBonuses (complex) + List<RevenueBonus> activeBonuses = new ArrayList<RevenueBonus>(); for (RevenueBonus bonus:revenueAdapter.getRevenueBonuses()) { if (bonus.checkComplexBonus(vertices, train.getRailsTrain(), revenueAdapter.getPhase())) { ! activeBonuses.add(bonus); } } ! Map<String,Integer> printBonuses = RevenueBonus.combineBonuses(activeBonuses); ! for (String bonusName:printBonuses.keySet()) { ! runPrettyPrint.append(" + "); ! runPrettyPrint.append(bonusName + "(" + printBonuses.get(bonusName) + ")"); ! multiple = prettyPrintNewLine(runPrettyPrint, multiple, initLength); ! } runPrettyPrint.append("\n"); Index: RevenueManager.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/algorithms/RevenueManager.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** RevenueManager.java 23 May 2010 18:10:44 -0000 1.4 --- RevenueManager.java 24 May 2010 07:49:26 -0000 1.5 *************** *** 58,62 **** Object modifier; try { ! modifier = (RevenueStaticModifier) Class.forName(className).newInstance(); } catch (Exception e) { throw new ConfigurationException(LocalText.getText( --- 58,62 ---- Object modifier; try { ! modifier = Class.forName(className).newInstance(); } catch (Exception e) { throw new ConfigurationException(LocalText.getText( Index: RevenueAdapter.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/algorithms/RevenueAdapter.java,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** RevenueAdapter.java 22 May 2010 18:42:26 -0000 1.20 --- RevenueAdapter.java 24 May 2010 07:49:26 -0000 1.21 *************** *** 82,88 **** public static RevenueAdapter createRevenueAdapter(GameManagerI gm, PublicCompanyI company, PhaseI phase) { ! MapManager mapManager = gm.getMapManager(); ! NetworkGraphBuilder nwGraph = new NetworkGraphBuilder(); ! nwGraph.generateGraph(mapManager.getHexesAsList()); RevenueAdapter ra = new RevenueAdapter(gm, nwGraph, company, phase); ra.populateFromRails(); --- 82,86 ---- public static RevenueAdapter createRevenueAdapter(GameManagerI gm, PublicCompanyI company, PhaseI phase) { ! NetworkGraphBuilder nwGraph = NetworkGraphBuilder.createMapGraph(gm); RevenueAdapter ra = new RevenueAdapter(gm, nwGraph, company, phase); ra.populateFromRails(); *************** *** 476,490 **** public int calculateRevenue(int startTrain, int finalTrain) { if (startTrain < 0 || finalTrain >= trains.size() || startTrain > finalTrain) { - optimalRun = null; return 0; } rc.initialPredictionRuns(startTrain, finalTrain); int value = rc.calculateRevenue(startTrain, finalTrain); - optimalRun = convertRcRun(rc.getOptimalRun()); return value; } public List<RevenueTrainRun> getOptimalRun() { return optimalRun; } --- 474,490 ---- public int calculateRevenue(int startTrain, int finalTrain) { + optimalRun = null; if (startTrain < 0 || finalTrain >= trains.size() || startTrain > finalTrain) { return 0; } rc.initialPredictionRuns(startTrain, finalTrain); int value = rc.calculateRevenue(startTrain, finalTrain); return value; } public List<RevenueTrainRun> getOptimalRun() { + if (optimalRun == null) { + optimalRun = convertRcRun(rc.getOptimalRun()); + } return optimalRun; } *************** *** 542,549 **** public String getOptimalRunPrettyPrint() { ! if (optimalRun == null) return "No Optimal Run"; StringBuffer runPrettyPrint = new StringBuffer(); ! for (RevenueTrainRun run:optimalRun) { runPrettyPrint.append(run.prettyPrint()); } --- 542,550 ---- public String getOptimalRunPrettyPrint() { ! List<RevenueTrainRun> listRuns = getOptimalRun(); ! if (listRuns== null) return "No Optimal Run"; StringBuffer runPrettyPrint = new StringBuffer(); ! for (RevenueTrainRun run:listRuns) { runPrettyPrint.append(run.prettyPrint()); } *************** *** 557,563 **** public void drawOptimalRunAsPath(HexMap map) { List<GeneralPath> pathList = new ArrayList<GeneralPath>(); ! if (optimalRun != null) { ! for (RevenueTrainRun run:optimalRun) { pathList.add(run.getAsPath(map)); } --- 558,566 ---- public void drawOptimalRunAsPath(HexMap map) { + List<RevenueTrainRun> listRuns = getOptimalRun(); + List<GeneralPath> pathList = new ArrayList<GeneralPath>(); ! if (listRuns != null) { ! for (RevenueTrainRun run:listRuns) { pathList.add(run.getAsPath(map)); } Index: NetworkGraphBuilder.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/algorithms/NetworkGraphBuilder.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** NetworkGraphBuilder.java 22 May 2010 18:42:26 -0000 1.12 --- NetworkGraphBuilder.java 24 May 2010 07:49:26 -0000 1.13 *************** *** 30,34 **** --- 30,36 ---- import rails.game.BaseToken; import rails.game.City; + import rails.game.GameManagerI; import rails.game.MapHex; + import rails.game.MapManager; import rails.game.PublicCompanyI; import rails.game.Station; *************** *** 43,62 **** Logger.getLogger(NetworkGraphBuilder.class.getPackage().getName()); ! private SimpleGraph<NetworkVertex, NetworkEdge> mapGraph; ! ! private Map<String, NetworkVertex> mapVertexes; private NetworkIterator iterator; ! public NetworkGraphBuilder() { ! this.mapGraph = null; ! } ! ! public void generateGraph(List<MapHex> mHexes ) { ! mapGraph = new SimpleGraph<NetworkVertex, NetworkEdge>(NetworkEdge.class); mapVertexes = new HashMap<String, NetworkVertex> (); ! for (MapHex hex:mHexes) { // get Tile TileI tile = hex.getCurrentTile(); --- 45,69 ---- Logger.getLogger(NetworkGraphBuilder.class.getPackage().getName()); ! private final SimpleGraph<NetworkVertex, NetworkEdge> mapGraph; ! ! private final Map<String, NetworkVertex> mapVertexes; private NetworkIterator iterator; ! private NetworkGraphBuilder() { mapGraph = new SimpleGraph<NetworkVertex, NetworkEdge>(NetworkEdge.class); mapVertexes = new HashMap<String, NetworkVertex> (); + } + + public static NetworkGraphBuilder createMapGraph(GameManagerI gameManager) { + NetworkGraphBuilder graphBuilder = new NetworkGraphBuilder(); + graphBuilder.generateGraph(gameManager.getMapManager(), gameManager.getRevenueManager()); + return graphBuilder; + } + + + public void generateGraph(MapManager mapManager, RevenueManager revenueManager) { ! for (MapHex hex:mapManager.getHexesAsList()) { // get Tile TileI tile = hex.getCurrentTile(); *************** *** 83,87 **** // loop over all maps and add tracks ! for (MapHex hex:mHexes) { // get Tile TileI tile = hex.getCurrentTile(); --- 90,94 ---- // loop over all maps and add tracks ! for (MapHex hex:mapManager.getHexesAsList()) { // get Tile TileI tile = hex.getCurrentTile(); *************** *** 146,149 **** --- 153,159 ---- } } + + // add graph modifiers + revenueManager.callGraphModifiers(this); } |
From: Stefan F. <ste...@us...> - 2010-05-23 18:10:53
|
Update of /cvsroot/rails/18xx/data/18EU In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv23967/data/18EU Modified Files: Game.xml Log Message: Minor refactoring of RevenueManager and added NetworkGraphModifier and BirminghamTileModifier for 1851 Index: Game.xml =================================================================== RCS file: /cvsroot/rails/18xx/data/18EU/Game.xml,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** Game.xml 20 May 2010 23:13:21 -0000 1.23 --- Game.xml 23 May 2010 18:10:44 -0000 1.24 *************** *** 105,110 **** </Component> <Component name="RevenueManager" class="rails.algorithms.RevenueManager"> ! <StaticModifier class="rails.game.specific._18EU.OffBoardRevenueModifier" /> ! <DynamicModifier class="rails.game.specific._18EU.PullmanRevenueModifier" /> </Component> </ComponentManager> \ No newline at end of file --- 105,110 ---- </Component> <Component name="RevenueManager" class="rails.algorithms.RevenueManager"> ! <Modifier class="rails.game.specific._18EU.OffBoardRevenueModifier" /> ! <Modifier class="rails.game.specific._18EU.PullmanRevenueModifier" /> </Component> </ComponentManager> \ No newline at end of file |
From: Stefan F. <ste...@us...> - 2010-05-23 18:10:53
|
Update of /cvsroot/rails/18xx/data/1851 In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv23967/data/1851 Modified Files: Game.xml Log Message: Minor refactoring of RevenueManager and added NetworkGraphModifier and BirminghamTileModifier for 1851 Index: Game.xml =================================================================== RCS file: /cvsroot/rails/18xx/data/1851/Game.xml,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** Game.xml 21 May 2010 16:30:32 -0000 1.15 --- Game.xml 23 May 2010 18:10:44 -0000 1.16 *************** *** 104,108 **** </Component> <Component name="RevenueManager" class="rails.algorithms.RevenueManager"> ! <StaticModifier class="rails.game.specific._1851.OffBoardRevenueModifier" /> </Component> </ComponentManager> \ No newline at end of file --- 104,108 ---- </Component> <Component name="RevenueManager" class="rails.algorithms.RevenueManager"> ! <Modifier class="rails.game.specific._1851.OffBoardRevenueModifier" /> </Component> </ComponentManager> \ No newline at end of file |
From: Stefan F. <ste...@us...> - 2010-05-23 18:10:52
|
Update of /cvsroot/rails/18xx/data/18Kaas In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv23967/data/18Kaas Modified Files: Game.xml Log Message: Minor refactoring of RevenueManager and added NetworkGraphModifier and BirminghamTileModifier for 1851 Index: Game.xml =================================================================== RCS file: /cvsroot/rails/18xx/data/18Kaas/Game.xml,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** Game.xml 18 May 2010 04:12:22 -0000 1.15 --- Game.xml 23 May 2010 18:10:44 -0000 1.16 *************** *** 104,108 **** </Component> <Component name="RevenueManager" class="rails.algorithms.RevenueManager"> ! <StaticModifier class="rails.game.specific._18Kaas.RuhrRevenueModifier" /> </Component> </ComponentManager> --- 104,108 ---- </Component> <Component name="RevenueManager" class="rails.algorithms.RevenueManager"> ! <Modifier class="rails.game.specific._18Kaas.RuhrRevenueModifier" /> </Component> </ComponentManager> |