aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHVukman <peterslopp@googlemail.com>2025-08-08 17:31:29 +0200
committerGitHub <noreply@github.com>2025-08-08 17:31:29 +0200
commit5bc15d9d25aef49bf474bd56a13746a91e2ccd34 (patch)
treea44f5bae9f4c371e5a68b46fe66ac062bc44f300
parentad7449cae11b27d93368184ea2bbe271fee65ecd (diff)
downloadperlweeklychallenge-club-5bc15d9d25aef49bf474bd56a13746a91e2ccd34.tar.gz
perlweeklychallenge-club-5bc15d9d25aef49bf474bd56a13746a91e2ccd34.tar.bz2
perlweeklychallenge-club-5bc15d9d25aef49bf474bd56a13746a91e2ccd34.zip
Create 333_p1.fs
-rw-r--r--challenge-333/hvukman/f#/333_p1.fs15
1 files changed, 15 insertions, 0 deletions
diff --git a/challenge-333/hvukman/f#/333_p1.fs b/challenge-333/hvukman/f#/333_p1.fs
new file mode 100644
index 0000000000..7bebaaf2ac
--- /dev/null
+++ b/challenge-333/hvukman/f#/333_p1.fs
@@ -0,0 +1,15 @@
+// 333 part 1
+
+let input = [ [|2;1|] ; [|2;3|] ; [|2;5|] ];
+let input2 = [ [|1;4|] ; [|3;4|] ; [|10;4|] ];
+let input3 = [ [|0;0|] ; [|1;1|] ; [|2;3|] ];
+let input4 = [ [|10000;10000|] ; [|20000;20000|] ; [|30000;30000|] ];
+let inputs_1 = [ input; input2 ; input3; input4]
+// -- calculated the determinant
+// -- https://de.wikipedia.org/wiki/Kollinearität#Analytische_Geometrie
+let det (x:int array list) = let x1,x2,x3 = x[0].[0],x[1].[0],x[2].[0]
+ let y1,y2,y3 = x[0].[1],x[1].[1],x[2].[1]
+ let det = x1*y2 + x2*y3 + x3*y1 - x1*y3 - x2*y1 - x3*y2
+ if det =0 then printf "%s\n" "true" else printf "%s\n" "false"
+
+