Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - MorleyDev

Pages: 1 ... 69 70 [71] 72 73 ... 161
1051
General Discussion / Re: if self.isCoder(): post() #Programming Thread
« on: August 10, 2014, 08:56:13 pm »
Turns out the tests were more just establishing baseline knowledge. Was all pretty trivial, more about filtering out people who don't know the basics and sizing up people who do. Oh well, never any harm in rereading Effective Javascript :P

1053
Creative Projects / FlapBoy [#gbjam3] [Flappy Bird Clone]
« on: August 07, 2014, 09:33:09 am »
A Flappy Bird clone I made for the #gbjam3, the game is written in C++ using SFML. Supports multiple difficulty modes. Don't hit the pipes or leave the screen. Basically an excuse to play around with some game architecture ideas. And because I figured I was possibly the last programmer on the planet who hadn't cloned Flappy Bird yet.

Screenshots


Videos
http://youtu.be/h95dDfqzc_c

Default controls
InGame:
- W: Jump
- Escape: Return To Menu
- P: Toggle Debug View

In Start Menu:
- W: Change Menu Option
- D: Change Difficulty
- Enter: Select Menu Option
Close the window or choose "Quit Game" from the menu to quit.

Download
GameJolt Page to Download
To run, launch FlapBoy.cmd

1054
General Discussion / Re: if self.isCoder(): post() #Programming Thread
« on: August 06, 2014, 11:45:19 am »
So I have an interview in a couple of days for a Junior/Grad job, and they're looking for "Javascript/HTML/CSS now, capable of transitioning to a server-side project in a few months". Now, I like to think I have a wide range of skills and could do that, but my web frontend is a little rusty (HTML5 was new the last time I made a serious website from scratch).

I know the tools and language, but I'm not a web designer so I've not had much call to do anything practical with it, so anything I do when playing around is basically the "Geocities GIF spam" of HTML5, just using as many fancy things as I can to make something hideously beautiful. I can do katas, ask me to make something happen on a web page and give me access to documentation and I can do it, but it's not something I can just reach for on the same level that I can C# or C++.

Anyway, the first part of the interview is a technical test, predominantly on Javascript but with a little HTML5. Now, the issue is what they mean by Javascript. Because it could be:
Javascript the language, aka. ECMAScript
Javascript the DOM glue
Javascript the JQuery/Bootstrap glue
Javascript the Virtual Machine for the Internet

Probably not the last one, and my hope is it's predominantly the first one since I know the most about the what-not-to-do with Javascript, but my knowledge of the DOM isn't by-heart (seriously, ain't nobody got time for that) and my JQuery/Bootstrap usage has been fairly basic, JQuery for input events for games, Bootstrap for drop-down menus. So got some revision to do it seems :)

1055
I know someone who did some web-scraping stuff for his coursework that used node.js clusters, so it's doable in node.js too. Google reveals tutorials.

Currently refactoring the heck out of my coursework ReST API so it's actually workable, I ran out of time so basically wrote it as a giant mess lost in callback hell. Moving all the callbacks over to Q promises definitely cleans things up, and plays pretty nicely with Typescript and Webstorm too :)

1056
So I had an interview a couple of days ago for a 'Software Developer' job. I got this interview by going to a Tech Meet-Up and talking to people there. It helped I knew the man hosting it (someone I worked with on my work placement), but such things are useful not only when looking for work but also when working. They let you keep an ear to the ground for opportunities, keep an awareness of what's going on in your local tech scene, and shows that you actually enjoy what you do and want to learn more.

If you can find any within reasonable travelling distance, they're pretty good networking opportunities. I know people who heard of job opportunities and got 'fast-tracked' to an interview because of who they met at such meet-ups (one company basically suffered a mass exodus of it's developers, and my aforementioned colleague helped set it up so many of them could get interviewed at where he worked, where a fair percentage of those who left them now work). I've gotten cards and places to send my CV before, very useful.

But this is speaking from a UK perspective, I'm not sure how similar things would work over the pond...

1057
Working through some Katas, I think I've come up with the most needlessly recursive Roman Numerals Decoder:
Code: (scala) [Select]
def detokenise(numerals : String) : Seq[Int] = numerals.map(_ match {
    case 'I' => 1
    case 'V' => 5
    case 'X' => 10
    case 'L' => 50
    case 'C' => 100
    case 'D' => 500
    case 'M' => 1000
    case _ => throw new Error("")
})

def calculate(values : Seq[Int]) : Int =
    if (values.size == 0)
        0
    else if (values.size == 1)
        values.head
    else {
        val max = values.max
        val pre = values.takeWhile(_ != max)
        val post = values.dropWhile(_ != max).drop(1)
        max - calculate(pre) + calculate(post)
    }

def romanToInt(numerals : String) = calculate(detokenise(numerals))


val testPairs = Seq((1,"I"),
      (2,"II"),
      (4,"IV"),
      (5,"V"),
      (9,"IX"),
      (10,"X"),
      (900,"CM"),
      (1000,"M"),
      (3497,"MMMCDXCVII"))

testPairs.foreach(a => {
    val actualResult = romanToInt(a._2)
    println("%s: Expected: %s, Actual: %s".format(a._2, a._1, actualResult))
    assert(a._1 == actualResult)
})

Turns out you can replace the calculate with
Code: (scala) [Select]
def calculate(values : Seq[Int]) : Int =
    values.foldRight((0, 0))((currentValue : Int, previousAndTotal : (Int,Int)) =>
        if (previousAndTotal._1 > currentValue)
            (currentValue, previousAndTotal._2 - currentValue)
        else
            (currentValue, previousAndTotal._2 + currentValue)
    )._2

Or even just implement it as a reverse for-loop. Oops...Well, wouldn't be too bad if the first solution wasn't based on the pseudocode I came up with during an interview earlier today. Not even trying to 'show off how I can do recursion' or anything, that first one is just the in-code version of how I did the calculations in my head.

1058
Yeah. node.js is more suited towards a more distributed model than a 50K monolith.  It's more geared towards dropping pieces of work onto queues for other processes to pick up and work with, forming clusters of small processes working together. Which I'd think of as a cleaner design nowadays for that kind of work, but difficult to retrofit in.

As for exceptions, it's pretty easy inside a REST api to turn all exceptions into 500s. And if an exception does bring the program down, pm2 or forever are tools made to bring it back up (pm2 is newer but the recommended solution). It still does encourage one to write more unit tests for the code at least, but it's a valid concern that the libraries often don't handle this for you I guess. At least I know Restify doesn't, not used Express as extensively. PHP handles it because it's built with the notion of a web-page-as-a-process, node.js isn't built with that notion. Neither are C# and Java, obviously, but there the libraries typically handle all that for you.

Date functionality? Hmm, maybe some of the libraries recommended here could be of use?

1059
I'd say node.js is more suited for small and focused web services. So it's a good choice for a ReST API that sits around a database or an OAuth server, small things that 'simply' process a request, make some db calls and give a response and for which a 'large' server like Apache+PHP or C#/Java are arguably overkill.

1060
You want to burn away your horizontal as you fall so that by the time you get to the bottom your going more or less straight. Whilst it's more efficient to burn at an angle to lose the velocity in an arc, you can just suicide your horizontal and fall if you have the delta-v to spare.

The problem I have is with any kind of rendezvous. Cannot get two space craft to deliberately meet...Makes Apollo-style missions tricky :)

1061
Base 16 (hex) is mostly useful when writing values where the underlying binary representation is the important information you want to know, not the number itself. F in base 16 directly matches the value of 1111 in base 2, so it's a lot easier to recognise the underlying binary value (FF would be 11111111, or 255, aka. the largest value stored in your typical 8-bit byte).

So if you're parsing binary data, it's a lot easier to comprehend the underlying value of F0FF than 61695 and still has less cognitive overhead to write and read than 1111000011111111. It's the same number being represented each time, but with F0FF you can quickly learn to split it into the two bytes in your head (F0 and FF).

Such data manipulation isn't an uncommon task in a lot of jobs at some point, be it in talking between devices over hardware, reading or writing files in predefined formats, accepting or sending network messages in predefined formats or whatever. Colours are a common use case, since each byte in a 32-bit colour number maps directly to to strength of that colour (or the alpha channel).

Heck, my work placement job involved adding handlers for the SMPP protocol from a variety of mobile networks (who all implement the protocol in subtly different and equally annoying ways), so parsing or constructing the request PDUs, and then constructing or parsing the responses. Fun fun fun.

1062
One of the things I like about teaching with C++ is if you start with Java, you may get some idea of how to program with objects and classes but good luck understanding why. With C++, you can start procedural and actually feel the pain that OOP is trying to solve, and actually understand why people use classes. And then with OOP you feel the pain state or deep inheritance trees create, and start trying to limit your state and focusing on composition over inheritance and suddenly the reasoning behind why a lot of programmers are being more drawn to functional programming or at least more functional code makes sense. It's a lot easier to understand why when you've seen what happens with the not.

So I set up a blog using Ghost, immediately like it over Wordpress. It's a very pretty scalpel, whilst wordpress is a sledgehammer that tries to do everything. Though Ghost does require more of a willingness to get your hands dirty with some HTML if you want to do things like add menus. On the bright side, I've actually written some blog posts for the first time in months upon months. Yay for changes of scenery :)

1063
General Discussion / Re: Things You Accomplished Today
« on: July 13, 2014, 08:15:07 am »
...sandwich?

A Sandwich course is a course in which you do a years work placement in between the second and final year. Pretty useful for a thing like computer science.

1064
General Discussion / Re: Things that made you sad today thread.
« on: July 12, 2014, 10:02:53 am »
So this isn't a sad as much as "mildly annoyed inside some pretty darn chuffed", but I got my university results. First Class Honours, awesome, basically highest class of degree, again awesome. But, looking at the grade breakdown for the final year it's almost entirely straight As. One B.

Damnit sometimes I realise I can be a perfectionist. Or maybe it's just minor OCD, because there's one B amongst the As. One, taunting me. So close to straight As. Damn you Formal Specification and Refinement! But other than that, yeah. First class, wooh.

But that one B bugs me xD

1065
General Discussion / Re: Things You Accomplished Today
« on: July 12, 2014, 06:30:40 am »
Just got my University Results.

"Bachelor of Science (Honours) Sandwich in Computer Science. Class: First Class Honours"

I believe the phrase I'm looking for is "Booyah" :)

Pages: 1 ... 69 70 [71] 72 73 ... 161