Matt Wong

Ranch Hand
+ Follow
since Aug 18, 2017
Matt likes ...
MS IE Notepad Suse
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
(keep public parts private until JForum day)
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt
Moderation Tools

Recent posts by Matt Wong

Sorry for the long delay - got not much time in last few days.

I re-thought about the Jail logic. Why not decouple it into its own class?
So when a player is advanced to jail (third double in a row, go to jail field, go to jail card), the board will call an incacerate method on the jail field - wich then delegates the incarceration to the jail-logic class wich keeps track of players incarcerated and for how many rounds. So it should be easier to check when a new turn starts for a player. Something like jailInstance.isIncacerated(currentPlayer) and if so maybe some like jailInstance.rounds(currentPlayer) to check for how many rounds. This way the actions can be split of into another flow handling the jail mechanics.

Some in this way also for the dice: To keep track how many doubles rolled in a row and re-setting it if the dice show different numbers. Otherwise, if it hits the limit, trigger the into-jail event.

Sure, maybe it's possible to design interfaces to abstract the board, the fields, the dice - link some overall relationship in - and specialize depended on the type of board played (like a board w/o jail, a game with 3 dice, maybe some "extended" or "multi-layer" types). It's hard to think abstract high-level enough when talking about implementing a game with a set of rules - but yet different types (can't remember about this two-layer style to find it quick on the net - but the extended version is called "mega monopoly", and the small one is the junior one - wich, iirc, doesn't have a jail - not sure tho). I also think it should be my goal to implement the standard version first - then, after upping my skills, maybe refactor to add such additions.

I also thought about the GUI and wich way to go. As I'm pretty good in swing I think this will be my first choice. Sure, when keeping it strictly split apart and develope a good interface - it should be easy to replace it with javafx (although this would require some re-code cause javafx applications are different from swing ones).

So long, if I'm up to some other major news I'll post again.

1 day ago
Well, sure such easy converters are possible without the need for an extra button, but it's not so easy as just add some listeners. Rather you have to sub-class the input fields to change thier internal behaviour when an input is made.
Beware to not to write some endless-loop code but look what lines are executed when specific methods called from outside.
2 days ago
please excuse my some bad english - I'm a german native

Sadly I don't have time to awnser as my other posts - as I simple didn't had enough time to think about your posts - so I'll try to make it short:

Once again, I'd like to thank anyone who took the time to read, also the ones who took even more time to reply - and to make me look at this project not just from one other side - but a few  - to discover lot of new possibilities.
I already made some changes to once pretty stiff but now really loose basic consept in my mind. I've already tried to re-arange things - threw it away and came up with also another solutions - while still tryin to think about and figure more ... one word: amazing.

To tighten this up a bit: Lot of posts made me think of a, for me really strange but productive, way to not really start all other again, but to let other points of view lighten me up.

Just for a quick example: somewhere I've wrote: "first: check if player is in jail", uhm - yea, about that - I re-thought about this whole "jail-magic"-thingy and came up with: "Wait a second - I always have to keep track of the dice if the current player rolled a double, and if so, how many times in a row?". So, from my original "nah, just take the sum of both dice into what ever type might fit" I already move to "there's a lot more just about the dice than I thought of until now". There many of such cases where I know think: "Just wait a second - this crap of b-sh*t just doesn't make sense at all! - I have to aproach it from a different way ...".

Just a quick side-note on test-driven dev: I support that, as in the past I've seen so much goin wrong with "modders" of minecraft - wich fail to just follow Java Conventions (ok, don't blame them - this fault comes back to 1) Notch who screwed up the original 2) the "forge"-team wich screwed it up even more and worse) - and just by starting up the logger throws so many RuntimeException - hiding away checked Exception - one who can read and understand the logs and StackTrace just can think: "Ok little chumps - you got this all wrong pretty hard.".
But: I'm just not used to this kind of development. To admit: I'm the one kind of "hobby dev" wich just uses an editor and the terminal to write his codes (at least after many years I've moved from just notepad to notepad2 (I like it more than notepad++) wich at least adds syntax-highlightning - and yes: I'm using vim on teh unix). I'm not afraid of learning how to use IDEs, version control repos and all that stuff - I'm just not used to it - and starting to learn this now maybe a good idea - but would throw me back half a year on this project - wich I don't want like to waste. - Hey, I can still refactor it later on, can't I?

Also I've wrapped my head around this "board and fields"-thing and - although I really like abstraction (in the past I've over-complicated some easy examples with a full over blown interface-abstract-impl-factory thing) - I, at least until now, still can't make it up so that the board itself could be a "regular" interface without any specifics like jail and free parking, but I also aware that such funcationality can be made up through "external consturcts" cleverly hidden through interfaces

[spoiler] - is thier some code to "hide" some lines? know [spoiler]-tag from BB ...
don't ask me or nail me down on it, but on some of my not-so-well-known german small-community boards I've read some clever "hidden through abstraction"-code by one of our trolls - wich, to be honest to him (I really don't know if "it" is a he or she) sometimes has his really bright moments to shine, wrote some beautiful abstract code wich opened up to one of our "abstract-interface-magicians" the possibility to write some few lines wich, if you know java8 and its tweaks, allows you to write some 3-liners wich just fit in basicly everywhere[/spoiler]

and thier factory-style implementations.
Don't get me wrong - this project will only subject specific on the game of Monopoly and its own unique styles of gameplay - I don't want to make up a "general card-board game -engine-", so at least some spaghetti code would/could/should be allowed to get this runnig without over-complicating stuff unnecessarily.

I know one who have years of experience to build such things may can get away way more cleaner - but as I'm already into Java from about the age of 12 (I'm almost 27 now) and the only one project I finally got done was a very simple and ugly prototype-like implementation of battle ships - this is "the one project" I really like finally to get into the world of "productive developing" some code - no matter what it is, whats the plan/idea behind it is and how it will come out in the end.
If this long "I've already got this done 5 years ago"-"project" finally gets to a stage where it is at least "useable", let alone the term "playable". this would be the biggest achievement in my personal dev-carrer until now - no matter how bad the code will be nor how many bugs it will have - I really want to get this done - not only for myself but also as for a service I can offer to anyone in the world wide net: "You want to play a round of Monopoly?", as, to be honest, to find free online games or cheap buyable ones is still pretty hard. And pay 15 bucks on steam for table-top-sim to play Monopoly? There just has to be another way ...

As for all other replies I didnt awnsered - be sure I've read them - and sill will - but I'm out for about a week now only get some minutes to check for replies - await my next reply around next weekend.

Additional for any mods: If the way I'm taking this thread doesn't fit the forum rules - or if something else is not the way this "board" should be used - please inform me/us - and we will alter the way this "project" will go.
I've just started here as this seems to be an international place to finally get my first real project finally to be done (wich, no offense to my german board, couldn't happen at a smaller community). May there's a special "blog like" are where this may fit better than in the regular forums - any advice is highly appreciated as I want to comply with the overall rules as much as possible.

Thank you all again, in retrospect and in advance, to get this project done.

For those who want to think a dozen steps ahead: This project is subject to also imply some sort of "AI" - so, what I'm currently refering to as "the player" (or better: the Player class) will be an interface in the end wich either is set to an implementation of a real player (wich means any action is send over network and is displayed and controlled to and by a game client controlled by a real person) or just a "bot" (an AI if you will wich makes decisions based upon maths over some dozen rules) run on the server side. Therefore I want to already encourage any game-AI-dev to prepare up for an implementation - those wich will get into the "final" realease of course will get credited (either by pseudo nick or real full name - as you wish).
There're just a few, really "open", possibilities for this game, to play it online - that's the real reason I want to get it done: not just to play it with my friends on a real board but also in the cyberspace. If you think the same way - please join up this crew and be part of it on its journey to its endeavour to achieve its goal.

So long, until next weekend (don't expect any reply from me as I'm away for the next few days), Matt out.
2 weeks ago
Well, simple said: an object is only eligible for garbage collection if no more active references are reachable from any live thread.

A bit more background: Unlike native applications wich can ask the OS for as many memory they want, java was designed with an upper limit how much a java snippet can request. If this limit is the jvm simple just doesn't allow any more memory and throws this error.
Also: Errors always show some abnormal jvm behaviour wich should not occur and should lead to a termination of the jvm, exceptions are logical errors a developer screwed up code.
2 weeks ago

Liutauras Vilda wrote:You aren't beginner, so apologies if I expand too much into details. But we have lots of readers here, so the more users (i.e. students) could possibly be on the same page, the better

Nah, don't worry - that's a really good post and really helps to think about this project in some new ways I hadn't yet thought of, for instance to look at it from a developers point of view instead of trying to adapt the real life scenario and glue into code. I was aware of SRP before - and what it mean in general - but didn't knew how helpful it can be to get a different look on specific problems to solve.

So far we can extend the example - if the GameRound is responsible to link the Players to the GameBoard, how could a player interact with a field? As noted above - when a new turn starts for a player there some actions happen (check jail, roll dice, advance, perform actions, trade). The check for jail sounds easy (as the status if a player is in jail, and if so, for how many rounds and if a player owns a "get out of jail"-card should all be properties of the Player class), but after a player rolled the dice (wich of course to prevent "getting out of sync" (in lack of a better term to say "prevent cheating") is done on server side) this somehow needs to "get done on the board". So I would consider something like this:

If we go with that - the gameboard has to manage:
1) update the field the player is on (so this may be a property of the Player class) - according to check for passing GO (not sure yet how to implement this one)
2) send out this update to connected game clients (wich infact gets managed by other classes wich just get called by the gameboard class)
3) check what action has to happen after movement
But then we're out of this SRP again as the gameboard suddenly again takes care of more than one action.
If we add another line - say

then the field class gets out of SRP as it has to check if the field is already owned by another player and what's is current status (in terms of buldings), somehow has to get back to the gameround object to access the rules object (example to check for the rule for taxes field) wich would lead to some ugly line like this:

wich then may could offer the player to choose from two options, then, depending on this decision, it could go furhter on like

wich then finaly further may lead to calculation of networth - and then - depending on the "free parking"-rule - decide where this money is payed to.

So, you see, I really have trouble to stick to this whole SRP thing and may need help to clean this up.

Unfortunately, I'm now up for a whole long 10-day shift, around 10h a day, so it may take some time until my next response if I don't find a spare minute in between.

So long for now - Matt out.
2 weeks ago
The reason for the order is simply based on security:

Imagine what would happen if you would had an classloader wich loads an additional class external - and this class itself needs some classes contained in java.lang or other standard java.x packages - wich not loaded until this point (its hard to find such a class cause theres so many going on when the vm starts up - a damn load of classes already loaded before yours is even touched) - what would happen if you put a custom class named java.lang.String in your local classpath? It would get loaded before the original internal java.lang.String from rt.jar is loaded - wich is something that could not allowed to happen. That's why each classloader first delegates up to the parent loader to handle loading before trying to load a class on its own. I don't know if there its even possible to trick around it - my guess is that this is one of the many internal secrets hardcoded into the native code.

2 weeks ago
Hello Liutauras,

thank you for your reply - it really made me thinking about some decisions. May let me awnser your points in order:

to your 1)
First of: I agree with you, "Session" doesn't really fit - GameRound seems to fit better.
I have to explain my already made up plan a bit more: When a user (a "Player") starts my code (I refer to as "Game") after connection one gets shown available games to join or spectate - this overview I call "main hub" - and the games listet are joinable "Lobbies" (or "Lobby" for one). A Lobby is kind of a "preparation room" players join together, agree upon rules and when all ready to play the game starts - that's how I come up with Session.
As it made me rethink about these names - not only I changed it to GameRound, but also PlayerList to just Players and Rule(s)Set to just Rules - just fits it better.

to your 2)
Refering to the Lobbies in 1, well, yea, each GameRound is supposed to have its own Rules. These rules are the "house rules" - that small differences each game is unlike others, like the amount of cash at start, if you get double money when you hit GO spot on, if you always pay taxes in fixed amount or always 10%, if there is a limit on houses, what happens at Free Parking - and so on. Sure, one can decide to stick to official rules - but may choose to change some. So your thought was correct.

to your 3)
I'm still unsure about the relationship between players, fields, the board itself, the session and how they all play together. I've just put it in as a placeholder. Do I need it? Not sure yet. The most think I'm still unsure about is the relation between the Player class and the Field class - wich one does need to know wich? Do they need to know each other at all? Can this relation been build externaly like in an external Board class? There're many placeholders and questions still flowin around in my head.

I wanted to get some line down and start with the rules - as they only consists of ints, booleans and maybe one or two enums - so the Rules itself doesn't depend on others. But your post somewhat throw me around the rethink about some thinks. So maybe let me just list the rules I already came up with - maybe some can changed, maybe split into others or taken togheter, may some more can be added - we'll see.

- amount of cash at start - int
- collect double on hit go - boolean
- how to pay taxes - enum [player choose, always fixed amount, always percentage]
- fixed amount of taxes - int
- percentage of taxes - int
- free parking action - enum [none, fixed amount, taxes, bank (this means also what's noted on cards like "doctors fee" or the famous "repair your properties" card), maybe some other rule ...]
- double amount of community chest or chance cards (payments players have to make to bank or to other players as well as payments a player receive from bank and others) - boolean
- house limit - int (-1 means no limit)
- hotel limit - int (-1 means no limit)
- buy on first round allowed - boolean
- enforce rolling dice as first action - boolean (except jail - wich player can decide to use card instant without rolling first)
- enforce auctioning - boolean
- on bankruptcy: go properties back to bank or player to wich is lost - enum [bank, player]
- how is decided wich player goes first - enum [set value, random, rolling dice]
- when above is set to specific value: reference to player wich goes first - object(Player)
- is a player allowed to trady when in jail
- additional fee/taxes when re-buy mortgaged properties in percentage of base value - int (0 means no additional fee/taxes)

So you see there's a huge list how a round can differ from others, and these only the "common ones" wich are also noted as "subject to agreed upon by players" in the official rules.
I think the easiest way to implement these rules is just following bean-convention: private fields with public getters/setters and constructor init fields to some "default" values.

As an example wich I will also add is a very neat additional rule added by a friend of mine: You just can't "manage" your properties as you like, even official rules only allow it 1) when its your turn 2) only for the property you're currently on (wich means when you're in jail you're not allowed to), but also you're also allowed only a limited amount of actions you can do. So it goes like this: each round you cross GO you earn an additional "action point" (on wich also can be a max set to) wich limits your actions. Each time you upgrade from houses to hotel or downgrade, even when just add or remove a house, or mortgage or re-buy a mortgaged property - you always have to spent such an action point. This means: When you're screwed at need to seel houses or mortgage properties to get enough money to pay a rent - you can only do so if you have enought points. If you don't have enough such points you can't scrap together enough money - and you're out. It spices thinks way up. One round I earned around 15 such points, but couldn't use them cause I kept down below 1k by other players (finaly I got sniped) - but they on the other hand kept landing on "go to jail" or drawing the jail cards - so they didn't completed as many rounds as I did so the didn't got much points - so they luckly couldn't upgrade for a long time (altough they stacked up to 100k+ (yea, german original edition is played each number added an additional 0 - so 100k in german edition is equivalent to 10k in us/uk version)).

Long post - again - apologies to anyone and thanks for reading. Next reply maybe on weekend - at least if I get time to.
2 weeks ago
Ok, so after brainstorming the whole weekend, I now come up with the first steps for the Session class.

First I looked about what the session needs to know during the game, how it interacts with other objects, and how to create one.
To get a possible constructor I thought about: What does a Session-object need to know to? So we have the players, a ruleset, the fields/gameboard (I'm still not sure about that) and the internal current status. As the last two gets reset and newly created for each new session a constructor needs a PlayerList and a RuleSet. So we get this:

As for the PlayerList I've decided to write some own code based on an internal java.util.Deque. Some now may ask: Why? Well, a Deque provides an easy FIFO-Buffer while maintaining the initial order. So, even there will be a possible shuffle by rules to determine wich player's first and what's the order - if it's initialy set can easy to some like this:

Why to add some custom code? Well, I plan to add optional rules to set the order and wich player starts. This may will be:
- lobby leader goes always first - this means, it doesn't matter in wich order the list is set, the leader of the lobby (the player wich set it up) will always go first
- random - explains it self - list gets shuffled at on player is chosen as random
- as joined - some more code needed in the lobby code, means the players will go in the order the initialy joined the lobby
- by dice - each player rolls the dice - order is set by highest or lowest - if two player roll the same the will have to roll again aganst eachother
- set - the lobby-leader sets an order before session starts
As far as it makes sense / is possible I want to make each rule combineable with each other - for example a leader could set random order but a set player as the first one - or a fixed order like "as joined" or "set by leader" and players still roll the dice just to select the first player. Sure - this sounds error prone in the first place - but I think: Monopoly is mostly played with custom rules - why not offer this freedom for the player-list also? Bugs get thrown out later.
So I will need a data structure wich provides a simple FIFO-buffer, but is also flexiable enough for mixing up random stuff. The docs says that a Deque doesn't provide a way to access by index - but I think that all those fancy streams-api added with v9 somehow provide an easy way to implement these different options. If not I can still go the old way > Iterator > Array > some shuffeling > and with a for-loop back into a new Deque. I think as heavy array-copying may be expensive - I may will go with LinkedList - may someone can help here.

So, even if it's called a "loop" - the game-loop still needs an entry-point wich can somehow set to the applied ruleset. As I can go with the above code to step through the Deque to set the starting player (if needed), I may alter may mentioned loop from last post to move the "nextPlayer" call to the end. This will simplyfy the start of the loop as I can just run through the list - and when the desired player is found - just stop right there - instead of add fancy magic to "step back once" (wich sure is easy possible by getting last element and re-adding it in the first place, but this step can be saved).

This may lead to the following:

So, you may start to see - this is all heavy pseudo-code - there's no real lines yet.
Why this "waitForTrade"? Well, as mentioned in the last post, each player still has the ability to initiate a trade (in real world may at any time - as the computer one have to follow some rules - we set it as "at the end of turn"). So, after any mandatory action is done, the player will get sent an event like "hey, you, you may trade now within the next 30sec" and simply will call a .wait() on the thread. To escape this there 3 actions: a player does not trade calls "end turn" -> notify(), a player will start a trade -> notify(), the timeout is triggered -> interrupt(). This is just because this is planed to run over network connections.

Sure, this is still in the planing phase - and many implementation details may depent on some tests I will have to run, like how to sync the timeout (what happens when a player hits the trade button the split-second between the "it's over"-timeout is triggered on server side but the event to inform the client is still on its way?), what order of actions fits best the real game, how to set-up the playerlist and ruleset in the firstplace (or: how to design the "lobby"). As some of you mentioned: this will be a big, not so easy project for something simple as a boardgame (ok, Monopoly itself isn't an easy boardgame - but it's still "just" a boardgame - only with some complex rules).

I'll keep you up through the week as I get some steps along.

So long ... Matt out.
3 weeks ago
Hey there folks, Matt here, greetings ...

This time maybe a bit longer thread, and I'd like to thank anyone in advance who takes time to read and spent some time for typing a reply.

For a long time I always wanted to implement the well known cardboard game of Monopoly in Java, based on an original one I have laying around here (oh boy, this really helps, as you can find almost any information - except the chance and community cards - seems like there nowhere listed anywhere on teh internetz - same for "official" rules). I've tried to start some times in the past - but never got more than a few lines down.
As for the new year - I now want to finaly get it done.

So, I looked up Monopoly at Wikipedia - wich referenced to the page about cardboard games - and starting here there's a really neat bit I really like and wich I'd like to base my game on:

A board game is a tabletop game that involves counters or pieces moved or placed on a pre-marked surface or "board", according to a set of rules.

As I'm really into this whole object orientend thing and like abstraction - I want to start as follows:

I know the "game" I like to implement is a board game - based on a cicrcle wich is played by 2+ players on a round-by-round style with possible interactions - according to some specific rules. So I start with the basis - the board. Looking at the board we can note down some important specs:
- the board is a square with overall 40 fields - layed out as 4 corner tiles - one in each corner - and placed 9 tiles in between on each side
- there some different types of fields: buyable properties (wich divide into properties with houses and those without (the two supply facilities and the 4 railroad stations)) and special actions (community chest, chance, taxes, corners (go, jail, free parking, go-to-jail))
- it is played with 2 - 8 players (each player has a unique toke)
- for the buyable properties with spaces for buildings apply some rules for those buildings (how, when, how many)
- the overall ruleset about the game itself

So to get started, I came up with this abstract description of the board wich now needs to be implemented in a Java class. As said - I really like abstraction - so in the board-class I would ignore the facts about different types of fields - the board just have fields. Also, for the board-class it doesn't matter in wich order the fields are or that they form a circle - that's up for the graphical classes and the logic-class responseable for player movement. This leads me to the question: as there is no logical relationship between the board and the fields in terms of Java-classes wich has to know each other - is it useful at all to implement a relationship here?
Maybe I can find an awnser when I try to think about: What kind of information the fields hold and do I access them? The fields themselves only have to know its type, and, if there buyable, if they're bought by a player, also, if they have room for houses, how many are on them.
On the other hand - does a field have to know if it's owned by a player - or is it better if players know what properties they own? I would try to awnser it this way: Each round a player has to roll the dice - wich let them land on a field. To decide what happens when a player lands on a field it needs to know its state and all what's needed for it.

So let me start on another side: I will have a "session"-class - the main object wich represents the overall gaming session itself - just like if you get together with some friends to play round of Monopoly. So this class knows the overall state of the game and of all pieces it is made of, i.e. wich player is currently the active one, in wich state a player is (so it can be checked what actions a player can do at any time) and wich actions a player can do on a field he stands on. So, one could think about: First step a player has to do is to roll the dice. This is only true with the exception of one field: the jail. Wich leads to this flow-chart:

1) check on wich field the player is currently on
- 1a) if the player is currently not on the field "jail" skip the following and proceed at step 1b
-- 1aa) the player is just on the "just visit" part of the "jail"-field - skip the following and proceed at step 1b
-- 1ab) check if the player has at least one of the two available "get out of jail"-cards
--- 1aba) the player doesn't have any card - skip the following and proceed at step 1ac
--- 1abba) the player have at least one of the cards and decide to use one - so he will get out for free - proceed at step 1b
--- 1abbb) the player have at least one of the cards, but decide to don't use one - player have to pay
-- 1ac) player has to roll the dice
--- 1aca) if the player rolls doublets (both dice show same number) the player gets out of jail for free and moves the amount of fields the player rolled > step 2
--- 1acb) the player doesn't hit a doublets
---- 1acba) if it's the first or second try nothing else happens - the player can still decide to trade - otherwise turn ends and next player get to move
---- 1acbb) if it's the thrid try, the player didn't used a card and didn't hit a doublets - the player gets out of jail buy paying a fee and moves the amount of fields > step 2
- 1b) if the player is on any other field than "jail" - according to rules the first thing a player has to do is roll the dice and advance the amount of fields
2) check type of field
- 2a) its a corner field
-- 2aa) go - if custom rule is enabeld - player gets double of round fee - otherwise just normal amount > turn ends
-- 2ab) jail - just visit - nothing happens - turn ends
-- 2ac) free parking - action depends on active rule - nothing, fixed amount, taxes, custom rule
-- 2ad) go to jail - player is move back to jail, flag "player in jail" is triggered and turn ends without able to trade
- 2b) taxes - player has to pay taxes - depend on rule if payed to bank or to free parking
- 2c) chance / community chest - action noted on card
- 2d) buyable property
-- 2da) owned by player - player can decide to manage buildings
-- 2db) owned by another player - player has to pay
--- 2dba) special case: if a player doesn't have enough net-worth money (including selling houses and taking mortgages) he may is allowed to trade or ask bank for money - but this is uncommon - usually a player is out and declared bankrouptcy
-- 2dc) not owned at all
--- 2dca) player can decide to buy - if he has enough money to do so
--- 2dcb) player decide to not to buy - or doesn't have money to do so - property is sold by auction (as of official rules: a not owned property has to be sold by auction - although player can agree upon to simple "nothing happens -> next player" - wich, according to google, seems common)
3) after above steps done the active player can decide to start a trade with another player (except for "go to fail" - then turn ends directly) - it's common that a player can manage buildings - although official rules say a player may only manage buildings if it stays on a field of the color group
4) all actions a player is allowed to do - and anything that has to be done mandatory is done - the current turn ends and the next player gets the dice

Looks kind of confusing - and it may contain errors - but this is simply how monopoly round plays. Based on these actions wich has to an can happen at each turn - the session object needs to now the players - and somehow has to connect on wich field the player is on - to decide what to do and to wich field a player moves next after rolling the dice. As on the gui-classes the tokens has to somehow get rendered - there needs to be a connection to tell wich player is on it. Drawing require information about status - so it needs to be kept in sync with the session. I'm not yet sure about how I will implement it.

Also - as I want to implement this project as MVP - it will be based on events. So may following flow helps to awnser last question: A player is selected as active - starts by rolling the dice - wich in its turn triggers the next events (checking field, moving, actions) and finally updates the new game status. So this would be:
- Session.nextPlayer()
- Player.rollDice()
- Session.checkField() -> jail-logic
- Session.movePlayer()
- Session.fieldAction() -> cards, buy, buildings
- Session.update() -> sends out current new status to all player and instances to sync all objects
-> nextPlayer
I would think its maybe a good idea to implement to field-updates - first in the movePlayer() - and second at last call on session-update. So the fields know wich players are on them - the players also know on wich fields they are - wich needs to be kept in sync - and thier internal status (owned, if so by wich player, buildings). I'm still a bit worried about the facilities as the logic has to check when a player lands on one of them if the other is owned at all and if so if its the same or an other player.

So, as I now already needed over 1 hour to right this post - I will think about some sample implementations and how to link the different pieces.

So long ...
3 weeks ago

the reason is you're try to use the wrong protocol on the wrong port.

First: get rid of this line about socketfactory - what you're setting up is smtps - wich is native supported by mail-api
Second: you try to use smtps on smtp/starttls port - so theres a protocol-mismatch

Solution: either use smtps on port 465 or smtp with starttls on 587 - and get rid of this unneeded socketfactory line in either way
Well, you're not using a proper client-certificate / keystore misses private-key. Config of your IIS looks ok.
According to your point 3 you should stop there right now and first gather some information about how ssl works before trying to go any further. Why? Because your 3rd point seems to suggest you lack the needed basic information about modern cryptography to correctly implement it.
4 months ago
So - I tried to implement a server - it just gets worse - but this way I learned how you have to implement certian "fields":

This is org.bouncycastle.tls.DefaultTlsServer

This is org.bouncycastle.tls.DefaultTlsClient:

WHY ?=!

So, to use AES256 with SHA384 you have to override this list - and as its stuck in constructor you have to build your own sub-class:

Also: very important - you have to use an instance of BcTlsCrypto - otherwise when using JcaTlsCrypto the built-in javax.crypto.Cipher is used - wich is then again limited - so no use for BC at all - you simple can'T mix 'em.
What's left: One still has to implement cerificate validation.
This is not how it's supposed to work. A plug-in replacement should handle all this by itself - no need for implementing abstract classes, learning from source cause doc is empty and you can'T hardly find any information - and what you can find is mostly outdated and can't be used anymore - very much thanks @thebclegion - NOT

Ok - as this is same "cracking" as my other code, here you go:
5 months ago
Thank you for your explanation - that's explains why I don't get the expected warning, didn't knew this.

About your question why I need this down-cast: I've generated a KeyPair using KeyPairFactory and only saved the RSAPrivateCrtKey it returns. As such a key is saved not only with modulus and private exponent but also both primes one can re-construct the public exponent from it - wich provides with getPublicExponent(). Why do I need it? Cause there's another method wich needes the public key to this private key.
Sure, I could save the public in a differnt file - I also could just generate two primes by myself, save them, and calculate the rest of the CRT-values myself.
But: If one looks around, almost any other public key implementation (like openSSL or openSSH/PuTTy) simply save the private-key with both primes and re-construct public key from it. So I just thought I follow this "standard". But as Java requires some casting due to its losely coupling I thought it's a good style to check myself before casting cause I thought it's needed. I just didn't knew the standard compiler is built the way you mentioned

telling the compiler: "I know what I'm doing, so shut up and just treat this reference as a different type"

Thanks for clearing it up =D
5 months ago