Could someone add the binary description to the wiki on commodities calculations and/or clarify the binary math point in that wiki entry. It is critical to understanding the math and it is not mentioned at all. Additionally most people wouldn't understand the implications if it was mentioned.
http://wiki.alioth.net/index.php/Commodities.plist
sorry to dig up the old thread but it is the only thing with a decent description of how the calculation in the wiki for commodities actually works...
While McClane's initial description of the binary math in this thread will be nigh impossible for some people to work though, it very clearly illustrates how the calculation is being processed in about as simple of a way as possible. Additionally, it or something very similar is a far more relevant example than what is currently in the wiki. I don't know why I didn't think of binary math when looking at the ampersand but until I managed to dig up this thread I played with the example for a few hours and didn't get anywhere.
example from wiki:
price = (65 + (133 & 7) + (3 * -3)) & 255 = (65 + 5 - 9) & 255 = 61
Using decimal based math how do you modify the initial value of 133 by 7 and result in 5? This does it but didn't make any sense - 1*7+2*7+3*7+4*7+5*7 (drop the remainder since it was less than 6*7) 5 is therefor the number of times that I did some random math pattern that happened to work for that set of numbers... The math also doesn't hold up with significantly different values.
So ... could someone either reference this thread in the wiki, edit the wiki entirely or, ideally, both? I created an account here and on mediawiki and couldn't use either to login so I assume that "users" for the wiki are restricted somehow.
I would edit it similar to this:
"At each market prices and quantities are calculated from values 4..9 and a random value from 0-255 (MARKET_RND) according to a complex series of
binary math steps:"
With the example at the end I would add a link back to this thread with the detailed explanation and/or simply copy/edit that detailed explanation into the thread... Ensure that the ampersand is specifically called out as binary math and that the only numbers in the masks that won't give unexpected results are 1, 3, 7, 15 and rarely 31. Refer people back to
binary math as to why or else they can accept "because I told you so" or maybe a like back to this thread. There are other binary "whole" numbers that would technically work but for the controls in oolite preventing prices and quantities from getting ridiculously high. So while 31 is technically valid it will usually exceed a limit as with 63 and 127.
31 isn't totally out of line since slaves and platinum both use it in the default station. Narcotics even uses 120 but as we have all noticed, narcotics pricing is the most random of all default pricing and tends to be low priced with none available or high priced with lots and if it is "reasonably priced" with some available it usually isn't "worth it". If another commodity acts this way without the benefit of it being illegal it could easily upset price balance.
As to the most recent discussions in this thread... I really don't think that we need to rework how the stuff is calculated so much as have a clear tutorial or guide for folks that don't speak binary. With a clear guide on what numbers are best (use others at your own risk) people will find the system much more use friendly in terms of coding.
Looking through 10 commodities.plists randomly the number of masks that are not 1, 3, 7, 15, 31 etc is extraordinarily high and the people that did them probably aren't sure why their prices do weird stuff randomly. While the con store OXP has all the right numbers for stable prices and so there must be a conflict with another OXP, I first noticed weird pricing behavior in a con store with Food, Textiles and Slaves all slightly above 100 in price. Then it happened 4 or 5 more times over a few game sessions... and so here I am making this post after researching what the heck was going on with that.