Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Poll

What programming topic would you want the next challenge to be about?  (It might be a good opportunity to focus on a subject you're not familiar with or to reinforce knowledge on one that you already know)

Control Flow
- 2 (2.2%)
Arrays, Strings, Pointers, and References
- 8 (9%)
Functions
- 4 (4.5%)
Basic object-oriented programming
- 30 (33.7%)
A bit more advanced OOP (Composition, Operator overloading, Inheritance, Virtual Functions)
- 18 (20.2%)
Templates
- 8 (9%)
Other (Explain)
- 4 (4.5%)
Working with files?  (Streams)
- 15 (16.9%)

Total Members Voted: 89


Pages: 1 ... 8 9 [10] 11 12 ... 78

Author Topic: Programming Challenges & Resources (#bay12prog) Initiative  (Read 97570 times)

Blacken

  • Bay Watcher
  • Orange Polar Bear
    • View Profile
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #135 on: May 29, 2010, 11:00:34 pm »

I am curious what coursework you would come up for 'normal people', Blacken. I do not plan to take up programming as anything more than a hobby (I don't think I have the constitution for it. I hear terrible things about EECS); and although I have done one or two things on that list (making my first doubly-linked list was an absolute joy), I'm not sure it would serve to benefit the majority of people, as you yourself have pointed out. If you had to come up with a list of challenges for someone like me, who use programming as a way to offload tasks to a computer (i.e. writing shell scripts or using R), what would you suggest?
I don't honestly know: my only work with academic type stuff was hacking on some Python for an informatics professor's VR sim, and hell: I can barely write a shell script myself. I can muddle along in tcsh, but not all that well. Never had a real need. The person on this forum who's probably most knowledgeable about this is either Nadaka or Baughn, I don't know if they read this thread.

As I think about it--and here I'm sort of thinking out loud, to give you an idea of the way I'm going about it--it seems like being able to dispatch a lot of relatively easy stuff at once is important. If you're using R, I have no idea how this is done; using anything else it seems like you should be able to batch together data and send it off to a process of some kind. If I were doing it, I'd hack together something that could either fork a lot of processes or spawn a lot of threads to process chunks of the data, based on how big my data set is and how multi- my multi-processor setup is (I can spawn a lot more threads on the 5000-core supercomputer I have access to than I can my 4-core laptop!). It seems like data representation in structural formats is still fairly important, but the intensity of the data structures and algorithms I included in that list would likely be very much overkill.

I'll ping DrPizza and ask him to comment, he might have some ideas.

Quote
And what about for artsy liberal types who might not use anything more than something drag-and-drop like (note: I shuddered too) Game Maker? What would you say are the most important tenets that they would have to learn in order to quickly get up to speed? I think we are well in agreement that "do as I do" lessons and tutorials tend to teach very little, but unfortunately those are the most common out there.
Honestly? If they're serious about learning to program, I'd say that they should gut out that list as much as possible. The mathematics of it can be a bit skiffy; my own grasp of the mathematics behind it is weaker than it should be, so I can definitely relate. But really, if they want to make games or do anything similar, what that teaches is absolutely fundamental. They may use it in a more abstract way, but knowing it is beyond valuable. My game team's art/design guy at least knows most of those basic concepts, which both help when he's designing (because he has a better grasp of what's possible) and when he's doing scripting for populating game content (because he needs less help with complex tasks).

I promise that while I wrote that above list with people who are very serious in mind, it's not that difficult; we have New Media kids (glorified web monkeys) that follow through a large portion of that list and they seem to pass okay.

If they aren't serious? Hell, I don't know. Go play with the Unreal Development Kit or something, UnrealScript is easy and you don't have to work very hard to make something workable (if fragile and possibly inefficient).

Quote
Excuse me for seeming like a noob on IRC or something, but it's been a while since I've had the free time to interrogate programmers.
Perfectly fine. And again, there's #bay12prog on the DF IRC network if you have any more immediate questions--I leave a PC on that's always in there, so it might take a bit of time to get a response, but people who show up and ask a question do get a response. Alexhans is in there sometimes, along with a few others.
« Last Edit: May 29, 2010, 11:03:33 pm by Blacken »
Logged
"There's vermin fish, which fisherdwarves catch, and animal fish, which catch fisherdwarves." - Flame11235

Nadaka

  • Bay Watcher
    • View Profile
    • http://www.nadaka.us
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #136 on: May 29, 2010, 11:32:14 pm »

Blacken: I just got back in this forum, I caught the last page or so of this thread. So I don't really know what exactly the discussion is about. I wouldn't mind helping/giving advice though.

BTW: you can do a linked list in one class. A node is a node is a node. There need be no difference between the root node and any other. With a doubly linked list, you have access to the entire list as long as you have any node, instead of needing a reference to the first node with a singly linked list.
Logged
Take me out to the black, tell them I ain't comin' back...
I don't care cause I'm still free, you can't take the sky from me...

I turned myself into a monster, to fight against the monsters of the world.

Blacken

  • Bay Watcher
  • Orange Polar Bear
    • View Profile
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #137 on: May 29, 2010, 11:34:52 pm »

Blacken: I just got back in this forum, I caught the last page or so of this thread. So I don't really know what exactly the discussion is about. I wouldn't mind helping/giving advice though.
Just the quote at the top of my post.

Quote
BTW: you can do a linked list in one class. A node is a node is a node. There need be no difference between the root node and any other. With a doubly linked list, you have access to the entire list as long as you have any node, instead of needing a reference to the first node with a singly linked list.
You can, but if you want to do an iterator, as we discussed and I updated the list with, you need at least two classes, and an encapsulating class that can create the iterator (I don't think having any node able to create an iterator is a good idea, though I am willing to be convinced here) and keep references to the head is probably wise.
Logged
"There's vermin fish, which fisherdwarves catch, and animal fish, which catch fisherdwarves." - Flame11235

Alexhans

  • Bay Watcher
  • This is toodamn shortto write something meaningful
    • View Profile
    • Osteopatia y Neurotonia
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #138 on: May 30, 2010, 08:46:03 pm »

Hey DrPizza, Blacken can generally get away with it because he takes the time to explain why he's saying something. While you're being deconstructive, you should also try to be constructive. Hostility shuts down people's will to listen to your point of view, and can make them dismissive of you.
Their loss. DrPizza is the guy I go to when I have a question. Most insanely knowledgeable person I know.
I wrote a long post talking about this situation (and I lost it because I was writing in notepad instead of using firefox and backing me up with the Lazarus plugin, douh).  Blacken, you know how I feel about accuracy and programming and how to try by yourself before asking, etc, etc... But I also am on the beginner side where you can see (in every area, not just programming) actions that are barely helpful.  I'm not going to discuss this because I don't think I can afford to waste time with it.  I value all input and specially when it comes from people who know so much more than I do but it's better if more people than not feel a sense of accomplishment after this kind of threads.  That's it.  Moving on.

Quote from: Timmeh
Perhaps we should try to put together some increasingly complex challenges along similar lines?
That would be wonderful.  Specially if whoever made those challenges also solved them to be able to cross reference once you've done your own work.

In my opinion, challenges are pretty useful.  Specially those you can't solve because they push you to learn some new concept or way to do things.  For people who can't undertake long projects in the meantime, they're a good way to check what they are missing and exercise problem solving.

One must be careful with places like SPOJ that only care about speed and assume valid input.  Basically, not mixing coding for a challenge (where you can afford to be messy to gain speed) and coding for a project.

Thank you very much for that post, Blacken.  I'm definetly going to go through that list.  Anyway, that's good for people who already have really understood pointers, functions and most of the basics.  I've been thinking of some nice & brief pointer & function challenges.

Quote
I can't stress enough, however, that this stuff is the foundation of being a kickass programmer
Algorithms.   Yeah, that's what the assignment is called in my college.  Sadly, it's also an introduction to programming (using pascal :/)  I'm just starting the first one so it's not very interesting yet...  But it's what I assume most colleges focus on.

Also, advice about Blacken's post.  Don't rush it.  There's no point in going forward if you can not go back without having to study it all over again.
I personally don't think that that guide will be bery fun for a beginner, nor give them practice with their language of choice in a simplified environment, nor is it a varied way to learn.

etc...
Don't worry qwerty.  I'll put a BIG sign above it saying "Proceed at your own risk".  You must be really committed to prevail after looking at this list of utter abstract nonsense.

I see your point, that's why I'll offer the alternatives.  I still think it's really cool to have that list from experienced people.  I'll definetly save it in my computer and make sure I follow the steps, little by little until I know how to do all those things.  Don't wait for me though... it'll take a BIG while.

blahblahblacken
Learning doesn't have to be something you look at as a tough job.  Learning should be a wonderful adventure.  I think EVERYONE has potential to be great at whatever they want.  I don't think you should rush and discourage them by saying that if they are not The ONe they will irrevocably fail.  If you give people a chance, they might surprise you.

I'm going to edit the firsts posts now...
Logged
“Eight years was awesome and I was famous and I was powerful" - George W. Bush.

Rose

  • Bay Watcher
  • Resident Elf
    • View Profile
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #139 on: May 31, 2010, 10:01:41 am »

posting here for great programming justice.
Logged

stummel

  • Bay Watcher
    • View Profile
Logged

Blacken

  • Bay Watcher
  • Orange Polar Bear
    • View Profile
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #141 on: June 08, 2010, 05:24:39 pm »

"Nonsense"? Really? The tools to not suck at your craft are "nonsense," because they're not "fun"?

I couldn't make a better parody.
« Last Edit: June 08, 2010, 05:37:28 pm by Blacken »
Logged
"There's vermin fish, which fisherdwarves catch, and animal fish, which catch fisherdwarves." - Flame11235

qwertyuiopas

  • Bay Watcher
  • Photoshop is for elves who cannot use MSPaint.
    • View Profile
    • uristqwerty.ca, my current (barren) site.
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #142 on: June 08, 2010, 09:28:13 pm »

For the lesser-dedicated beginners who want to program as at most a minor hobby, Fun rather than Most Correct makes *ALL* the difference. If they can see results, change how it works, and understand what they are doing, they can stick with it until they are ready to proceed to the more technical but less immediate results.

As an example, take computing prime numbers.
There is the Fast way(and many variants of it, all trying to be The Fastest), and then there are many slow ways to do it. The beginner will probably write something like this, in their language of choice:

Code: [Select]
int main()
{
  int num=2;
 int max= 10000;
   for(num=2;num<max;num = num+ 1)
 {
    int prime =1;
    int test=1;
      for(test=2;test<num;test+= 1){
if(num%test==0)//got ths from aweb site
{
prime =  0;
      /*If the author is especially clever, or lucky, or searches long enough:*/
      break;/*Unbelievably simple, but helps quite a bit*/
}
if(prime)printf("%d is a prime!",num);
       }
   }
}

Disregarding the (intentionally created) mistakes of not printing a newline, inconsistant indentation, and unbelievably poor implementation, it *will* work, encouraging the author to continue learning, as they just wrote an "awesome program" that can calculate prime numbers far faster than they can.

Actually, a simple challenge:
Improve that program by making it readable, and maybe a bit faster. Don't bother making it fancy or a hundred times faster, just improve it a little bit yourself. If you are more experienced, create a much faster version, without using google to find an answer. If you think of yourself as god-like, or at least very advanced, make it as fast as possible(without resorting to assembly language or aggressive compiler optimization settings) and give it a good UI.
Logged
Eh?
Eh!

alway

  • Bay Watcher
  • 🏳️‍⚧️
    • View Profile
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #143 on: June 10, 2010, 10:49:58 pm »

Edit: I seem to have found a possible solution here and will try implementing it tommorow; so more to come then if it goes well/fails.

I seem to be having a problem with rendering sprites with DirectX...
They render to the screen, but the coordinates are odd. It seems to be treating a 900x900 pixel surface as a 450x450 surface in terms of the position (2:1 scale). There also seems to be a problem with the textures being resized... They appear to be getting scaled to powers of 2. For example, a 760x576 surface was scaled to 1024x1024 on the screen. So in conclusion: it seems there are 2 bugs somewhere. Any ideas?
« Last Edit: June 10, 2010, 11:18:18 pm by alway »
Logged

qwertyuiopas

  • Bay Watcher
  • Photoshop is for elves who cannot use MSPaint.
    • View Profile
    • uristqwerty.ca, my current (barren) site.
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #144 on: June 11, 2010, 07:20:48 am »

Textures *might* only accept powers of two.
Logged
Eh?
Eh!

Siquo

  • Bay Watcher
  • Procedurally generated
    • View Profile
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #145 on: June 11, 2010, 07:30:00 am »

It does so for textures in OpenGL, although newer OGL versions do have a setting that *sometimes* (depending on hardware) allows non-power-of-two textures (although for mipmapping I think you need power-of-two square sizes)

For sprites, I wouldn't know, and 900 is also not a power of two. It's been a long while since I worked with sprites...
Logged

This one thread is mine. MIIIIINE!!! And it will remain a happy, friendly, encouraging place, whether you lot like it or not. 
will rena,eme sique to sique sxds-- siquo if sucessufil
(cant spel siqou a. every speling looks wroing (hate this))

forsaken1111

  • Bay Watcher
    • View Profile
    • TTB Twitch
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #146 on: June 11, 2010, 07:33:15 am »

Just posting to add this to my watch list.

Please ignore.
Logged

Blacken

  • Bay Watcher
  • Orange Polar Bear
    • View Profile
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #147 on: June 11, 2010, 01:26:59 pm »

Edit: I seem to have found a possible solution here and will try implementing it tommorow; so more to come then if it goes well/fails.

I seem to be having a problem with rendering sprites with DirectX...
They render to the screen, but the coordinates are odd. It seems to be treating a 900x900 pixel surface as a 450x450 surface in terms of the position (2:1 scale). There also seems to be a problem with the textures being resized... They appear to be getting scaled to powers of 2. For example, a 760x576 surface was scaled to 1024x1024 on the screen. So in conclusion: it seems there are 2 bugs somewhere. Any ideas?

Only certain graphics cards can support NP2 textures, and it may be off as default as a mode within DirectX. Check the documentation for your caps bits. Generally speaking it's harmless to use a bigger texture for a D3DXSprite (the result of D3DX_FILTER_NONE); you're (hopefully) not throwing around enough data for even shitty Intel GPUs to have a problem with bandwidth.
Logged
"There's vermin fish, which fisherdwarves catch, and animal fish, which catch fisherdwarves." - Flame11235

alway

  • Bay Watcher
  • 🏳️‍⚧️
    • View Profile
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #148 on: June 12, 2010, 01:37:40 am »

After a bunch of jerry-rigging the code, I seem to have found a way of at least covering up what went wrong. By dividing the position coordinates by 2, I managed to make the positioning work correctly. For the mis-scaled images, I used a method of loading the texture files to a power of 2 texture, retrieving the original image size via the D3DXIMAGE_INFO struct, and then multiplying the scaling part of the rendering equations by the original and dividing by the texture size. There were still some odd scaling issues where the image was scaled by about -2% to -5% in both directions. This percentage of oddity appears to be the same for any size of image on each axis. As such, I added that into the scaling code, and now that render correctly. If I am lucky, this silliness won't come back to bite me in the rear; I poked around the code for about 6 hours before deciding this programming duct tape solution would have to suffice.

Edit: As I went to bed, it hit me what may have been causing that odd scaling, the window being used has additional pixels aside from the 900x900 surface: border of the window. On waking up, I measured the pixels of it and when compared to the window size, were approximately the same scale to the surface of the window as the rendered images were scaled down (about 2.3% and 4.7%). I may do some further testing to see if there really is causation there or just correlation.

Edit2: After my first test of it, it seems there is some causation in there. By scaling width up to 1500, the ratio of border to surface width decreases. The percentage of scaling difference also decreases, and again is very similar to the border:surface ratio. Scaling the window width down to 500 also has similar results. As does scaling to 250.

Edit3: Ah! Well that explains it! I was using the same values for window width in the creation of my window that were being used for the backBufferWidth of my D3D device! As such, I had a 900x900 window with a surface of size 880x860 but telling D3D to use a back buffer of size 900x900! This of course resulted in the slightly scaled down results!
« Last Edit: June 12, 2010, 11:25:16 am by alway »
Logged

qwertyuiopas

  • Bay Watcher
  • Photoshop is for elves who cannot use MSPaint.
    • View Profile
    • uristqwerty.ca, my current (barren) site.
Re: Programming Challenges & Resources (#bay12prog) Initiative
« Reply #149 on: June 12, 2010, 11:50:50 am »

Isn't there a win32 function to expand a rectangle by border sizes? You give it the desired useable area, and it converts it to the actual size...
(AdjustWindowRect, or some variation?)
Logged
Eh?
Eh!
Pages: 1 ... 8 9 [10] 11 12 ... 78