Added the function to place citizen in the plot they were randomly assigned to. Unfortunately, I’m getting some TypeErrors elsewhere. It’s pretty late and I think these will have to be addressed at a future date.
So far, City Builder only does a few things:
- Generate a list of people with a distribution of wealths around an average, it
- Build a grid of land plots with a base “value”
- When a citizen is put into a plot, increase the value of the plots around it
The steps today were to start the algorithm that decides where to place each citizen. It creates a list that contains all of the plots in the grid. As each plot is added to the list, a Probability Counter increments by the value of the plot. When a citizen is being place, a random number is generated, less than the end value of the counter. If the random number is <=Vplot1 (value of the first plot), then the first plot is chose. If the number is >Vplot1 but <=(Vplot2+Vplot1) then the 2nd plot is chosen, and so on.
This isn’t completely finished, but the start is there.
A significant portion of my responsibilities as Praktikant this year involve programming using Pascal. Though Pascal is simple to learn and very well documented (a blessing for someone with scant programming experience), I have opted to use a more modern language for my hobbyist projects. And so far, Python has been wonderful.
My first project using python was to create a Connect Four clone. Since the rules and outcomes were already generously provided by Milton Bradley, I could focus on learning my way around the python syntax and functionality. After an couple afternoons of work, two players could face each other in brutal text-based, four-in-a-row combat on the 6x7 grid battlefield.
Basking in a glow of self-given praise, I sought forth to my next grand development. Unfortunately, I quickly ran into the problem of not knowing where to start. I settled to scale down my plans and create a small tool that may one day find itself mingling with other small tools who start thinking they ought to band together and form themselves a Game.
The aptly named City Builder is a tool that aspires to take a group of wealth-distributed people and a plot of terrain, and place those to-be citizens in according to the cost and value of the land. Wealthy will clump together around the more valuable pieces of land, while the poorer citizens will be fored to the outskirts. I hope to implement some randomness in the distribution that could provide for some interesting town developments.
I’ll post the source to Github as I work on it. Github has the feature of displaying update day “streaks”. As someone who loves increasing arbitrary numbers, I cannot dare to let my streak crash down to 0.
The Daily Commit is a way of encouraging daily updates to City Builder and other future projects, by providing a platform for small but regular posts about their development. [edit 9/24/13 ended due to constantly changing projects. I hope to continue to post regularly, but having a daily commitment was a little too much structure for my scattered planning]
The citizens of City await their newly valued homes!