#!/usr/bin/perl -I ../../cgi-bin

use CGI::Carp qw(fatalsToBrowser);
use AIOC::HTML;
use AIOC::SiteBase;
use POSIX qw(strftime);

$specDir = AIOC::SiteBase::specDir();
my $site = new AIOC::SiteBase("aioc", "$specDir/aioc.train", '', $site_news);

$site->putHeader();
$site->putPageHeader("Tutorials");

@problems = (
	{name => "Addition", href => "01", description => "I/O", codePrefix => "add"},
	{name => "Sitting or Standing?", href => "02", description => "conditional statements, I/O", codePrefix => "sit"},
	{name => "Mixed Fraction", href => "03", description => "division and modulo operators", codePrefix => "mixed"},
	{name => "A Mindbending Scenario", href => "04", description => "conditional statements, basic inclusion/exclusion", codePrefix => "bend"},
	{name => "The Tremendous Tak-Tak Tree", href => "05", description => "modulo operators, loops", codePrefix => "taktak"},
	{name => "Counting to Infinity", href => "06", description => "loops","count"},
	{name => "A Dish Best Served Cold", href => "07", description => "loops, maxima/minima, summation", codePrefix => "stats"},
	{name => "Drought", href => "08", description => "controlling loop flow", codePrefix => "drought"},
	{name => "Encyclop&aelig;dia", href => "09", description => "arrays and direct lookup", codePrefix => "ency"},
	{name => "Dictionary", href => "10", description => "arrays and linear search", codePrefix => "dict"},
	{name => "Triple Hunting", href => "11", description => "arrays and storing results"},
);

print << "__END__";
<h1>Getting Started with Programming</h1>

<p>
New to programming? Check out our <a href="getting_started/getting_started.html">guide</a> to get Python or C++ set up on your Windows, Mac or Linux system.
</p>

<h1>'Starter Problem' Walkthroughs</h1>

<p>
These 'walkthroughs' are designed to help you solve the problems in the 'Starter Problem' sets. They are aimed at improving your coding and problem solving skills to the point where you can confidently tackle competitions like the Australian Informatics Olympiad (AIO). 
</p>

<ul>
__END__
foreach $problem (@problems) {
	print << "__END__";
	<li>
	<a href="walkthroughs/$problem->{href}.html">$problem->{name}</a>
	- $problem->{description}
	</li>
__END__
}
print << "__END__";
</ul>

<p>
Remember, these are a work in progress, and there's always room for feedback and improvement. If you have any comments or questions about these problems and their walkthroughs, or about the Australian Informatics program at all, don't hesitate to ask on the forums.
</p>

<h1>'Starter Problem' Sample Solutions</h1>

<p>
Sample code in C++ and Pascal that implements the solutions described in the walkthrough. These solutions are intended as a reference in case of language difficulties, and you should avoid looking at them if possible until you have successfully solved the relevant problem.
</p>

<ul>
__END__
foreach $problem (@problems) {
	exists $problem->{codePrefix} || next;
	print << "__END__";
	<li>
	$problem->{name}:
	<a href="sample_code/$problem->{codePrefix}.cpp">C++</a> |
	<a href="sample_code/$problem->{codePrefix}.pas">Pascal</a>
	</li>
__END__
}
print << "__END__";
</ul>
__END__

$site->putPageFooter();

# Always return true.
1;
