Sunday, 24 May 2015

Neual Outdoors and The effect of a new bow

How much does a new bow affect a score? Well it turns out to be much better than I had expected.

A few weeks ago the Hull Archery Club managed to compete in the NEUAL Outdoor Championships, unfortunately we only managed to scrape a team together for Novice as most of the experienced members were busy with final year projects and their thesis but we gave it our best shot (pun not intended).

This competition was not only my first outdoors competition but my first time shooting my new bow at a competition, I was apprehensive at first as some of the distances we shot were distances that I have never even seen before but I managed to get my sights in eventually and ended the day with two medals. The first Medal was for the Novice team which we got a silver in, the team consisted of Daniel Sugden, David Bewley and Me. The second medal was for Novice archer which I got silver in, I'm really glad I managed to get this medal because before this competition I was never on the top scorers list for Hull but now I've managed to pull my weight and help the team get some silverware.

If you want to see the final scores you can get all of them [here]

Here are my medals proudly attached to my quiver, for some reason I doubt they are made out of silver.

Now I want to see how much I have improved due to the few months of practice I have had with my own bow compared to the club bow I used to shoot with. So I decided to do some metrics (numbers not archery metrics, I actually did two Portsmouths).

I've taken two score sheets to find out exactly how many points money can buy in archery, I know it's not a huge sample size but it's the best I've got on hand right now. The first sample is from the Neual 2014/2015 indoor championship (which is my personal best score for competition archery, and it is with a club bow), The second sample is what I just shot outside (with my new bow).

The difference is quite good, I've managed to smash my personal best buy 117 points going from 384 out of 600 to 501 out of 600. It still leaves a lot of room for improvement which is something I want to do over the summer holidays before I resume competing for the university team but hopefully I can get a competitive score for the experienced league.

Now for the graphs.
Here are the two Portsmouth rounds side to side.
and now you can see the differences in how well I scored with these pie charts. The first one is with the club bow.
This is with my club bow

This is with my new bow
As you can see I've managed to get a lot better but still have some room to improve. If you would like to see the rest of the graphs (and who wouldn't) you can find them [here].


Wednesday, 22 April 2015

Archery Instructor Course

A little while ago I purchased myself a fancy new bow, which I am currently in the long process of tuning. As such I haven't been able to do anything amazing with it yet.

In the mean time I have procrastinated from revising for my exams by paying to do more exams, which is the archery GB instructor course. This course ran over three days and included one written test and one practical test in which I hosted a lesson to two beginner archers (who were actually more accomplished archers than me).

I instructed my beginners on how to do bare-bow archery which I haven't done in almost a year now, so I'm glad I had a day to get back into the swing of things, by the end of the weekend I was able to get bullseye on all three arrows (admittedly at only the beginner distance of 10 metres).

The final outcome of the course was that I passed, which means I will be working for the archery team next year to help with the new members of the team during the very busy period of the university open days.

Sunday, 5 April 2015

New bow equipment

I haven't been able to post anything about my programming recently due to the fact that all my programming is currently going on my coursework, which I don't feel comfortable posting until everyone has submitted their work.

But to bridge the gap I'm going to make a post about a new hobby of mine. I've been doing archery since I moved to my university which is about 6-8 months now and I have been relegated to the only left-handed club bow they have, which has a few issues that I won't go into. At least it's red which makes the arrows go faster.

After getting my riser (winact vt) from Clickers archery, who kindly gave me £40 off for reasons unknown, I decided to get myself to Aardvark Archery which is near Leeds to find myself a good stabiliser system. One thing led to another and now I have most of the stuff for my bow.

Anyway here are a few photos of my bow, I have gone for a mostly black and silver bow because I am a filthy poser.


I haven't properly strung it in these photos because I don't have a stringer yet and I'm too scared to string it without one.

I really like how the Winact-VT looks in matt black, it was defiantly worth the wait for it to be imported (the shop didn't have left handed matt black in stock).

If you are thinking about getting your own bow I seriously recommend going into a shop to get one as the staff are so much more helpful than some video online, and they set up all your equipment for you.

If you are interested in anything in the photo here is a big list:
  • Riser - (Winact-VT)
  • Limbs - (SF Elite glass foam)
  • Pressure Button - (Shibuya DX)
  • Stabiliser - (Decut Crown)
  • Stand - (Cartel RX10)
  • Rest - (Hoyt Super Rest) Cut off the temporary pressure button if you use the shibuya with it)
  • Clicker - (Beiter Black Blade)
  • Sight - (Decut 120)
  • String - (Made in aardvark)
  • BackPack - (Legend Streamline)

Thursday, 5 March 2015

Watch out Dan's about...

I have started the programming 2 coursework and two times I have managed to get side tracked into making Dan related programs. Click the Dan to see the video.




Friday, 20 February 2015

Making interesting fractals

I've been making fractals since I was fourteen, I enjoy how something so simple can be made into something so complex. With tools as easy as Apophysis freely available anyone can have a go with only basic knowledge of what you are doing, which is what I do anyway.
  
Fractals are infinitely complex patterns that are self-similar across different scales. They are created by repeating a simple process over and over in an ongoing feedback loop. Driven by recursion, fractals are images of dynamic systems – the pictures of Chaos.
-Fractal Foundation

This post wont tell you how I made these images, it's simply a showcase for anyone who is interested in looking. I recommend you download Apophysis and give this a try because you can easily achieve similar results to me. 

Downloads
[Apophysis]
[Apophysis 7x] (For 3D fractals)

Spider Webs

Galaxy

Spiral

Green thing?

Bone structure

Flower


Friday, 13 February 2015

Making a menu for the console in C# [Part 2]

Issues using the menu

If you have used the source code from part one of "Making a menu for the console" you may have encountered some issues when you have too many items to display, this could be fixed by only displaying a small section of the array at one time, but the program I made this for would never encounter an array longer than five items long so I decided to work on the more complex parts of it instead.

Just be cautious if you plan on using the source I provided in part 1.

 Uses of the menu

I have a few uses of this method, and they have all been in my programming semester one coursework. I would recommend making a class library that includes all methods related to user input validation so that you are able to include some of these useful methods within other programs easily.

yesNo()

I tend to ask the user "yes" or "no" questions a lot which I originally asked them to type "y" or "n" into the program which works but this could confuse some users. So I made a quick method that allows me to give the choice in a menu format. The method returns true if the user selected yes and false is the user selects no.
public static bool YesNo() {
    if (Menu(new string[2] { "Yes""No" }) == 0) {
        return true;
    } else {
        return false;
    }
}
An example of when I have used this system in my programs is for when I want to ask the user if they want to quit, which would be wrote like this.
bool quit = false;
 
while (!quit) {
    //Do the program stuff here
 
    Console.WriteLine("Do you want to quit?");
    quit = YesNo();
 
    Console.Clear();
}
As you can see this is very easy to apply to other situations.

Very simple file browser

For my programming coursework we had to make a game, for some reason I thought it would be a good idea to make this game in the console. If you want to see how that went go [Here]. For extra credits I decided to implement a way to save and load the game which involved making a file browser in the console but didn't require anything too drastic.
Here is what I came up with. (you can even see where I added some more menus within the game)

[View on youtube]


To the joy of past me this was insanely easy to implement, in fact it can be done in only three lines, all I had to do was grab all the file names out of the save file directory then feed them into the menu method finally I loaded the file that the user selected.
//Get the files in the save directory 
if (Directory.Exists(@"saves\")) {
    filePaths = Directory.GetFiles(@"saves\""*.tcr");
}
UserInput.Header("Pick a save file");
//this makes the menu that prints out the available files, and it assigns the selected file to fileSelected
fileSelected = filePaths[UserInput.Menu(filePaths)];
The Directory.GetFiles() method just so happens to return as a string array which is just what we need. Obviously you need to add some tests to handle situations such as having no files within the save directory, this is simply a cut down version of the code.
All you would have to do now would be opening a stream reader with fileSelected and do all your relevant file loading.

Conclusion

I'm sure I am not the first person to do something like this, and I wont be the last, but this menu method managed to save a ton of time with input validations and I would recommend making your own version if you are starting out with programming like me.

I will probably make some more Blog posts discussing parts of how I stumble through my programming, and they definitely will be more complex than a console menu method.

Thursday, 12 February 2015

Making a menu for the console in C# [Part 1]

The menu method

For the first year programming in my university we were required to make a few console applications in C#. Due to the nature of end users all input needs to be validated else someone is going to have fun blowing up your program.

One of the ways I validated my user input was by having a scrolling menu system, A few people commented on it and asked me how I did it so I thought it would make an interesting first Blog/Tutorial post for this website.

Structure

How the method will work

The menu method works by taking a string array which contains every option on the menu and will return an int32 which will be the index of the option the user entered. Doing it this way will allow for some interesting designs later on such as option menus or basic file browsing.

This is how we declare the method:
static int Menu(string[] inArray) {

How the method is coded

The menu has two easy parts; the "Drawing Phase" and the "User Input Phase", these are looped until the user has selected the option they want, it's very simple.

Drawing phase

This for loop will go through each element of the array that has been passed into the method and prints it out. If the elements index is equal to the selectedItem (what the user is currently selecting, don't worry we will be using this later) then it prints out the element in a "highlighted" colour.
for (int i = 0; i < inArray.Length; i++) {
    if (i == selectedItem) {//This section is what highlights the selected item
        Console.BackgroundColor = ConsoleColor.Gray;
        Console.ForegroundColor = ConsoleColor.Black;
        Console.WriteLine("-" + inArray[i]);
        Console.ResetColor();
    } else {//this section is what prints unselected items
        Console.WriteLine("-" + inArray[i]);
    }
}
 
bottomOffset = Console.CursorTop;
If I pass a array that holds the days of the week in an array this code will print the array like this.

Note: due to the fact that selectedItem was declared as 0 the option "Monday" has been automatically highlighted.

We also set a value called bottomOffest to where the cursor is from the top of the screen, remember that because it is very important later on.

User input phase

Now we need to allow the user to move the selection cursor around so that they are able to move it over the option they want to select. I want to move the selection cursor around using the arrow keys, which is very easy to do in C#, all we need to do is use Console.ReadKey(true) to read what keys the user is pressing. Note: we pass "true" into the ReadKey method so that the method doesn't echo the keys we press onto the screen, this is not necessary but will make the menu look better.

This is the code for the user input so far.
kb = Console.ReadKey(true); //read the keyboard
 
switch (kb.Key) { //react to input
    case ConsoleKey.UpArrow:
        if (selectedItem > 0) {
            selectedItem--;
        } else {
            selectedItem = (inArray.Length - 1);
        }
        break;
 
    case ConsoleKey.DownArrow:
        if (selectedItem < (inArray.Length - 1)) {
            selectedItem++;
        } else {
            selectedItem = 0;
        }
        break;
}
The value kb is of type ConsoleKeyInfo which allows us to easily test what key has been pressed. As you can see we move the value selectedItem either up or down depending on what key has been pressed and if selectedItem goes out of the bounds of the array we flip it back to the start or the end of the array, this allows us to loop back to the top of the array if we go past the end of it or loop the the bottom of the array if we go past the start of it.

Now we need to feed this new selectedItem value back into the drawing phase, simply put the code in a loop according to this pseudo-code.

While (User has not selected something)
     Draw Menu
     Get User Input
     React to User Input

 The final thing to add to the user input phase is a way to break out of this loop and return the selectedItem variable, to do this simply add a case for the enter key which will break out of the loop.
Here is the case I made.
case ConsoleKey.Enter:
    loopComplete = true;
    break;

Making things look pretty

The code so far should work, it will return the values correctly and will display the item the user is currently selecting, but every time the user goes up or down the array will be printed after the last pass. This means we get a big confusing stream of options which would confuse the end user, to fix this we have two solutions.
  1. The quick and dirty way
  2. My way
The quick and dirty way involves clearing the whole screen (Console.Clear()) when the user moves up and down making the array redraw itself in the same place, but this is a salt the earth policy as the Clear method will clear any information the programmer put on the screen to help the user.

The better way of doing things is moving the cursor back to the top of the array and drawing over the previous array which sounds complex but it's not, I'm just bad at explaining it.

All you have to do is record the start and end point of the array (on the console) and move the cursor back to the top of the array when you want to draw again, you can see it on this Gist I made [Link].

Another thing to do to make the menu prettier is to turn the cursor off with
Console.CursorVisible = false;
so that the cursor wont be flashing around when you are printing the array, just remember to make it visible again before the method ends.

How it looks

[View on youtube]

I will talk about how to use this method in another Blog post as it's getting too early in the morning.

Source Code

Console Menu - Brogie [Link]
Copyright © 2014 Stumbling Through Programming