One small step in algorithms

posted in KrisWolfe
Published May 05, 2019
Advertisement

So, from my last update, I got most of it working. Using 3 interfaces, I have the CEO of a company being created, and all the idle employees being placed into the idle panel, along with an empty slot being spawned in order to start getting people managed and working.

ProgressUpdate.thumb.JPG.a2eb1a505b99555e8d04ba3bceedf99a.JPG

Which is all fine and good. I'm pretty happy with how the concept worked out. I had trouble working with interfaces for the first time, because I didn't realize what properties were. When I tried to put a field into an interface, it would kick it back. So I thought I couldn't have guaranteed fields for interfaces. I tried to make get methods, but as I began to work on the display level of the code, it was causing all kinds of problems. I finally looked it up online if I could guarantee fields, and discovered properties and get/setters. I don't really understand what the difference between a field and a property is, as in why you would have fields at all if there are properties in the language, but here we are.

As soon as I put properties into my interfaces, the display code just fell out easily.

So, now I'm at a crossroads. How does the tree know where to place all these card holders onto the board? Clearly we can't have them stacked on top of each other. How does it detect to place an empty? Where does it place it? What if I pull a card out of a slot...does it disappear? Do the other slots need to be reordered? I want to add managers to managers, increasing the tree. Where does it place these cards? Do we start at the bottom or the top?

This is going to require math, unfortunately. I'm going to have to develop some algorithms on detecting which tier of the tree we are at, how many items are in the tree at that tier level, and so forth.

So for now, at a wall. Time to research and figure out how it needs to be displayed.

0 likes 0 comments

Comments

Choo Wagga Choo Choo

I took a simplified version and said, all fields are private. If I want to expose that, I make a property. At the property level, I can control the access of my get and set or not at all. [ref]. Next, when I found out from [here] what could be done in code with the editor interface, the game changed. Check it out a little if you have not already. If your cards are actual game objects, then "tutorial:Building a graph" may be helpful. Something decent under every stone over there.

May 05, 2019 02:08 PM
KrisWolfe
4 minutes ago, GoliathForge said:

I took a simplified version and said, all fields are private. If I want to expose that, I make a property. At the property level, I can control the access of my get and set or not at all. [ref]. Next, when I found out from [here] what could be done in code with the editor interface, the game changed. Check it out a little if you have not already. If your cards are actual game objects, then "tutorial:Building a graph" may be helpful. Something decent under every stone over there.

Thanks for the advice! I'm looking at some code that displays binary trees as well. I'll check out yours as well!

May 05, 2019 02:14 PM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement