From b0e3c4a87d7f7813bb2b01484cb4e6950071e1a2 Mon Sep 17 00:00:00 2001 From: Bill Ewanick Date: Sat, 14 Oct 2023 16:41:29 -0400 Subject: [PATCH] Start of 15 --- src/projectEuler/question15.hs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 src/projectEuler/question15.hs diff --git a/src/projectEuler/question15.hs b/src/projectEuler/question15.hs new file mode 100644 index 0000000..94d7c7d --- /dev/null +++ b/src/projectEuler/question15.hs @@ -0,0 +1,23 @@ +{- +https://projecteuler.net/problem=15 + +Starting in the top left corner of a 2x2 grid, and only being able to move to the right and down, there are exactly 6 routes to the bottom right corner. + +How many such routes are there through a 20x20 grid? +-} +module Main where + +import Prelude hiding (Right) + +main :: IO () +main = print ans + +ans = 42 + +limit = 20 +points = [(x,y) | x <- [1..limit], y <- [1..limit]] + +data Direction = Right | Down + +move Right (x,y) = (x+1, y ) +move Down (x,y) = (x , y+1)