Jump to content
IGNORED

WATMM Programmers corner


Guest Babar

Recommended Posts

I remember we had a thread about Computer Science, but I thought i'd be better to create a new thread since programming != computer science.

 

So post your cool programs in here etc

 

 

Personally, I'm currently developing a framework to enable rule-based programming in objective-c in the hope to implement aspect/role/subject oriented design patterns.

So far I focused on aspect-oriented programming and I must confess that, although still being experimental, i'm getting good results. I compared my shit with apple's notification-based observing pattern and mine is around 20% faster.

 

 

 

 

 

How does it work ?

Rules are objects that have three main properties:

- a name

- a condition (an NSPredicate)

- an action (a block)

 

They can be listed into rulebooks. A rulebook has an (ordered) list of rules which are individually followed when the rulebook is executed. Since rulebooks are kind of rules, rulebooks can list rulebooks.

 

 

How can it implement aspect-oriented programming ?

Basically, when you want to 'aspectualize' an instance, you wrap into into an AspectProxy (this instance becomes the surrogate of this proxy). When a message is sent to this proxied instance, the NSInvocation is passed to the forwardingRulebook.

• Rules in this rulebook take as argument an NSInvocation and return an NSInvocation (presumably the same one) : in other words, a rule takes as argument the invocation returned by the previous rule.

• The condition of these rules applies to the NSInvocation they're passed as argument. For instance, if you want to apply your rule to any setter method, your rule condition will look like:

--- [NSPredicate predicateWithFormat:@"selectorName BEGINSWITH 'set'"]

and when the the condition will be tested:

--- [myRuleConditionPredicate evaluateWithObject:anInvocation];

if the condition is verified, then the rule gets executed

 

 

 

The forwarding rulebook is composed of three main stages

- the before stage (a rulebook). Any processing that must be executed before the method(s) you're targeting goes here

- the for rule (a rule). Executes the original method by forwarding the invocation to the proxy's surrogate. So in my setter example, it would invoke the setter itself.

- the after rule (a rulebook). Here I could have a debugging rule that would output upon execution something along the lines of:

--- 'myInstanceName : set value of someProperty to someValue'.

 

 

Another example:

with this framework, I could intercept any 'add*' messages sent to NSMutableArrays and write an after-rule that establish a one-to-many relationship between the object and the array that contains it.

This way I could write something like:

--- NSArray *containers = [myInstance objectsBoundByRelationWithName:@"containing"];

--- [containers performSelector:@selector(removeObject:) withObject:self];

in order to remove the object from any NSMutableArray it is contained into.

 

 

tada.

So I'm looking for beta testers. PM me if you're interested.

Link to comment
Share on other sites

 

 

*clap

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

clap

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

clap*

 

 

Link to comment
Share on other sites

to people who don't know objective-c :

messages (~= method calls) are passed to the runtime and to a series of functions that allow messages to be forwarded. So the purpose of proxies is to wrap one or several objects and forward them these messages (or not) as they are, or after some modifications.

So in my example, when I write

--- [containers performSelector:@selector(removeObject:) withObject:self];

the "containers" array acts as a proxy and duplicates and forward the "removeObject:" message to all the object it contains

 

So basically my concept relies on the idea of intercepting messages sent to an object, do some processing before and after the targeted method is actually called.

And it can be applied to virtually any class/object (so far it only works on specific instances, not on any instances of a certain class).

Link to comment
Share on other sites

Babar, id don't get at all what you're doing but it sounds interesting :]

 

trying to keep my programming practical at the moment, here's what i'm working on:

 

for a job (http://itunes.apple....d478874400?mt=8) i had to do a thingie where you have accurate 'real-time' controls over frames in a video, controlled by device rotation. Like, the rotated candle is a video of a rotating candle, yea?

so i rolled my own video player which uses sprite sheets in OpenGL.. nothing fancy but it works.

 

So now i'm recycling the work that went into it, added audio playback controls and matched the a/v, so you can scratch a video loop like this:

 

http://www.youtube.com/watch?v=k5CR0s4Hfi8

 

currently experimenting with clip content, thinking palindromes..

todo:

- dynamic cache for sprite sheets so that i can load and purge clips without the user noticing anything

- a sort of network thing for laying out clips in a multilinear narrative

 

 

then the other thing is a game for iPad which i'm doing with two friends.. you control the arms of a butler robot and have to avoid crashing into things while doing your job of butlering. This is far from finished, but we want to keep it simple and push it into the App Store as soon as possible. Currently implementing the arm control logic, having fun :]

 

cajcjbgc.jpg

 

Screen%20Shot%202011-12-04%20at%202.04.42%20PM.png

Link to comment
Share on other sites

Currently programming an adventure based game for Microsoft Qbasic about a Cat. I haven't started actual programming yet; still trying to work out a lot of the mechanics and how exactly fighting is going to work. I really like what concepts I have though.

 

This will be the first game I make where I go off of a plan and don't just program as I go along. It's time I make something that's actually fun.

 

And my qbasic website is in my signature.

Link to comment
Share on other sites

Guest Centurix

I'm doing nothing at the moment. It's fantastic. Won't last forever though.

 

Last thing I wrote was a shell script that communicated directly from my MythTV box to my PayTV box to schedule the transfer and transcoding of scheduled recordings. But that's scripting though. Not exactly rocket science...

Link to comment
Share on other sites

 

 

Chimp Knife Fight

 

Chimp Knife Fight is a one on one fighting game where you're a Chimp in an underground Knife Fighting tournament. Included modes are Story, 2P versus, and an unlockable Survival Mode. A high score table broken into two separate files is included with the exe, so this game is packaged in a RAR file.

So far there have been a ton of problems, but after EIGHT bug fixes, I am confident that this game is now in its ALPHA stage!

 

 

 

Chimps.PNG

 

 

 

awesome !

too bad it doesn't run on mac. I shall play that game one day though

Link to comment
Share on other sites

I am programming a real time computer-vision application in c++ that will break down video input and detect different objects through edge and color detection. The purpose of the application is to identify different species of birds to log their feeding habits/localization abilities for further use in behavioral/spatial orientation studies.

Link to comment
Share on other sites

I am programming a real time computer-vision application in c++ that will break down video input and detect different objects through edge and color detection. The purpose of the application is to identify different species of birds to log their feeding habits/localization abilities for further use in behavioral/spatial orientation studies.

 

That is awesome. :ok:

 

Most of my programming is boring work stuff. In my spare time, I'm learning graphics programming using this excellent OpenGL guide. Fun!

Link to comment
Share on other sites

That seems like a great e-book on OpenGL. I will bookmark it for the future!

 

i second that. much cheaper than the red bible ;)

 

 

0321552628.jpg

 

Link to comment
Share on other sites

OpenGL was pretty difficult back in the day. Now the API has so many layers of abstraction, its approaching Processing simplicity.

Link to comment
Share on other sites

 

 

Chimp Knife Fight

 

 

Chimp Knife Fight is a one on one fighting game where you're a Chimp in an underground Knife Fighting tournament. Included modes are Story, 2P versus, and an unlockable Survival Mode. A high score table broken into two separate files is included with the exe, so this game is packaged in a RAR file.

So far there have been a ton of problems, but after EIGHT bug fixes, I am confident that this game is now in its ALPHA stage!

 

 

 

Chimps.PNG

 

 

 

awesome !

too bad it doesn't run on mac. I shall play that game one day though

DOS Box Works on Mac. My Mac-using housemate played a couple of them.

I can't even play them on Windows 7 without it since these new-fangled OS's don't support DOS.

The game is almost entirely luck-based :sup:

 

Edit: Woah, Impakt's program sounds amazing.

Link to comment
Share on other sites

I've been taking programming classes for the last year and a half, in Java. Haven't done anything really exciting... just academic projects to learn concepts etc. I really look forward to actually applying all of this stuff outside of class work.

Link to comment
Share on other sites

  • 5 weeks later...

I stopped making my program due to limitations in Qbasic. I'm very sad about it because I put 30+ hours into it. Didn't realize there was a limitation until today.

 

But, I finished an old (bad) program called "Snail Party!" which ya'll should play.

Link to comment
Share on other sites

I am programming a real time computer-vision application in c++ that will break down video input and detect different objects through edge and color detection. The purpose of the application is to identify different species of birds to log their feeding habits/localization abilities for further use in behavioral/spatial orientation studies.

 

holy fuck that is really fucking impressive. not joking

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.