Fortsätt till huvudinnehåll

Inlägg

Next project, artificial neural networks

After I finish the Asteroids clone in Java (I now have a running version, but without all the polish) I am planning to read up on, and test some, artificial neural networking. The little I have read about it so far sounds very interesting. I am planning to start off with  this course  on Practical Deep Learning For Coders. A course that handles image recognition, convolutional neural networks, over fitting and under fitting, embeddings, natural language processing (NLP) and recurrent neural networks. Lets get finished with the game! (I have had a slow week since I have spent several days in bed with a fewer, not able to function at all, but now it starts to feel better).

Regarding the new features in C# 7.0

I have read through the  New Features in C# 7.0  blog post on Microsoft Developer Network (MSDN) and also tried them using Visual Studio 2017. My conclusion is that there is nothing revolutionary in C# 7.0. The features are all "nice to have" stuff. Out variables It is now possible to declare an out variable right where it is passed as an out argument. Example: // Before C# 7.0 int x; int y; GetSomeInts(out x, out y); // From C# 7.0 GetSomeInts(out int x, out int y); Personally I think this can be good to limit the scope of variables when using the Try-pattern (a method that returns a boolean to indicate success or failure and results as out parameters): if (TryParse(s, out string a, out string b)) {     // string a and b in scope and can be used here. } else {     // string a and b not in scope. } Pattern matching I am not a big fan of passing generic "objects" around and letting methods behave differently ...

Genetic Algorithm Kata - Done!

Continued with the games programming a bit - adding a Polygon Wrapper class that lets polygons wrap around the edges of the screen. Interesting solution. Also took a break from the games and solved a 2 Kyu task on Codewars that involved implementing a genetic algorithm. It was really interesting to see how such an algorithm can be used to solve a specific problem. The kata, with a thorough description, can be found on Codewars:  https://www.codewars.com/kata/526f35b9c103314662000007 Good stuff! Give it a try.

Async Delegate BeginInvoke Callback Example

I found it hard to find a straight forward example of Asynchronous invocation of a delegate using BeginInvoke and a callback that is called when the delegate is completed. So I wrote one myself. 1: using System; 2: using System.Runtime.Remoting.Messaging; 3: using System.Threading; 4: 5: namespace AsyncDelegates 6: { 7: public delegate int Add(int a, int b); 8: 9: class Program 10: { 11: private static volatile bool isCalculating; 12: 13: static void Main(string[] args) 14: { 15: Console.WriteLine($"Main() running on thread {Thread.CurrentThread.ManagedThreadId}"); 16: var theDelegate = new Add(Adder); 17: isCalculating = true; 18: theDelegate.BeginInvoke(7, 5, AdderCallback, null); // Runs the Add method on a separate thread. Calls AdderCallback when Add has finished. 19: while (isCalculating) // The isCalculating boolean is set to false in the AdderCallback method. ...

Games programming update

Still focusing 100% of my limited spare time on getting through the games programming book. Currently reading up on, and implementing, algorithms for intersection testing. Now I know what an Axis Aligned Bounding Box is ;).

Learning some Game programming

I recently bought a book called  Fundamental 2D Game Programming Java  that I am reading/coding through. The fact that the example code is written in Java is nothing that should scare you away from this book. All concepts that are explained are generic for game programming and not specific to Java. Currently I am at chapter 4, time and space, and have learned how to keep movement speed intact independent on frame rate and now I am learning how to transform world space to screen space. It is interesting to learn some new concepts that are different from the coding I have done previously. If you want to look at the code I have a  repo available on GitHub . Currently there is an Eclipse project file available so it can be imported easily to Eclipse. I am however considering using IntelliJ instead.

Taking the next Dvorak step

I have been using some kind of sv_dvorak hybrid for the last year or so. The layout I have been using has all the shift+digit and alt-gr+digit combinations intact. This however means that characters often used when coding, like (), {}, and [] requires some really awkward positioning of the fingers to type. Therefore I have decided to go all in on the  Dvorak Simplified Keyboard . This layout is also included by default in Windows so no need to install any external programs or layouts when using a Windows computer (as I do at work). With this change I will have no use of looking at the keys on the keyboard. Maybe I should go for an all black, completely blank,  Das Keyboard Ultimate .