Advertisement Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

498 Neutral

About theOcelot

  • Rank

Personal Information

  • Interests
  1. So far, every tree node just has a self.scope member (which may as well be self.parent). When it sees a name reference, it calls self.scope.reference(the_name), which either returns the name or calls self.scope.reference recursively until there's either a value or a name-not-found exception. This system naturally allows identifier shadowing.
  2. I was planning on leaving it in a format pretty close to a parse tree, so keeping track of dependencies shouldn't be too hard. But if a name is suddenly defined in an inner scope (further in) or otherwise changes where it points, it would be hard to detect that and update. NameReference's are their own nodes. To mark themselves dirty, they would have to detect when any of their containing scopes changes, and the list of containing scopes itself might change. I guess there aren't a lot of shortcuts. Thanks for your help.
  3. I see what you mean about spreadsheets being different. I think what I had in mind with spreadsheets was stuff like: a = 3 b=4 c = 5 foo = a + b bar = foo - c ...and getting the value of bar while preserving the relationships, blah blah. It's much more straightforward to represent everything as functions here. I had kind of forgotten about the halting problem here. Oops. Generally, I did have something functional-ish in mind, but I want the flexibility to do things like the first example, as well. Does that mean caching (and recalculating based on a flag) is going to be the only shortcut, at least for objects like that? I think I should be able to use some of the spreadsheet type tricks too. Are there any specific topics/algorithms I should look up? P.S. I don't want to get hung up on spreadsheets. That's just the only application I could immediately think of with that kind of logic.
  4. I want to implement a data language like the example below, in a way that it can be read from and also modified and reserialized with all the generative structures in place. Please pardon the slightly weird syntax. -- a boolean function. most will be more complicated. f = function(n) n * n == 16 end -- Control structures return streams of key-value pairs, -- which are automatically added to the map, in order. my_map = { foo = 'default value' -- a simple assignment creates a string key for key in ['bar' 'baz' 'foo'] do -- '@' introduces a new key in the map -- for ex. @'foo' = 'bar' is equivalent to foo = bar -- but @ allows non-strings and values of variables to be used as keys @key = 'another value' end if f(4) do foo = 'yet another value' end } What's the value of my_map['foo'], if later definitions of foo override earlier ones? It's not too complicated to just evaluate it all and see it's 'yet another value', but I have to evaluate all the control structures and merge them into the map to be sure. But I might want to keep all of them intact if I reserialize the data. Further suppose I want to allow users to modify this structure, or change the input variables, and show the updated value of foo in real time. I want to dig the correct value out of the control structures without hurting them. The brute-force solution would be to re-evaluate the entire data structure (basically the parse tree) into a separate copy every time it's changed, and query the resulting simplified structure. But that seems inelegant at best, and for larger, more complicated structures it would become inefficient. Caching and updating based on a dirty flag would work, but I don't know if it's the best solution. So basically, the data I want may be locked up in control structures I don't want to destroy. I'm sure this isn't a super hard problem; a typical spreadsheet does something similar with its formulas. What techniques are usually used in situations where you have interconnected data that you want to read and modify? This will be implemented in Python at first, but I hope to do it in C later, and maybe others. Thanks for reading.
  5. theOcelot

    Enumerations in C++

    Do you actually need all those flags all at once? Can't you divide them into sets that are only used in different contexts, and can share values?
  6. Knowing which design features are used across different genres is not the same as knowing how to code them in a way that can be used in games from different genres. On the other hand, a certain amount of decoupling is good just for your own sanity while developing, even if you don't try to re-use stuff.
  7. It won't. Gaining a visceral understanding that the syntax is secondary to what the code actually does can only help you. For that reason, I would encourage you to learn languages with different kinds of syntax, as long as you're learning, at least. Anyway, my personal recommendation is Python. After a long stint with C++, it made programming fun again.
  8. theOcelot

    Compiling C++ on Linux

    For crying out loud, don't run commands without knowing what they are or how they work.
  9. Edit: crud, how do I delete posts now?
  10. And now it's successfully integrated. Now if I can just put an iScroll in each screen...
  11. theOcelot

    .rc files

    I'm not sure how serious you are about that, but you're going to have to get beyond that method and learn to read the directions. There is a ton of documentation about how to do windows menus. Here is probably a good place to start.
  12. ...which provides instructions for laying out divs side to side: Cool. The trick is to have a really, really wide div between the outer one and your items, and then put overflow:hidden on the outer one, as well as putting float:left on the items. Full (basically) minimal example, a slight mishmash of my and Scrollable's requirements with the absolutely essential parts marked: <html> <head> <title>Horizontal Layout</title> <style> body, html{ margin: 0; padding: 0; } #scrollable{ /* required for sideways layout */ overflow: hidden; /* required for jquery tools scrollable */ position: relative; width: 100%; /* any dimensions should do */ height: 100%; } #items{ /* required for sideways layout */ width: 2000em; /* arbitrarily large; can't be too big */ /* required for jquery tools scrollable */ position: absolute;; /* then whatever other properties you need */ height: 100% } .item{ /* required for sideways layout */ float: left; /* then whatever other properties you need */ width: 20em; height: 100%; border: 1px solid black; } </style> </head> <body> <div id="scrollable"> <div id="items"> <div class="item"> I'm in the first box. Use a small browser window to get the full effect. </div> <div class="item"> Second box. </div> <div class="item"> Third box. </div> <div class="item"> You get the idea. </div> <div class="item"> Can you see this one? </div> </div> </div> </body> </html> I'll probably need to use javascript to get the individual pages to be the same size as the screen, since the extra-wide div messes up width:100%, but that's only a slight hack, and I was willing to consider worse. Thank you.
  13. I'm writing a web page which I want to consist of a series of full-page-size screens which slide sideways on and off the screen. This is for simple math tests, but I've seen the same idea in online checkout systems and surveys. I've had trouble implementing it, though. My idea was to make each screen a full-size div, get them to lay out side by side and use CSS animations to move between them. The "side by side" part turned out to be tricky, though. Lots of ways work for divs smaller than the screen, but the always want to wrap when they hit the edge of the screen. I've tried floating them all to the left and making them display:inline-block, I've tried using -webkit-box-orient:horizontal and overflow:hidden on the containing element(s), but it never works. They wind up going down the page. If I absolute-position them and use javascript, I have to move all of them (or at least the two visible at any time) at once to effect the slide. If there's a trick, I'm not getting it. How can I make this work? How is it usually done? Details: long story short, I'm using a mobile webkit browser embedded with a server into a mobile app. Long story:
  14. theOcelot

    Which Language?

    Wait... what? I fail to see how that's not a universal problem. In fact, Python's significant whitespace makes its syntax more "enforced" than most popular languages.[/font] [/quote] Yes the whitespace, but the naming of functions, class naming isn't enforced like you see in C# for example. In Python you can def class Foo, the somewhere else you might soo class foo, etc. [/quote] Hmm, I have not heard of this. Are class names in C# required to be capitalized or CamelCase or something? Cursory googling doesn't tell me much about this.
  15. theOcelot

    Which Language?

    [font=arial, verdana, tahoma, sans-serif][size=2] Wait... what? I fail to see how that's not a universal problem. In fact, Python's significant whitespace makes its syntax more "enforced" than most popular languages.[/font]
  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!