package project3

object text extends testing.Show {

  ////////////////////////////////////////////////////////////////
  // Extracting lines
  ////////////////////////////////////////////////////////////////

  // to complete...

  ////////////////////////////////////////////////////////////////
  // Counting words
  ////////////////////////////////////////////////////////////////

  // to complete...

  ////////////////////////////////////////////////////////////////
  // Building a word index
  ////////////////////////////////////////////////////////////////

  // to complete...

  ////////////////////////////////////////////////////////////////
  // Calendars
  ////////////////////////////////////////////////////////////////

  def firstOfJan(y: Int): Int = {
    val x = y - 1
    (365*x + x/4 - x/100 + x/400 + 1) % 7
  }

  def isLeapYear(y: Int) =
    if (y % 100 == 0) (y % 400 == 0) else (y % 4 == 0)

  def mlengths(y: Int): List[Int] = {
    val feb = if (isLeapYear(y)) 29 else 28
    List(31, feb, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31)
  }

  //def firstDay(m: Int, y: Int): Int =

  case class Picture(height: Int, width: Int, pxx: List[List[Char]]) {
    //def above(q: Picture) =
    //def beside(q: Picture) =
    //def showIt: String = unlines(pxx).mkString("")
  }

  def pixel(c: Char) = Picture(1, 1, List(List(c)))

  //def stack(pics: List[Picture]): Picture =

  //def spread(pics: List[Picture]): Picture =

  //def tile(pxx: List[List[Picture]]): Picture =

  //def rightJustify(jw: Int)(chars: List[Char]): Picture =

  //def group[T](n: Int, xs: List[T]): List[List[T]] =

  //def dayPics(d: Int, s: Int): List[Picture] =
    
  //def calendar(year: Int, month: Int): Picture =

  def main(args: Array[String]) {
    'isLeapYear(2008)
  }

}