Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
N

Narvius

@Narvius
About
Posts
14
Topics
2
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Documentation: link from The Insider
    N Narvius

    That mostly depends on the language I'm using and the purpose I use it for. When I hack something together recreationally in Ruby, I rarely ever comment it (I wrote a maze generator and displayer not so long ago, the only comment in the whole 3-file code is "# First-depth search algorithm") [~400 lines total, all with awesome abstractions that make it possible to generate not only orthogonal but also hexagonal and any other mazes without any adjustments to the generating code whatsoever :D] But when I write C#, I document AT LEAST all public members and functions, also, I never use cryptic function/class/whatever names there (Ruby? Names like "dfs" or "mg" and various instances of "x", "y", "i" and "j" cluttered all over, sometimes overwritten in various scope levels - that said, when I really like what I created, I usually take the time to formalize it a bit, improve and document it. My most polished Ruby product ever was a fully-documented, extensible IRC bot). Also, the short time I was writing Java - full documentation every single time. I'm slightly OCD - if I see there is existing documentation for the existing libraries, I have the need to write similar documentation to my own stuff (while Ruby DOES have pretty thorough documentation, it doesn't rub it in my face as much as C#/VS or Java/Eclipse with it's intellisense). Still - sometimes I enter programming trance mode. In that case, disregard everything I wrote so far and expect swaths of unreadable, over-abstracted code that mysteriously works (or not).

    The Lounge visual-studio com xml help tutorial

  • Some thoughts about AI...
    N Narvius

    I will, thanks!

    The Lounge game-dev database design functional question

  • Some thoughts about AI...
    N Narvius

    I've always wondered why we don't just build a clone/robot/robot clone army and just take what we deserve! :rolleyes:

    The Lounge game-dev database design functional question

  • Some thoughts about AI...
    N Narvius

    Valid points... time to defend myself ;) @Ones and Zeroes. Well, I guess I just wrote it wrongly. My bad. It's true; just because we call a switch in one position a "one" and in another a "zero", doesn't mean others do. Also, just because we perceive it as concrete elements, doesn't mean others do (it's quite possible that space is made of concrete elements, like a grid!) And so on, obviously. In other words, you're right... :) @Human the only possible lifeform / "thoughtform". If I assumed that, I wouldn't ask the questions I ask :D I mean, if that really was the only way, then there would be no reason to doubt whether some intelligent entity would behave human-like.

    The Lounge game-dev database design functional question

  • Some thoughts about AI...
    N Narvius

    :D But I disagree with 3). Unless others do, in which case I'm weird. I used it as "created by us". Which in fact isn't artificial either, since everything is created by something, but that's how the word is usually used. As for 4b) - that might be a step towards the answer, actually :>

    The Lounge game-dev database design functional question

  • Some thoughts about AI...
    N Narvius

    After a few recent influences ("A New Kind of Science" by S. Wolfram, a talk with a friend about gravity, relativity and other esoteric physics stuff, a fascination with Lisp/Scheme and functional programming in general, plus a few crazy ideas I once had about game AI's) I had a few very interesting (I hope) thoughts about AI. In particular, a learning, ie. living AI. I'm pretty sure it is impossible to design one; what I believe though, is that it is possible to create a fundament out of which it will grow (I obviously lack the "how?", or I'd be implementing it instead of rambling nonsense here... ;)). In addition, I'm pretty sure it might exist without us realizing. If it indeed was created by some kind of evolution, it would not be aware of our world. Sure, we use computers to store and manipulate data regarding the real world (yeeeees, it's not that simple... but enough for this context), but how would it know? For it would only see ones and zeroes. We give these ones and zeroes context, it is usually not stored together with the information. The same block of digits could be an image, some text, or a database of McDonalds employees, it really just depends on the interpretation. (at this point it's obvious I disagree with most fiction writers about AI... no "protecthumans-humansarebiggestthreattothemselves-killhumans" or "42!") If that was the case, and assuming we could observe it if it was (which is pretty unlikely), there are a few interesting questions... 1. Would it accidentally destroy itself? 2. Would it, after growing higher-level thought processes, also start to search for a purpose, and/or a reason? 3. How would it interpret messages sent by us (assuming we would be able to, and used the same protocol consistently, probably plain english in ASCII)? 4. How much would these thought processes reflect the human way of thinking? The list goes on. These are just a few I could think of off the top of my head. I'm by no means an expert on the subject, but it seems quite possible to me. Your thoughts? tl;dr: Lots of nonsense about AI that might or might not be possible and also is completely irrelevant. I'm in high school.

    The Lounge game-dev database design functional question

  • Anonymous methods problem
    N Narvius

    After these new insights, I guess I'll have to avoid relying on anonymous methods too much. This sounds like a lot of painful, difficulty-to-pin-down bugs, should something go wrong... :/

    C# question help

  • Anonymous methods problem
    N Narvius

    I've checked it. It always has the scope of the place where it was created.

    public void init()
    {
    int i = 30;
    foo(delegate()
    {
    i = 10;
    });
    Console.WriteLine("i = " + i.ToString());
    Console.ReadKey();
    }

    public void foo(EventHandler awesome)
    {
    awesome();
    }

    This would return "i = 10". This is somehow creepy, because it's a variable local in another method... The same happens if foo is in another class. Additionally, if the creator object doesn't exist anymore... nothing happens:

    using System;
    using System.Collections.Generic;
    using System.Text;

    namespace test2
    {
    class Program
    {
    static void Main(string[] args)
    {
    Thing1 thing1 = new Thing1();
    Thing2 thing2 = thing1.Get2();
    thing1 = null;
    GC.Collect(); // Force Garbage Collection to be sure that thing1 doesn't exist anymore.
    thing2.awesome(null, null);
    return;
    }
    }

    public class Thing1
    {
        public Thing2 Get2()
        {
            Thing2 thing2 = new Thing2();
            thing2.awesome = delegate(object sender, EventArgs args)
            {
                thing2 = null;
            };
            return thing2;
        }
    }
    
    public class Thing2
    {
        public EventHandler awesome;
    }
    

    }

    Cleary, thing1 created the anonymous delegate. I've named the Thing2 variable the same everywhere, to be sure. Main.thing2 didn't turn into null, therefore it affected the non-existing thing1, ie. nothing happened. Also, no crash nor anything of that sort. It obviously has the scope of Thing1.Get2(), again the creator scope. [Edit] I've just noticed. The Garbage Collection doesn't take thing1! The anonymous delegate points to it after all...

    modified on Wednesday, July 1, 2009 2:20 PM

    C# question help

  • Anonymous methods problem
    N Narvius

    I've decided to just use EventArgs containing a reference to the appropiate object whenever it is called. Probably not very elegant, but it works, at least. It seems that anonymous methods have the scope of the creation place, but I'd have to do some research to say for certain...

    C# question help

  • Anonymous methods problem
    N Narvius

    That's not exactly the answer I was hoping for, but I now know how to do it. ...and will do it, after I catch some Z's. It's almost two in the morning, sheesh. Thanks!

    C# question help

  • Anonymous methods problem
    N Narvius

    previously, and it doesn't work. It always affects whatever [target] points to at the calling moment, ie. the wrong object. And I cannot... wait, that's an idea. Is there some way to pass over a pointer to itself together with the anonymous method? Or should I just give it up and think of something else?

    C# question help

  • Copy project files to a new project
    N Narvius

    Visual Studio has an "Add existing..." feature. Create your new project, and right-click the project in the Solution Explorer, select "Add" -> "Existing Item...". Don't manually shift around stuff, *ever*.

    modified on Wednesday, July 1, 2009 3:24 AM

    C# question csharp testing beta-testing help

  • Anonymous methods problem
    N Narvius

    I have two objects. Object A holds an event. Object B assigns an anonymous delegate to Object A's event. I want to access Object A from the code in the anonymous method.

    foreach (Entity target in Entities)
    {
    [...]
    target.OnTouch += new delegate()
    {
    if (Character == '+')
    {
    Character = '/';
    passableBy = PassableFlags.normal;
    }
    return;
    };
    }

    Character and passableBy are properties of [target]. It won't compile, it says that Character and passableBy do not exist in the current context. How can I access properties of the event-holding object? [Edit] Note: This code is in Object B, and [target] point to Object A, for clarification.

    modified on Tuesday, June 30, 2009 4:19 PM

    C# question help

  • Programming for my kids
    N Narvius

    I started by scripting for several interesting games. There's a german game called Clonk, which has a C-like scripting language (www.clonk.de). The obvious advantage is, that it is more motivating, because of instantly visible effects of your work. But that probably only worked for me because I'm weird...

    The Lounge question tutorial discussion
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups