As was foretold, we've added advertisements to the forums! If you have questions, or if you encounter any bugs, please visit this thread: https://forums.penny-arcade.com/discussion/240191/forum-advertisement-faq-and-reports-thread/
Options

PA Programming Thread - The Best Servers Are The Ones You Don't Use

1545557596063

Posts

  • Options
    IcemopperIcemopper Registered User regular
    edited March 2011
    bowen wrote: »
    Count like you would in any other base.

    Base 10 digits: 0-9
    Counting in base 10: 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17...

    Base 2 digits : 0-1
    Counting in base 2: 0,1,10,11,100,101,110,111,1000,1001,1010,1011,1101,1111...

    Base 16 digits :0-9,A-F
    Counting in base 16: 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F,10,11,12,13,14,15,16,17,18,19,1A,1B,1C...

    I learned this from the Rama video game when I was like 8, oh my god was that frustrating for someone with no concept of anything besides roman numerals and base 10.

    I would not be surprised if I got some of those wrong too.

    Ok so when you write it out like that it makes so much more sense.

    Thanks! Very very helpful!

    Icemopper on
  • Options
    Jimmy KingJimmy King Registered User regular
    edited March 2011
    Ethea wrote: »
    Bit twiddling and doing bit masks is fairly common in my domain.
    Qt still requires you to understand Bit AND and OR to do anything remotely advanced.
    Yeah, gets used a lot if you're doing network related stuff, too. I wrote a subnet calculator thing as an early android app and the easiest way to do that was just shift bits about. I based my code for that off of a snippet I found of some code from a firewall. I wrote a ping app that can take a subnet rather than single IP and did the same there to determine the range and convert back to IPs.

    Jimmy King on
  • Options
    LittleBootsLittleBoots Registered User regular
    edited March 2011
    Hi, I am retarded.

    I want this sprite (circle) to rotate to face my mouse cursor
    ...
    
    float circleRot = (float)Math.Atan2((circleOrigin.Y - mousePos.Y),(circleOrigin.X - mousePos.X));
    
    ...
    
    spriteBatch.Draw(testCircle, circleLoc, null, Color.Wheat, circleRot,new Vector2(testCircle.Width/2,testCircle.Height/2),1,SpriteEffects.None,0);
    
    ...
    

    Now, this rotates, but not towards my cursor. Why doesn't this work? Please help un-retard me.
    Thank you.

    LittleBoots on

    Tofu wrote: Here be Littleboots, destroyer of threads and master of drunkposting.
  • Options
    InfidelInfidel Heretic Registered User regular
    edited March 2011
    Hi, I am retarded.

    I want this sprite (circle) to rotate to face my mouse cursor
    
    ...
    
    float circleRot = (float)Math.Atan2((circleOrigin.Y - mousePos.Y),(circleOrigin.X - mousePos.X));
    
    ...
    
    spriteBatch.Draw(testCircle, circleLoc, null, Color.Wheat, circleRot,new Vector2(testCircle.Width/2,testCircle.Height/2),1,SpriteEffects.None,0);
    
    ...
    

    Now, this rotates, but not towards my cursor. Why doesn't this work? Please help un-retard me.
    Thank you.

    Are you keeping in mind that your sprite is probably oriented with 0 radians rotation meaning "face straight up" but 0 radians is actually pointing in the positive x direction?

    Assuming you made a sprite that points up when not rotated.

    Infidel on
    OrokosPA.png
  • Options
    LittleBootsLittleBoots Registered User regular
    edited March 2011
    Infidel wrote: »
    Hi, I am retarded.

    I want this sprite (circle) to rotate to face my mouse cursor
    ...
    
    float circleRot = (float)Math.Atan2((circleOrigin.Y - mousePos.Y),(circleOrigin.X - mousePos.X));
    
    ...
    
    spriteBatch.Draw(testCircle, circleLoc, null, Color.Wheat, circleRot,new Vector2(testCircle.Width/2,testCircle.Height/2),1,SpriteEffects.None,0);
    
    ...
    

    Now, this rotates, but not towards my cursor. Why doesn't this work? Please help un-retard me.
    Thank you.

    Are you keeping in mind that your sprite is probably oriented with 0 radians rotation meaning "face straight up" but 0 radians is actually pointing in the positive x direction?

    Assuming you made a sprite that points up when not rotated.

    No, No I wasn't. Now that I am it is working. Thank you sir.

    EDIT: what I don't understand is that I set the rotation to 0 radians right after I create the sprite yet it still draws it at pi/2 radians initially.
    EDIT EDIT: NM, that's stupid. I get it now.

    LittleBoots on

    Tofu wrote: Here be Littleboots, destroyer of threads and master of drunkposting.
  • Options
    InfidelInfidel Heretic Registered User regular
    edited March 2011
    Infidel wrote: »
    Hi, I am retarded.

    I want this sprite (circle) to rotate to face my mouse cursor
    
    ...
    
    float circleRot = (float)Math.Atan2((circleOrigin.Y - mousePos.Y),(circleOrigin.X - mousePos.X));
    
    ...
    
    spriteBatch.Draw(testCircle, circleLoc, null, Color.Wheat, circleRot,new Vector2(testCircle.Width/2,testCircle.Height/2),1,SpriteEffects.None,0);
    
    ...
    

    Now, this rotates, but not towards my cursor. Why doesn't this work? Please help un-retard me.
    Thank you.

    Are you keeping in mind that your sprite is probably oriented with 0 radians rotation meaning "face straight up" but 0 radians is actually pointing in the positive x direction?

    Assuming you made a sprite that points up when not rotated.

    No, No I wasn't. Now that I am it is working. Thank you sir.

    EDIT: what I don't understand is that I set the rotation to 0 radians right after I create the sprite yet it still draws it at pi/2 radians initially.
    EDIT EDIT: NM, that's stupid. I get it now.

    Yeah, it seemed likely what you were doing because that is what everyone does!

    0 radians = no rotation = up!

    But not, because of MATH! Silly quadrants...

    Infidel on
    OrokosPA.png
  • Options
    LittleBootsLittleBoots Registered User regular
    edited March 2011
    Okay, upon further fiddling I found something out.

    Setting a rotation of 0 IS initially pointing up if you're not retarded like me and just let XNA do it's thing.

    The problem I was having is that in my rotation code I was calculating my tangent from the sprites origin, I was then using that to get the rotation. I then passed that rotation and the sprites origin to the draw method. Turns out, if you just calc the tangent from the sprites location (upper left corner of it's bounding rect) and pass that with the sprites origin to the draw method it takes care of the rest (allowing you to use 0 rads as up).

    LittleBoots on

    Tofu wrote: Here be Littleboots, destroyer of threads and master of drunkposting.
  • Options
    InfidelInfidel Heretic Registered User regular
    edited March 2011
    Okay, upon further fiddling I found something out.

    Setting a rotation of 0 IS initially pointing up if you're not retarded like me and just let XNA do it's thing.

    The problem I was having is that in my rotation code I was calculating my tangent from the sprites origin, I was then using that to get the rotation. I then passed that rotation and the sprites origin to the draw method. Turns out, if you just calc the tangent from the sprites location (upper left corner of it's bounding rect) and pass that with the sprites origin to the draw method it takes care of the rest (allowing you to use 0 rads as up).

    Well yes, 0 rads has always been up, if that's what the unrotated orientation of the sprite is. (Usually the case.)

    The discrepancy is that if you pass a positive Y and a zero X to atan, you get pi/2, not 0.

    You would likely want to be calculating your X/Y for finding the degree by taking mouse X/Y and subtracting the X/Y of the origin of your sprite (in screen space, so location+origin) since the origin is where it will rotate the sprite.

    Infidel on
    OrokosPA.png
  • Options
    LittleBootsLittleBoots Registered User regular
    edited March 2011
    Actual I subtract the Mouse(x,y) from the sprites origin. If I do it the other way round it goes wonky on me.

    Having a new problem now:
    Maths are weird :(

    LittleBoots on

    Tofu wrote: Here be Littleboots, destroyer of threads and master of drunkposting.
  • Options
    Gandalf_the_CrazedGandalf_the_Crazed Vigilo ConfidoRegistered User regular
    edited March 2011
    OK, I think I've worked out a C# coordinate system for use in a tactical game or similar program.

    In plain speech, I create a 50x50x10 int[] array. Then I use a for-loop to assign a unique integral value to each slot in the array. Then, each of those values is made an entry in a dictionary. Using the mathematical patterns of those integral values, the dictionary entry is given an X, Y, and Z value.

    Now that I've done it for myself, I feel more comfortable asking: Is there a more efficient way to do this?

    (spoiler'd for long)
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    
    namespace Combat
    {
        
        
    
        public class Coordinate
        {public int X;
            public int Y;
            public int Z;
        }
    
        class Startup
        {
            public static Dictionary<int, Coordinate> Coordinates = new Dictionary<int, Coordinate>();
    
            public static void Main()
            {
                CreateMap();
            }
            
    
            public static void CreateMap()
            {  int x = 0;
                int y = 0;
                int z = 0;
                
                var Grid = new int[50,50,10];
    
                for (z = 0; z < 50 ; z++) // Assigns a unique value to each item in Grid[]
                    for (y = 0; y < 50; y++)
                        for (x = 0; x < 10; x++)
                        {
                            int i = 0;
                            Grid[x, y, z] = i;
                            i++;
                        }
    
                foreach (int a in Grid) // Declares those values as entries in the Coordinates Dictionary
                    {
                        Coordinates.Add(a, new Coordinate());
                    }
                foreach (int C in Grid){
                        Coordinates[C].X = C &#37; 50;
                        Coordinates[C].Y = (int) Math.Floor(((decimal)C % 2500) / 50);
                        Coordinates[C].Z = (int) Math.Floor((decimal)C / 2500);
                }
            }
        }
    }
    

    Gandalf_the_Crazed on
    PEUsig_zps56da03ec.jpg
  • Options
    SmasherSmasher Starting to get dizzy Registered User regular
    edited March 2011
    Actual I subtract the Mouse(x,y) from the sprites origin. If I do it the other way round it goes wonky on me.

    Having a new problem now:
    Maths are weird :(

    Judging by the behavior, the angle is being stored as a value from -pi to pi radians. Your code (or perhaps the code you're calling?) is interpolating between where the circle is currently facing and where it should be facing, but when your angle goes from pi-a to pi+b (for small values of a and b) the latter gets converted to -pi+b, and the angle has to go all the way down from pi-a to -pi+b.

    Probably the simplest way to fix this is to keep track of the previous angle and see if the difference between the old one and the new one is greater than pi; if it is, either add or subtract pi (if you went from pi to -pi or vice versa, respectively) when you're giving the interpolation code the value to interpolate to.

    Smasher on
  • Options
    Gandalf_the_CrazedGandalf_the_Crazed Vigilo ConfidoRegistered User regular
    edited March 2011
    HOLY FUCK SO EXCITED.

    I just got my pathfinding method (an implementation of the A* search algorithm) working. It's putting out beautiful straight paths between two points.

    Now I just have to expand it into 3 dimensions and have it account for blocked squares, but those are pretty easy exceptions to insert.

    Gandalf_the_Crazed on
    PEUsig_zps56da03ec.jpg
  • Options
    seabassseabass Doctor MassachusettsRegistered User regular
    edited March 2011
    HOLY FUCK SO EXCITED.

    I just got my pathfinding method (an implementation of the A* search algorithm) working. It's putting out beautiful straight paths between two points.

    Now I just have to expand it into 3 dimensions and have it account for blocked squares, but those are pretty easy exceptions to insert.

    If you're doing pathfinding on game boards and you need optimal paths, fringe search is about twice as fast so long as you don't have differing costs associated with moving through the various squares (like terrain costs for example). It's pretty straight forward, or at least it isn't much more challenging than A*.

    seabass on
    Run you pigeons, it's Robert Frost!
  • Options
    DietarySupplementDietarySupplement Still not approved by the FDA Dublin, OHRegistered User regular
    edited March 2011
    Hey guys, I lurk around this thread from time to time and get some tips and such, but I'm looking for your help with a programming concept that you guys will probably laugh at:

    Pointers in C.

    Specifically, I am talking about pointers in Objective-C (for iOS and iPhone/iPad) but I think as a starting point, I just want to talk about pointers in general. I'll provide a little background in the spoiler (which you can either read of skip; just a little mini-auto-bio of my programming experience so you can see where I'm coming from.
    I have a background in C, and I do tons of writing for the web today in ASP/Javascript. I understand some of more advanced topics such as arrays, functions, even classes and object oriented stuff. So in reading books and things like that, I have a pretty easy time transitioning things from C/C# into Objective-C; the syntax isn't all too different and in working through the examples the debugger does a good job of keeping in check; so far it's been pretty easy. I still have no idea how I'm going to take my idea from concept to actual code but for now I'm just brushing up and writing simple console apps until I get a better grasp on the cocoa framework. But all of the books I read keep speaking to memory management and it's not something I've ever had to contend with.

    At any rate, I've never had a problem understanding what pointers are (by definition), but when I should use them. In all the material I've read on iOS development, "garbage collection/memory management" is pretty well organized within iOS... but not on the mobile platform of iPhone/iPad, which means actually allocating and de-allocating memory will something I have to deal with. And pointers seem to be key at this.

    From what I've read, pointers are key because you can reference them between different objects...? If that makes any sense. Does anyone have any real world examples?

    DietarySupplement on
  • Options
    StarfuckStarfuck Registered User, ClubPA regular
    edited March 2011
    I'm at a developer summit in Palm Springs this week. Not sure if I heard that right, but does Windows Phone 7 not support copy/paste?

    Starfuck on
    jackfaces
    "If you're going to play tiddly winks, play it with man hole covers."
    - John McCallum
  • Options
    InfidelInfidel Heretic Registered User regular
    edited March 2011
    Starfuck wrote: »
    I'm at a developer summit in Palm Springs this week. Not sure if I heard that right, but does Windows Phone 7 not support copy/paste?

    It's coming in the next update!

    Infidel on
    OrokosPA.png
  • Options
    Joe KJoe K Registered User regular
    edited March 2011
    bowen wrote: »
    I wouldn't say I hate Python. Just like I don't hate dealing with debugging. It's just an annoying part of my memory and knowledge.

    I've been told that it's a good first language to pick up. I'm about 30% of the way through the textbook at this point. Not that I'll be done learning it by any stretch, but I wonder what I should pick up next.

    People are telling me C# and Java and Perl and PHP to a lesser extent. Suggestions?

    Python is a good language to begin with. It's not gimped like Java and C#, and well, PHP is PHP...

    If you really want to dig on languages, learn c/c++

    Joe K on
  • Options
    Monkey Ball WarriorMonkey Ball Warrior A collection of mediocre hats Seattle, WARegistered User regular
    edited March 2011
    Joe K wrote: »
    bowen wrote: »
    I wouldn't say I hate Python. Just like I don't hate dealing with debugging. It's just an annoying part of my memory and knowledge.

    I've been told that it's a good first language to pick up. I'm about 30% of the way through the textbook at this point. Not that I'll be done learning it by any stretch, but I wonder what I should pick up next.

    People are telling me C# and Java and Perl and PHP to a lesser extent. Suggestions?

    Python is a good language to begin with. It's not gimped like Java and C#, and well, PHP is PHP...

    If you really want to dig on languages, learn c/c++

    I'm having a blast with Go, but there's quite a few rough edges and installing it is non-intuitive if you're not used to mercurial. There's also no IDE's for it. I've just been using gedit or notepad++, (both of which have syntax highlighting if you find and download a definition file).

    It's pretty easy though, syntactically. And I'm really very interested in concurrent programming, so it's right up my alley.

    C is a big deal though. C teaches you about pointers. And memory management. And respect for your elders :p

    Monkey Ball Warrior on
    "I resent the entire notion of a body as an ante and then raise you a generalized dissatisfaction with physicality itself" -- Tycho
  • Options
    IcemopperIcemopper Registered User regular
    edited March 2011
    C is a big deal though. C teaches you about pointers. And memory management. And respect for your elders :p

    Yeah, I'm finding out that C is a massive undertaking, and I haven't even gotten to the point where I'm coding anything yet. I'm just finding out how incredibly deep/important binary really is.

    Speaking of which, I really really appreciate the help asimperson is giving on binary/everything. They're really going above and beyond. Very impressive.

    Icemopper on
  • Options
    EchoEcho ski-bap ba-dapModerator mod
    edited March 2011
    I want to read the volume label of a mounted CD from Ruby. Google gives me absolutely nothing useful. Any suggestions?

    Closest thing was calling system stuff like volname and blkid, but those are platform-specific binaries that may or may not require certain packages installed.

    Echo on
  • Options
    InfidelInfidel Heretic Registered User regular
    edited March 2011
    Echo wrote: »
    I want to read the volume label of a mounted CD from Ruby. Google gives me absolutely nothing useful. Any suggestions?

    Closest thing was calling system stuff like volname and blkid, but those are platform-specific binaries that may or may not require certain packages installed.

    I think you'll have to rely on something platform specific for that.

    Infidel on
    OrokosPA.png
  • Options
    bowenbowen How you doin'? Registered User regular
    edited March 2011
    So I feel Python and me have a bad synergy with each other, and I'd like to get to know him better.

    GUIs in python, what should I use?

    http://dabodev.com/ ?
    http://pymt.eu/ (this one looks neat for touchscreen monitors) ?

    Also, iPad with python, yea or nay? Is this a thing, or, is it even possible? I am really putting off learning Obj-C.

    bowen on
    not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
  • Options
    EchoEcho ski-bap ba-dapModerator mod
    edited March 2011
    Infidel wrote: »
    Echo wrote: »
    I want to read the volume label of a mounted CD from Ruby. Google gives me absolutely nothing useful. Any suggestions?

    Closest thing was calling system stuff like volname and blkid, but those are platform-specific binaries that may or may not require certain packages installed.

    I think you'll have to rely on something platform specific for that.

    Coming to the same conclusion. Oh well, time to install MacFuse and fiddle with sshfs. Just developing on this Mac - the final thing will run on Linux.

    Writing a backup doodad for backing up a billion old CDs going back to 1998. Those discs won't last forever, so we want them on networked backup.

    It's not as easy as just copying it all, I need an index of what's on them as well so I can find stuff when you can't just grab the CD labeled "512-0149" from a big box.

    Echo on
  • Options
    iTunesIsEviliTunesIsEvil Cornfield? Cornfield.Registered User regular
    edited March 2011
    Echo wrote: »
    Infidel wrote: »
    Echo wrote: »
    I want to read the volume label of a mounted CD from Ruby. Google gives me absolutely nothing useful. Any suggestions?

    Closest thing was calling system stuff like volname and blkid, but those are platform-specific binaries that may or may not require certain packages installed.

    I think you'll have to rely on something platform specific for that.

    Coming to the same conclusion. Oh well, time to install MacFuse and fiddle with sshfs. Just developing on this Mac - the final thing will run on Linux.

    Writing a backup doodad for backing up a billion old CDs going back to 1998. Those discs won't last forever, so we want them on networked backup.

    It's not as easy as just copying it all, I need an index of what's on them as well so I can find stuff when you can't just grab the CD labeled "512-0149" from a big box.
    If naming archived audio cd's is the goal here maybe you can look at Ruby for a CDDB implementation?

    iTunesIsEvil on
  • Options
    EtheaEthea Registered User regular
    edited March 2011
    bowen wrote: »
    So I feel Python and me have a bad synergy with each other, and I'd like to get to know him better.

    GUIs in python, what should I use?

    http://dabodev.com/ ?
    http://pymt.eu/ (this one looks neat for touchscreen monitors) ?

    Also, iPad with python, yea or nay? Is this a thing, or, is it even possible? I am really putting off learning Obj-C.

    I like PyQt for classic GUI interfaces.

    Ethea on
  • Options
    BarrakkethBarrakketh Registered User regular
    edited March 2011
    Ethea wrote: »
    bowen wrote: »
    So I feel Python and me have a bad synergy with each other, and I'd like to get to know him better.

    GUIs in python, what should I use?

    http://dabodev.com/ ?
    http://pymt.eu/ (this one looks neat for touchscreen monitors) ?

    Also, iPad with python, yea or nay? Is this a thing, or, is it even possible? I am really putting off learning Obj-C.

    I like PyQt for classic GUI interfaces.
    Or PySide, for those who find the GPL-only license of PyQt too restrictive.

    Barrakketh on
    Rollers are red, chargers are blue....omae wa mou shindeiru
  • Options
    InfidelInfidel Heretic Registered User regular
    edited March 2011
    Echo wrote: »
    Infidel wrote: »
    Echo wrote: »
    I want to read the volume label of a mounted CD from Ruby. Google gives me absolutely nothing useful. Any suggestions?

    Closest thing was calling system stuff like volname and blkid, but those are platform-specific binaries that may or may not require certain packages installed.

    I think you'll have to rely on something platform specific for that.

    Coming to the same conclusion. Oh well, time to install MacFuse and fiddle with sshfs. Just developing on this Mac - the final thing will run on Linux.

    Writing a backup doodad for backing up a billion old CDs going back to 1998. Those discs won't last forever, so we want them on networked backup.

    It's not as easy as just copying it all, I need an index of what's on them as well so I can find stuff when you can't just grab the CD labeled "512-0149" from a big box.
    If naming archived audio cd's is the goal here maybe you can look at Ruby for a CDDB implementation?

    Yeah, if we're talking audio CD, you don't want the volume label, you want a CDDB.

    Infidel on
    OrokosPA.png
  • Options
    EchoEcho ski-bap ba-dapModerator mod
    edited March 2011
    Nah, it's backup CDs with images on them.

    And turns out random samples shows not all of them are properly labeled anyway. Since this will end up with lots of swapping CDs to read (I slapped together a computer with 5 DVD readers), I'll just have a prompt for the volume name when running the script - the disc cases are all properly labeled.

    Echo on
  • Options
    iTunesIsEviliTunesIsEvil Cornfield? Cornfield.Registered User regular
    edited March 2011
    Ah, m'bad. I read "CD's" and just assumed you meant audio CD's.

    iTunesIsEvil on
  • Options
    InfidelInfidel Heretic Registered User regular
    edited March 2011
    Echo wrote: »
    Nah, it's backup CDs with images on them.

    And turns out random samples shows not all of them are properly labeled anyway. Since this will end up with lots of swapping CDs to read (I slapped together a computer with 5 DVD readers), I'll just have a prompt for the volume name when running the script - the disc cases are all properly labeled.

    Since this seems like it's to automate a one-shot job, why are you worried about platform independence? :)

    I'd get it working, and then when you insert a CD, present a textbox with the label that was read in it, giving the user the ability to confirm or edit and continue.

    Infidel on
    OrokosPA.png
  • Options
    EchoEcho ski-bap ba-dapModerator mod
    edited March 2011
    Infidel wrote: »
    Since this seems like it's to automate a one-shot job, why are you worried about platform independence? :)

    Writing it on a Mac, the actual computer it'll run on runs Linux. Also, because I want to learn some ruby while I'm at it. :P
    Infidel wrote: »
    I'd get it working, and then when you insert a CD, present a textbox with the label that was read in it, giving the user the ability to confirm or edit and continue.

    Yeah, went for a prompt instead.

    Tried it on a random DVD from the pile. Took 11 minutes.

    I'll bring a book for when I start the actual run. :P

    Echo on
  • Options
    bowenbowen How you doin'? Registered User regular
    edited March 2011
    Barrakketh wrote: »
    Ethea wrote: »
    bowen wrote: »
    So I feel Python and me have a bad synergy with each other, and I'd like to get to know him better.

    GUIs in python, what should I use?

    http://dabodev.com/ ?
    http://pymt.eu/ (this one looks neat for touchscreen monitors) ?

    Also, iPad with python, yea or nay? Is this a thing, or, is it even possible? I am really putting off learning Obj-C.

    I like PyQt for classic GUI interfaces.
    Or PySide, for those who find the GPL-only license of PyQt too restrictive.

    Ah that makes me feel happy.

    Is there a Py2exe for more than just windows? I really don't like to have people install runtimes and all that jazz if I can help it.

    bowen on
    not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
  • Options
    BarrakkethBarrakketh Registered User regular
    edited March 2011
    bowen wrote: »
    Barrakketh wrote: »
    Ethea wrote: »
    bowen wrote: »
    So I feel Python and me have a bad synergy with each other, and I'd like to get to know him better.

    GUIs in python, what should I use?

    http://dabodev.com/ ?
    http://pymt.eu/ (this one looks neat for touchscreen monitors) ?

    Also, iPad with python, yea or nay? Is this a thing, or, is it even possible? I am really putting off learning Obj-C.

    I like PyQt for classic GUI interfaces.
    Or PySide, for those who find the GPL-only license of PyQt too restrictive.

    Ah that makes me feel happy.

    Is there a Py2exe for more than just windows? I really don't like to have people install runtimes and all that jazz if I can help it.
    cx_Freeze claims to support *nix variants. Documentation, sucks, though.

    Something I stumbled across was PyInstaller, but I've never used it before. I might give it a try, though.

    Barrakketh on
    Rollers are red, chargers are blue....omae wa mou shindeiru
  • Options
    EtheaEthea Registered User regular
    edited March 2011
    Barrakketh wrote: »
    Ethea wrote: »
    bowen wrote: »
    So I feel Python and me have a bad synergy with each other, and I'd like to get to know him better.

    GUIs in python, what should I use?

    http://dabodev.com/ ?
    http://pymt.eu/ (this one looks neat for touchscreen monitors) ?

    Also, iPad with python, yea or nay? Is this a thing, or, is it even possible? I am really putting off learning Obj-C.

    I like PyQt for classic GUI interfaces.
    Or PySide, for those who find the GPL-only license of PyQt too restrictive.

    I haven't kept up with Python Qt development, been in C++ land only for a year now. PySide looks pretty nice.

    Ethea on
  • Options
    EtheaEthea Registered User regular
    edited March 2011
    Barrakketh wrote: »
    bowen wrote: »
    Barrakketh wrote: »
    Ethea wrote: »
    bowen wrote: »
    So I feel Python and me have a bad synergy with each other, and I'd like to get to know him better.

    GUIs in python, what should I use?

    http://dabodev.com/ ?
    http://pymt.eu/ (this one looks neat for touchscreen monitors) ?

    Also, iPad with python, yea or nay? Is this a thing, or, is it even possible? I am really putting off learning Obj-C.

    I like PyQt for classic GUI interfaces.
    Or PySide, for those who find the GPL-only license of PyQt too restrictive.

    Ah that makes me feel happy.

    Is there a Py2exe for more than just windows? I really don't like to have people install runtimes and all that jazz if I can help it.
    cx_Freeze claims to support *nix variants. Documentation, sucks, though.

    Something I stumbled across was PyInstaller, but I've never used it before. I might give it a try, though.

    I used PyInstaller about 2 years ago. I don't remember significant issues to setup an single click executable. I think our team spent ~16 hours learning PyInstaller and setting up the scripts to build the executable which we than used a a base for other projects we had.

    Ethea on
  • Options
    EvilMonkeyEvilMonkey Registered User regular
    edited March 2011
    OK, I think I've worked out a C# coordinate system for use in a tactical game or similar program.

    In plain speech, I create a 50x50x10 int[] array. Then I use a for-loop to assign a unique integral value to each slot in the array. Then, each of those values is made an entry in a dictionary. Using the mathematical patterns of those integral values, the dictionary entry is given an X, Y, and Z value.

    Now that I've done it for myself, I feel more comfortable asking: Is there a more efficient way to do this?

    (spoiler'd for long)
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    
    namespace Combat
    {
        
        
    
        public class Coordinate
        {public int X;
            public int Y;
            public int Z;
        }
    
        class Startup
        {
            public static Dictionary<int, Coordinate> Coordinates = new Dictionary<int, Coordinate>();
    
            public static void Main()
            {
                CreateMap();
            }
            
    
            public static void CreateMap()
            {  int x = 0;
                int y = 0;
                int z = 0;
                
                var Grid = new int[50,50,10];
    
                for (z = 0; z < 50 ; z++) // Assigns a unique value to each item in Grid[]
                    for (y = 0; y < 50; y++)
                        for (x = 0; x < 10; x++)
                        {
                            int i = 0;
                            Grid[x, y, z] = i;
                            i++;
                        }
    
                foreach (int a in Grid) // Declares those values as entries in the Coordinates Dictionary
                    {
                        Coordinates.Add(a, new Coordinate());
                    }
                foreach (int C in Grid){
                        Coordinates[C].X = C &#37; 50;
                        Coordinates[C].Y = (int) Math.Floor(((decimal)C % 2500) / 50);
                        Coordinates[C].Z = (int) Math.Floor((decimal)C / 2500);
                }
            }
        }
    }
    
    My first reaction to your creation of Grid is that you have a scope problem, that is every entry in your 3D array is 0 after the for x/y/z loop. But lets assume I'm wrong since you say it's working. If the end goal is to create a 50x50x10 list of "id'd" Coordinate objects then you could have done it in less pass-throughs...
    int cntr = 0;
    for (int x = 0; x < MAX_X; x++)
    {
         for (int y = 0; y < MAX_Y; y++)
         {
              for (int z = 0; z < MAX_Z; z++)
              {
                   Coordinate c = new Coordinate();
                   c.X = cntr % 50;
                   c.Y = (int) Math.Floor(((decimal)cntr % 2500) / 50);
                   c.Z = (int) Math.Floor((decimal)cntr / 2500);
                   Coordinates.add(cntr, c);
                   cntr++;
              }
         }
    }
    
    How is this being accessed? It just feels odd that you create this 3D array that gets thrown away in favor of the dictionary.

    EvilMonkey on
    [PSN: SciencePiggy] [Steam]
  • Options
    durandal4532durandal4532 Registered User regular
    edited March 2011
    Okay, finally have time to work on this again, still crazy.

    Set I = "$I"\"\[14\"

    Works fine and produces FILE"[14".

    Set I = "$I"\"\[14\]\"

    Throws a no match error. As far as I can tell because some asshole decided no one would really actually want to escape a pair of brackets in tcsh. Anyone see an obvious screwup?

    durandal4532 on
    Take a moment to donate what you can to Critical Resistance and Black Lives Matter.
  • Options
    InfidelInfidel Heretic Registered User regular
    edited March 2011
    Or for that matter, just skip cntr and calculate your index like a real man.

    But seriously, why use division to calculate your X/Y/Z back from an integer when you already have them.

    Infidel on
    OrokosPA.png
  • Options
    InfidelInfidel Heretic Registered User regular
    edited March 2011
    Okay, finally have time to work on this again, still crazy.

    Set I = "$I"\"\[14\"

    Works fine and produces FILE"[14".

    Set I = "$I"\"\[14\]\"

    Throws a no match error. As far as I can tell because some asshole decided no one would really actually want to escape a pair of brackets in tcsh. Anyone see an obvious screwup?

    Try '[14]', single quotes.

    Infidel on
    OrokosPA.png
  • Options
    EvilMonkeyEvilMonkey Registered User regular
    edited March 2011
    Infidel wrote: »
    Or for that matter, just skip cntr and calculate your index like a real man.

    But seriously, why use division to calculate your X/Y/Z back from an integer when you already have them.
    I entirely ignored that section, this just gets odder and odder. We're through the looking glass here people!

    Edit: I've had entirely too much cold medication.

    EvilMonkey on
    [PSN: SciencePiggy] [Steam]
This discussion has been closed.