Inspiration
There are several programming contest in the world, and some of them accept any programming language. Google Code Jam is one of them and my favorite.
Attending such a contest using your favorite language helps you to get used to the language. And it is very fun and insightful to see other people's solution in your favorite language.
The thing is, currently not so many people are using Swift for such a contest while I want to see how other people would solve them using Swift.
I expect a good template will encourage more people to join it, and that is very beneficial each other.
What it will do
People can focus their core algorithm with it.
It will be a template to avoid any troublesome things to attend a programming contest like reading files and input, organizing output files and even source code to submit maybe.
How I built it
I classified things what you do not want to do during the contest, and they were like following:
- Read contents of an input file and assign those values to variables
- Prepare files for submission
- It can mess up after each submission
We solved each problem by
- Make readInput() -> Type for variety of Types. You can do like:
- let N: Int = readInput()
- let (N: Int, M: Int) = readInput()
- let S:[String] = readInput()
- What you should do is just hit ./execute.sh and submit files in ./Outputs directory. ./execute.sh builds the source code, copies source code and input code for reuse and output a result by passing input to the executable and make a zip file of all source files.
- Since ./execute.sh copies /Inputs and /Sources in the same directory as output files, you feel easy to clear the core algorithm for previous problem.
Challenges I ran into
Enabling assignment like let (N: Int, M:Int) = readInput() for many types cannot be done in general way but we had to define variety type of tuples. Making the decision of giving up on that part took long.
Accomplishments that I'm proud of
I am very happy that we could finish this and I can use this in this year's GCJ.
What I learned
I felt the power of a teamwork by seeing that everybody has different skills. What we made is kinda different from what I thought at first, of course in better way.
What's next for GCJ Swift
We'll see while using it in real situation :)
Log in or sign up for Devpost to join the conversation.