Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions SinError
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
fac 0 = 1
fac n = n * fac (n-1)
pow x 0 = 1
pow x n = x*(pow x (n-1))
computer e n x cursum = do
let an=(pow x (2*n-1))
let bn=(fac (2*n-1))
let cn=(pow (-1) (n+1))
let tn=cn*an/bn
if(e<abs tn)
then do
print tn
computer e (n+1) x (cursum+tn)
else print (cursum+tn)





main = do
print "Enter value of x in radians"
str1<-getLine
print "Enter maximum error value"
str2<-getLine
let x=read str1::Double
let e=read str2::Double
computer e 1 x 0
57 changes: 57 additions & 0 deletions Tictactoe HAskell
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
sm a x y c=do
let check1 =0
let check2 =0
let check3 =0
let check4 =0
let check5 =0
let check6 =0
let check7 =0
let check8 =0
if (a!!x!!y/=2)
then do
print "INVALID COORDINATES!! enter unfilled coordinates"
y<-getLine
x<-getLine
sm a (read x::Int) (read y::Int) c
else return()

let row=a!!y
let p1=take x row
let p2= drop (x+1) row
let nrow=p1++[c `mod` 2]++p2
let py1=take y a
let py2=drop (y+1) a
let f=py1++[nrow]++py2
print (f!!0)
print (f!!1)
print (f!!2)
let b = c+1
check1 <- if (f!!0!!0==f!!0!!1)&&(f!!0!!1==f!!0!!2)&&(f!!0!!2/=2) then return (1) else return (0)
check2 <- if (f!!1!!0==f!!1!!1)&&(f!!1!!1==f!!1!!2)&&(f!!1!!2/=2) then return (1) else return (0)
check3 <- if (f!!2!!0==f!!2!!1)&&(f!!2!!1==f!!2!!2)&&(f!!2!!2/=2) then return (1) else return (0)
check4 <- if (f!!0!!0==f!!1!!0)&&(f!!2!!0==f!!1!!0)&&(f!!1!!0/=2) then return (1) else return (0)
check5 <- if (f!!0!!1==f!!1!!1)&&(f!!1!!1==f!!2!!1)&&(f!!2!!1/=2) then return (1) else return (0)
check6 <- if (f!!0!!2==f!!1!!2)&&(f!!2!!2==f!!1!!2)&&(f!!1!!2/=2) then return (1) else return (0)
check7 <- if (f!!0!!0==f!!1!!1)&&(f!!1!!1==f!!2!!2)&&(f!!2!!2/=2) then return (1) else return (0)
check8 <- if (f!!0!!2==f!!1!!1)&&(f!!1!!1==f!!2!!0)&&(f!!2!!0/=2) then return (1) else return (0)
let check = check1+check2+check3+check4+check5+check6+check7+check8
if (check/=0)
then do
print "Game Over"
print (c `mod` 2)
print "Wins"
else return()
print "Please enter x and y coordinates for next turn "
y<-getLine
x<-getLine
if (check==0) then sm f (read x::Int) (read y::Int) b else print ("GAME OVER ")

main=do
let f=[[2,2,2],[2,2,2],[2,2,2]]
print (f!!0)
print (f!!1)
print (f!!2)
print "Please enter x and y coordinates for first turn "
x<-getLine
y<-getLine
sm f (read x::Int) (read y::Int) 0
4 changes: 4 additions & 0 deletions factorial.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
main = print (fac 50)

fac 0 = 1
fac n = n * fac (n-1)
1 change: 1 addition & 0 deletions pushed.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
THis file is pushed Via Terminal
97 changes: 97 additions & 0 deletions tic_tac_toe_InC
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
#include<stdio.h>
int arr[3][3];
int options[9];
int choice;
int x[9];
int y[9];
int pass=1;
void initialize()
{
int i,j;
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
arr[i][j]=0;
}
}
}


void printing()
{
int i,j;
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{ if(arr[i][j]==1)
printf(" 0 ");
else if(arr[i][j]==2)
printf(" X ");
else
printf(" ");
}
printf("\n\n");
}
}


void displayoptions()
{
int c=1,i,j;
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
if((arr[i][j]!=1)&&(arr[i][j]!=2))
{
printf("%d.(%d,%d)\n",c,i+1,j+1);
x[c-1]=i;
y[c-1]=j;
options[c-1]=c++;
}
}
}
printf("Enter Your Choice ");
scanf("%d",&choice);
pass++;

}


int update()
{
if(pass%2==0)
arr[x[choice-1]][y[choice-1]]=1;
else
arr[x[choice-1]][y[choice-1]]=2;
}


int main()
{

printf(" *-*-*-*-*-*-*- O has First turn *-*-*-*-*-*-*-*\n");

int i=0;
initialize();
printing();
while(i<10)
{
displayoptions();
update();
printing();

i++;
}
}










4 changes: 4 additions & 0 deletions try
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
git remote add Ahsan https://github.com/ahsanbarkati/ACA_Haskell.git
git push serversbrnchname loclbrnchname
git pull <local> <remote>
git push <remote <local>