Re: IBM Cloud Challenge.
by hdb (Monsignor) on Jul 22, 2015 at 06:41 UTC
|
Thanks for pointing this out but - honestly - this whole challenge is utterly pointless. Writing a programme to calculate factorials without any additional requirement (like arbitrary large number or such) is not proving anything. If one knows that the input is between 1 and 15 the best solution is probably a lookup table. And there is an explicit formula that states the solution to two simultaneous equations, so programming a full blown algorithm for solving them is a waste of time as well.
It looks really like a lure to get people to apply for trial accounts...
| [reply] |
|
|
It looks really like a lure to get people to apply for trial accounts...
Indeed. I guessed that going in; but was interested enough to see what was on offer.
The trouble is, their sign-up is broken; which kind of defeats their purpose.
I still think it will be interesting to see what the winning code looks like (they offer Python and Ruby + the usual compilers); and compare with the best Perl could offer.
| [reply] |
|
|
| [reply] |
Re: IBM Cloud Challenge.
by 1nickt (Canon) on Aug 03, 2015 at 01:27 UTC
|
I wonder what it says about the whole thing that their content hasn't apparently passed through a proof-reading process.
For most developers it is a case of when not if they will need to deve
+lop ...
But how to get starting something ...
we will announce a winner, confirming upon one of you the honour and g
+lory ...
... the honour and glory of raising the first IBM Bluemix Programming
+Competition
I mean, I'm sure the blurb was written by a register.co.uk hack, not an IBM hacker, but still!
Anyhow, you can submit any URLs and files, and it's not required to register for BlueMix to submit a solution (I tested), so BrowserUK I say you go for it and send them perl programs that may be disallowed, but not without embarrassing the rest of the field.
Looking at the rules closely, you get 60 seconds for your program to produce as many answers as possible, so creating enough sample data to profile your solution will itself be a bit of a task.
The way forward always starts with a minimal test.
| [reply] [d/l] |
|
|
BrowserUK I say you go for it and send them perl programs that may be disallowed, ... Looking at the rules closely, you get 60 seconds for your program to produce as many answers as possible
We read the rules differently. My reading is that the code will be run under the bluemix environment; and automated. Thus
- Any Perl code submitted would simply fail to run and be discarded.
- The 60 seconds is a hard time limit.
If your program fails to produce the required output* within that time; your program will be aborted and any results summarily discarded.
I expect that the input file will be of fixed size and relatively small; so for all but the most ardent GP solution to problem 2, the run times for most correct solutions will be a matter of milliseconds.
*From the specificity of the output formatting requirements I suspect that the pass/fail criteria will be judged by a simple text compare of the actual output against the expected.
Given the lack of interest in this thread; I lost interest also.
| [reply] |
Re: IBM Cloud Challenge.
by 1nickt (Canon) on Aug 02, 2015 at 20:24 UTC
|
What struck me was that the three programming tasks are, at least notionally, so trivial.
Well, they are only giving away a telly . . .
The way forward always starts with a minimal test.
| [reply] [d/l] |
|
|
The keyword in your quote is "notionally". Whilst the first task is unequivocally trivial; the other two are not necessarily so.
The prize is (for me) irrelevant; the challenge is what interested me. The wording of the preamble about "brute force" made it so.
| [reply] |
|
|
| [reply] |
|
|
Re: IBM Cloud Challenge.
by trippledubs (Deacon) on Aug 30, 2015 at 16:41 UTC
|
Initially I thought that in the change problem they gave you denominations, but the way I read it now seems to mean they give you a list of coins, so that you can't use two of a denomination if they only list it once. In the sample data you don't need more than one coin of each denomination. So that makes the difference if you have say 7,5,2:14 Is that using all coins or two 7s?
Mojolicious::Lite just shines when it comes to making small encapsulated web apps
Question 2:
#!/usr/bin/env perl
use Mojolicious::Lite;
sub makeChange {
my $line = shift;
my @available = split /[,:]/,$line;
my $changeNeeded = pop @available;
@available = sort { $b <=> $a } @available;
my %coins;
while ($changeNeeded > 0 && @available > 0 ) {
my $denom = shift @available;
if ($denom <= $changeNeeded) {
$changeNeeded -= $denom;
$coins{$denom}++;
#unshift @available,$denom; #Multiple larger c
+oins?
}
}
warn "Could not make change correctly: $line" if ($changeNeede
+d != 0);
return %coins;
}
get '/' => sub {
my $c = shift;
$c->render(template => 'index');
};
post '/make/change' => sub {
my $c = shift;
my $changeToMake = $c->param('data');
my @lines = split /\r?\n/, $changeToMake;
my @answer = map { { makeChange($_) } } @lines;
my @formattedAnswers;
for my $coin (sort { $b <=> $a } @answer) {
my @formatted;
for (sort { $b <=> $a } keys %{$coin}) {
push @formatted, "$_". 'x' . "$coin->{$_}";
}
unshift @formattedAnswers, [ @formatted ];
}
$c->render(
answer => \@answer,
formatted=>\@formattedAnswers,
template => 'makeChange'
);
};
app->start;
__DATA__
@@ index.html.ep
% layout 'default';
% title 'Welcome';
<h2>Question 2 Data Input</h2>
<form action="/make/change" method="post" >
<textarea rows=30 cols=80 name="data" id="comment" value="" required >
</textarea>
<input type="submit" value="Run"></input>
</form>
@@ makeChange.html.ep
<h2>Question 2 Results</h2>
% for my $answer (@{$formatted}) {
%== join ',',@{$answer}
<br>
% }
@@ layouts/default.html.ep
<!DOCTYPE html>
<html>
<head><title><%= title %></title></head>
<body><%= content %></body>
</html>
| [reply] [d/l] [select] |
|
|
| [reply] |
|
|
| [reply] |
|
|
|
|