You are viewing our Forum Archives. To view or take place in current topics click here.
Help with fortran
Posted:
Help with fortranPosted:
Status: Offline
Joined: Feb 15, 201113Year Member
Posts: 36
Reputation Power: 1
Status: Offline
Joined: Feb 15, 201113Year Member
Posts: 36
Reputation Power: 1
Hey guys, I am wondering where i am missing the endif statement in this fortran craps program. Could you take a look? I will just put it in a code tag and not upload a file so I do not have to post a virus scan(Extremely slow for me)
Here is the error:
f95 craps.f95
In file craps.f95:823
enddo
1
Error: Expecting END IF statement at (1)
In file craps.f95:850
endprogram
1
Error: Expecting END IF statement at (1)
In file craps.f95:853
subroutine init_random_seed()
1
Error: Unclassifiable statement at (1)
In file craps.f95:855
integer::i,n,clock
1
Error: Symbol 'i' at (1) already has basic type of INTEGER
In file craps.f95:856
integer,dimension(,allocatable::seed
1
Error: Unexpected data declaration statement at (1)
In file craps.f95:858
allocate(seed(n))
1
Error: Syntax error in ALLOCATE statement at (1)
In file craps.f95:865
end subroutine
1
Error: Expecting END IF statement at (1)
Error: Unexpected end of file in 'craps.f95'
program craps
implicit none
character(15),dimension(20)::bet
character(1)::yorn
integer::i,amt,num,totalplayers,sum,point,j,n=20,pass,k
real::x,y
character(8)::tempname
integer::tempmoney,die1,die2
character(8),dimension(21)::name
real,dimension(21)::money
integer,dimension(20,5)::wages
integer,dimension(2,99)::roll
yorn="n"
do i=1,21
name(i)=""
money(i)=0
enddo
roll=0
wages=0
!adding players
Print*,"How many players? 1-20"
read*,amt
totalplayers=amt
do i=1,amt
print*,"Player ",i,", enter your name."
read*,name(i)
money(i)=500
enddo
call init_random_seed()
do
if(yorn=="y")exit
i=1
write(*,100)"Time for you to roll ",name(1)
write(*,100)"Would you like to bet passline or dontpassline?",name(1)
read*,bet(1)
if(bet(1)=="passline")then
print*,"How much would you like to bet? You currently have $",money(i),",",name(i)
read*,wages(i,1)
money(i)=money(i)-wages(i,1)
do i=2,amt
print*,"How would you like to bet, ",name(i)
print*,"come, dontcome, 2's, 3's, yos (11), 12's (boxcars), hilo (2 or 12), anycraps (2, 3, or 12),"
print*,"c&e (2,3,12 or 11, one will always lose), 7's, hardway (two 3's, 4's, or 5's), easyway, thehorn(2,3,11,12), "
print*," field(2, 3, 4, 9, 10, 11, or 12) ,big6 or big8"
read*,bet(i)
if(bet(i)=="2")then
print*,"How much would you like to bet?"
read*,wages(i,1)
money(1)=money(1)-wages(1,1)
endif
if(bet(i)=="come".or.bet(i)=="dontcome")then
print*,"You will be asked to bet after the first roll"
endif
if(bet(i)=="anycraps".or.bet(i)=="7".or.bet(i)=="hardway")then
print*,"How much would you like to bet?"
read*,wages(i,1)
money(i)=money(i)-wages(i,1)
endif
if(bet(i)=="easyway".or.bet(i)=="big6")then
print*,"How much would you like to bet?"
read*,wages(i,1)
money(i)=money(i)-wages(i,1)
endif
if(bet(i)=="3".or.bet(i)=="yos".or.bet(i)=="12".or.bet(i)=="hilo")then
print*,"How much would you like to bet?"
read*,wages(i,1)
money(i)=money(i)-wages(i,1)
endif
if(bet(i)=="big8")then
print*,"How much would you like to bet?"
read*,wages(i,1)
money(i)=money(i)-wages(i,1)
endif
if(bet(i)=="thehorn")then
print*,"How much would you like to bet on 2?"
read*,wages(i,1)
money(i)=money(i)-wages(i,1)
print*,"How much on 3?"
read*,wages(i,2)
money(i)=money(i)-wages(i,2)
print*,"On 11?"
read*,wages(i,3)
money(i)=money(i)-wages(i,3)
print*,"On 12?"
read*,wages(i,4)
money(i)=money(i)-wages(i,4)
endif
if(bet(i)=="c&e")then
print*,"How much would you like to bet on craps?"
read*,wages(i,1)
money(i)=money(i)-wages(i,1)
print*,"What about on 11?"
read*,wages(i,2)
money(i)=money(i)-wages(i,2)
endif
enddo
i=1
call random_number(x)
die1=1+6*x
call random_number(x)
die2=1+6*x
print*,"You rolled a ",die1," and a ",die2
roll(1,1)=die1
roll(2,1)=die2
if(die1+die2==7.or.die1+die2==11)then
print*,"You've won your wager of ",wages(i,1)," so, you break even and are back at $",money(i)+wages(i,1)
money(i)=money(i)+wages(i,1)*2
endif
if(die1+die2==2.or.die1+die2==12.or.die1+die2==3)then
print*,"Sorry, you rolled a ",die1+die2," which means you lost your wager of, ",wages(i,1)
print*,"That brought you from ",money(i)+wages(i,1)," to ",money(i)
endif
if(die1+die2==4.or.die1+die2==5.or.die1+die2==6.or.die1+die2==8.or.die1+die2==9.or.die1+die2==10)then
print*,"The point number is now ",die1+die2,". You must get that before another ",7
point=die1+die2
do i=2,amt
if(bet(i)=="come")then
Print*,"How much do you want to bet on this bet?",name(i)
read*,wages(i,1)
endif
if(bet(i)=="dontcome")then
Print*,"How much do you want to bet on this bet?",name(i)
read*,wages(i,1)
endif
enddo
i=1
do j=2,99
call random_number(x)
die1=1+6*x
call random_number(x)
die2=1+6*x
roll(1,j)=die1
roll(2,j)=die2
print*,"You rolled a ",die1," and a ",die2
if(die1+die2/=7.and.die1+die2/=point)then
print*,"You have not rolled a ",7," or a ",point
else
if(die1+die2==7)then
print*,"Sorry, you rolled a ",7," which means you lost your wager of, ",wages(1,1)
print*,"That brought you from ",money(i)+wages(i,1)," to ",money(i)
else
if(die1+die2==point)then
print*,"Congratulations! You rolled a ",die1+die2
print*,"This brought your total money to ",money(i)+wages(i,1)*2
money(i)=money(i)+wages(i,1)*2
endif
endif
endif
if(die1+die2==7)exit
if(die1+die2==point)exit
enddo
i=2
do
if(i>amt)exit
print*,"Here is your outcome, ",name(i)
if(bet(i)=="come")then
if(roll(1,2)+roll(2,2)==2.or.roll(1,2)+roll(2,2)==3.or.roll(1,2)+roll(2,2)==12)then
print*,"Sorry, you lost your bet of",wages(i,1)
print*,"You have ",money(i)
else
if(roll(1,2)+roll(2,2)==7.or.roll(1,2)+roll(2,2)==11)then
print*,"Congratulations! You won your wager of ",wages(i,1)
print*,"You now have ",money(i)+wages(i,1)*2
else
do j=3,99
if(roll(1,j)+roll(2,j)==roll(1,2)+roll(2,2))then
print*,"You won your bet of",wages(i,1),", which means you doubled your money in the wager"
print*,"You now have",money(i)+wages(i,1)*2
endif
if(roll(1,j)+roll(2,j)==7)then
print*,"Sorry you lost. You now have,",money(i)
endif
if(roll(1,j)+roll(2,j)==7.or.roll(1,j)+roll(2,j)==roll(1,2)+roll(2,2))exit
enddo
endif
endif
endif!come
if(bet(i)=="dontcome")then
if(roll(1,2)+roll(2,2)==7.or.roll(1,2)+roll(2,2)==11)then
print*,"Sorry, you lost your bet of",wages(i,1)
print*,"You have ",money(i)
else
if(roll(1,2)+roll(2,2)==2.or.roll(1,2)+roll(2,2)==3)then
print*,"Congratulations! You won your wager of ",wages(i,1)
print*,"You now have",money(i)+wages(i,1)
money(i)=money(i)+wages(i,1)
else
do j=3,99
if(roll(1,j)+roll(2,j)==roll(1,2)+roll(2,2))then
print*,"Sorry you lost. You now have,",money(j)
endif
if(roll(1,j)+roll(2,j)==7)then
print*,"You won your bet of",wages(i,1),", which means you doubled your money in the wager"
print*,"You now have",money(i)+wages(i,1)*2
money(i)=money(i)+wages(i,1)*2
endif
if(roll(1,j)+roll(2,j)==roll(1,2)+roll(2,2))exit
if(roll(1,j)+roll(2,j)==7)exit
enddo
endif
endif
endif!dontcome
if(bet(i)=="2")then
if(roll(1,1)+roll(2,1)==2)then
print*,"Congrats! You win!"
print*,"You brought your money from",money(i),"to ",money(i)+wages(i,1)+wages(i,1)*30
money(i)=money(i)+wages(i,1)+wages(i,1)*30
else
print*,"Sorry, You lost your wager of",wages(i,1)
endif
endif !2
if(bet(i)=="12")then
if(roll(1,1)+roll(2,1)==12)then
print*,"Congrats! You win!"
print*,"You brought your money from",money(i),"to ",money(i)+wages(i,1)*31
money(i)=money(i)+wages(i,1)+wages(i,1)*30
else
print*,"Sorry, You lost your wager of",wages(i,1)
endif
endif !12
if(bet(i)=="3")then
if(roll(1,1)+roll(2,1)==3)then
print*,"Congrats! You win!"
print*,"You brought your money from",money(i),"to ",money(i)+wages(i,1)+wages(i,1)*15
money(i)=money(i)+wages(i,1)+wages(i,1)*15
else
print*,"Sorry, You lost your wager of",wages(i,1)
endif
endif !3
if(bet(i)=="11")then
if(roll(1,1)+roll(2,1)==11)then
print*,"Congrats! You win!"
print*,"You brought your money from",money(i),"to ",money(i)+wages(i,1)+wages(i,1)*15
money(i)=money(i)+wages(i,1)+wages(i,1)*15
else
print*,"Sorry, You lost your wager of",wages(i,1)
endif
endif !11
if(bet(i)=="7")then
if(roll(1,1)+roll(2,1)==7)then
print*,"Congrats! You win!"
print*,"You brought your money from",money(i),"to ",money(i)+wages(i,1)+wages(i,1)*4
money(i)=money(i)+wages(i,1)+wages(i,1)*4
else
print*,"Sorry, You lost your wager of",wages(i,1)
endif
endif !7
if(bet(i)=="easyway")then
do k=1,99
if(roll(1,k)+roll(2,k)==4)exit
if(roll(1,k)+roll(2,k)==6)exit
if(roll(1,k)+roll(2,k)==8)exit
if(roll(1,k)+roll(2,k)==10)exit
if(roll(1,k)+roll(2,k)==7)exit
enddo
if(roll(1,k)/=roll(2,k))then
print*,"Congrats! You win!"
if(roll(1,k)+roll(2,k)==4.or.roll(1,k)+roll(2,k)==10)then
print*,"You brought your money from",money(i),"to ",money(i)+wages(i,1)+wages(i,1)*7
money(i)=money(i)+wages(i,1)+wages(i,1)*7
else
if(roll(1,k)+roll(2,k)==4.or.roll(1,k)+roll(2,k)==10)then
print*,"You brought your money from",money(i),"to ",money(i)+wages(i,1)+wages(i,1)*9
money(i)=money(i)+wages(i,1)+wages(i,1)*9
else
print*,"Sorry, You lost your wager of",wages(i,1)
endif
endif
endif
endif !hard
if(bet(i)=="hardway")then
do k=1,99
if(roll(1,k)+roll(2,k)==4)exit
if(roll(1,k)+roll(2,k)==6)exit
if(roll(1,k)+roll(2,k)==8)exit
if(roll(1,k)+roll(2,k)==10)exit
if(roll(1,k)+roll(2,k)==7)exit
enddo
if(roll(1,k)==roll(2,k))then
print*,"Congrats! You win!"
if(roll(1,k)+roll(2,k)==4.or.roll(1,k)+roll(2,k)==10)then
print*,"You brought your money from",money(i),"to ",money(i)+wages(i,1)+wages(i,1)*7
money(i)=money(i)+wages(i,1)+wages(i,1)*7
else
if(roll(1,k)+roll(2,k)==4.or.roll(1,k)+roll(2,k)==10)then
print*,"You brought your money from",money(i),"to ",money(i)+wages(i,1)+wages(i,1)*9
money(i)=money(i)+wages(i,1)+wages(i,1)*9
else
print*,"Sorry, You lost your wager of",wages(i,1)
endif
endif
endif
endif !hard
if(bet(i)=="big6")then
do k=1,99
if(roll(1,k)+roll(2,k)==6)exit
if(roll(1,k)+roll(2,k)==7)exit
enddo
if(roll(1,k)+roll(2,k)==6)then
print*,"You win!"
print*,"You brought your money from",money(i),"to ",money(i)+wages(i,1)*2
money(i)=money(i)+wages(i,1)*2
else
print*,"Sorry, You lost your wager of",wages(i,1)
endif
endif !big6
if(bet(i)=="big8")then
do k=1,99
if(roll(1,k)+roll(2,k)==8)exit
if(roll(1,k)+roll(2,k)==7)exit
enddo
if(roll(1,k)+roll(2,k)==8)then
print*,"You win!"
print*,"You brought your money from",money(i),"to ",money(i)+wages(i,1)*2
money(i)=money(i)+wages(i,1)*2
else
print*,"Sorry, You lost your wager of",wages(i,1)
endif
endif !big8
if(bet(i)=="hilo")then
if(roll(1,1)+roll(2,1)==2.or.roll(1,1)+roll(2,1)==12)then
print*,"Congrats! You win!"
print*,"You brought your money from",money(i),"to ",money(i)+wages(i,1)+wages(i,1)*15
money(i)=money(i)+wages(i,1)+wages(i,1)*15
else
print*,"Sorry, You lost your wager of",wages(i,1)
endif
endif !hilo
if(bet(i)=="anycraps")then
if(roll(1,1)+roll(2,1)==2.or.roll(1,1)+roll(2,1)==12.or.roll(1,1)+roll(2,1)==3)then
print*,"Congrats! You win!"
print*,"You brought your money from",money(i),"to ",money(i)+wages(i,1)+wages(i,1)*7
money(i)=money(i)+wages(i,1)+wages(i,1)*7
else
print*,"Sorry, You lost your wager of",wages(i,1)
endif
endif !any
if(bet(i)=="field")then
if(roll(1,1)+roll(2,1)==3.or.roll(1,1)+roll(2,1)==4.or.roll(1,1)+roll(2,1)==9.or.roll(1,1)+roll(2,1)==10)then
print*,"Congrats! You win!"
print*,"You brought your money from",money(i),"to ",money(i)+wages(i,1)*2
money(i)=money(i)+wages(i,1)*2
else
if(roll(1,1)+roll(2,1)==2.or.roll(1,1)+roll(2,1)==12)then
print*,"Congrats! You win!"
print*,"You brought your money from",money(i),"to ",money(i)+wages(i,1)*3
money(i)=money(i)+wages(i,1)*3
else
if(roll(1,1)+roll(2,1)==11)then
print*,"Congrats! You win!"
print*,"You brought your money from",money(i),"to ",money(i)+wages(i,1)*2
money(i)=money(i)+wages(i,1)*2
else
print*,"Sorry, You lost your wager of",wages(i,1)
endif
endif
endif
endif !field
if(bet(i)=="c&e")then
if(roll(1,1)+roll(2,1)==2.or.roll(1,1)+roll(2,1)==12.or.roll(1,1)+roll(2,1)==3)then
print*,"Congrats! Your craps bet won!"
print*,"You brought your money from",money(i),"to ",money(i)+wages(i,1)+wages(i,1)*3
money(i)=money(i)+wages(i,1)+wages(i,1)*3
else
if(roll(1,1)+roll(2,1)==11)then
print*,"Congrats! Your elevens bet won!"
print*,"You brought your money from",money(i),"to ",money(i)+wages(i,1)+wages(i,1)*7
money(i)=money(i)+wages(i,1)+wages(i,1)*7
else
print*,"Sorry, You lost your wager of",wages(i,1)+wages(i,2)+wages(i,3)+wages(i,4)
endif
endif
endif !any
if(bet(i)=="thehorn")then
if(roll(1,1)+roll(2,1)==2)then
print*,"Congrats! Your 2 bet won!"
print*,"You brought your money from",money(i),"to ",money(i)+wages(i,1)+wages(i,1)*6.75
money(i)=money(i)+wages(i,1)+wages(i,1)*6.75
else
if(roll(1,1)+roll(2,1)==12)then
print*,"Congrats! Your 12's bet won!"
print*,"You brought your money from",money(i),"to ",money(i)+wages(i,1)+wages(i,1)*6.75
money(i)=money(i)+wages(i,1)+wages(i,1)*6.75
else
if(roll(1,1)+roll(2,1)==3)then
print*,"Congrats! Your 3's bet won!"
print*,"You brought your money from",money(i),"to ",money(i)+wages(i,1)+wages(i,1)*3
money(i)=money(i)+wages(i,1)+wages(i,1)*3
else
if(roll(1,1)+roll(2,1)==11)then
print*,"Congrats! Your 11's bet won!"
print*,"You brought your money from",money(i),"to ",money(i)+wages(i,1)+wages(i,1)*3
money(i)=money(i)+wages(i,1)+wages(i,1)*3
else
print*,"Sorry, You lost your wager of",wages(i,1)
endif
endif
endif
endif
endif !horn
i=i+1
enddo
endif !passline
if(bet(1)=="dontpassline")then
print*,"How much would you like to bet? You currently have $",money(i),",",name(i)
read*,wages(i,1)
money(i)=money(i)-wages(i,1)
do i=2,amt
print*,"How would you like to bet, ",name(i)
print*,"come, dontcome, 2's, 3's, yos (11), 12's (boxcars), hilo (2 or 12), anycraps (2, 3, or 12),"
print*,"c&e (2,3,12 or 11, one will always lose), 7's, hardway (two 3's, 4's, or 5's), easyway, thehorn(2,3,11,12), "
print*," field(2, 3, 4, 9, 10, 11, or 12) ,big6 or big8"
read*,bet(i)
if(bet(i)=="2")then
print*,"How much would you like to bet?"
read*,wages(i,1)
money(1)=money(1)-wages(1,1)
endif
if(bet(i)=="come".or.bet(i)=="dontcome")then
print*,"You will be asked to bet after the first roll"
endif
if(bet(i)=="anycraps".or.bet(i)=="7".or.bet(i)=="hardway")then
print*,"How much would you like to bet?"
read*,wages(i,1)
money(i)=money(i)-wages(i,1)
endif
if(bet(i)=="easyway".or.bet(i)=="big6")then
print*,"How much would you like to bet?"
read*,wages(i,1)
money(i)=money(i)-wages(i,1)
endif
if(bet(i)=="3".or.bet(i)=="yos".or.bet(i)=="12".or.bet(i)=="hilo")then
print*,"How much would you like to bet?"
read*,wages(i,1)
money(i)=money(i)-wages(i,1)
endif
if(bet(i)=="big8")then
print*,"How much would you like to bet?"
read*,wages(i,1)
money(i)=money(i)-wages(i,1)
endif
if(bet(i)=="thehorn")then
print*,"How much would you like to bet on 2?"
read*,wages(i,1)
money(i)=money(i)-wages(i,1)
print*,"How much on 3?"
read*,wages(i,2)
money(i)=money(i)-wages(i,2)
print*,"On 11?"
read*,wages(i,3)
money(i)=money(i)-wages(i,3)
print*,"On 12?"
read*,wages(i,4)
money(i)=money(i)-wages(i,4)
endif
if(bet(i)=="c&e")then
print*,"How much would you like to bet on craps?"
read*,wages(i,1)
money(i)=money(i)-wages(i,1)
print*,"What about on 11?"
read*,wages(i,2)
money(i)=money(i)-wages(i,2)
endif
enddo
i=1
call random_number(x)
die1=1+6*x
call random_number(x)
die2=1+6*x
print*,"You rolled a ",die1," and a ",die2
roll(1,1)=die1
roll(2,1)=die2
if(die1+die2==2.or.die1+die2==3)then
print*,"You've won your wager of ",wages(i,1)," so, you double your money and have $",money(i)+wages(i,1)
money(i)=money(i)+wages(i,1)*2
endif
if(die1+die2==7.or.die1+die2==11)then
print*,"Sorry, you rolled a ",die1+die2," which means you lost your wager of, ",wages(i,1)
print*,"That brought you from ",money(i)+wages(i,1)," to ",money(i)
endif
if(die1+die2==4.or.die1+die2==5.or.die1+die2==6.or.die1+die2==8.or.die1+die2==9.or.die1+die2==10)then
print*,"The point number is now ",die1+die2,". You must get a 7 before another ",die1+die2
point=die1+die2
do i=2,amt
if(bet(i)=="come")then
Print*,"How much do you want to bet on this bet?",name(i)
read*,wages(i,1)
endif
if(bet(i)=="dontcome")then
Print*,"How much do you want to bet on this bet?",name(i)
read*,wages(i,1)
endif
enddo
i=1
do j=2,99
call random_number(x)
die1=1+6*x
call random_number(x)
die2=1+6*x
roll(1,j)=die1
roll(2,j)=die2
print*,"You rolled a ",die1," and a ",die2
if(die1+die2/=7.and.die1+die2/=point)then
print*,"You have not rolled a ",7," or a ",point
else
if(die1+die2==point)then
print*,"Sorry, you rolled a ",point," which means you lost your wager of, ",wages(1,1)
print*,"That brought you from ",money(i)+wages(i,1)," to ",money(i)
else
if(die1+die2==7)then
print*,"Congratulations! You rolled a ",die1+die2
print*,"This brought your total money to ",money(i)+wages(i,1)*2
money(i)=money(i)+wages(i,1)*2
endif
endif
endif
if(die1+die2==7)exit
if(die1+die2==point)exit
enddo
i=2
do
if(i>amt)exit
print*,"Here is your outcome, ",name(i)
if(bet(i)=="come")then
if(roll(1,2)+roll(2,2)==2.or.roll(1,2)+roll(2,2)==3.or.roll(1,2)+roll(2,2)==12)then
print*,"Sorry, you lost your bet of",wages(i,1)
print*,"You have ",money(i)
else
if(roll(1,2)+roll(2,2)==7.or.roll(1,2)+roll(2,2)==11)then
print*,"Congratulations! You won your wager of ",wages(i,1)
print*,"You now have ",money(i)+wages(i,1)*2
else
do j=3,99
if(roll(1,j)+roll(2,j)==roll(1,2)+roll(2,2))then
print*,"You won your bet of",wages(i,1),", which means you doubled your money in the wager"
print*,"You now have",money(i)+wages(i,1)*2
endif
if(roll(1,j)+roll(2,j)==7)then
print*,"Sorry you lost. You now have,",money(i)
endif
if(roll(1,j)+roll(2,j)==7.or.roll(1,j)+roll(2,j)==roll(1,2)+roll(2,2))exit
enddo
endif
endif
endif!come
if(bet(i)=="dontcome")then
if(roll(1,2)+roll(2,2)==7.or.roll(1,2)+roll(2,2)==11)then
print*,"Sorry, you lost your bet of",wages(i,1)
print*,"You have ",money(i)
else
if(roll(1,2)+roll(2,2)==2.or.roll(1,2)+roll(2,2)==3)then
print*,"Congratulations! You won your wager of ",wages(i,1)
print*,"You now have",money(i)+wages(i,1)
money(i)=money(i)+wages(i,1)
else
do j=3,99
if(roll(1,j)+roll(2,j)==roll(1,2)+roll(2,2))then
print*,"Sorry you lost. You now have,",money(j)
endif
if(roll(1,j)+roll(2,j)==7)then
print*,"You won your bet of",wages(i,1),", which means you doubled your money in the wager"
print*,"You now have",money(i)+wages(i,1)*2
money(i)=money(i)+wages(i,1)*2
endif
if(roll(1,j)+roll(2,j)==roll(1,2)+roll(2,2))exit
if(roll(1,j)+roll(2,j)==7)exit
enddo
endif
endif
endif!dontcome
if(bet(i)=="2")then
if(roll(1,1)+roll(2,1)==2)then
print*,"Congrats! You win!"
print*,"You brought your money from",money(i),"to ",money(i)+wages(i,1)+wages(i,1)*30
money(i)=money(i)+wages(i,1)+wages(i,1)*30
else
print*,"Sorry, You lost your wager of",wages(i,1)
endif
endif !2
if(bet(i)=="12")then
if(roll(1,1)+roll(2,1)==12)then
print*,"Congrats! You win!"
print*,"You brought your money from",money(i),"to ",money(i)+wages(i,1)*31
money(i)=money(i)+wages(i,1)+wages(i,1)*30
else
print*,"Sorry, You lost your wager of",wages(i,1)
endif
endif !12
if(bet(i)=="3")then
if(roll(1,1)+roll(2,1)==3)then
print*,"Congrats! You win!"
print*,"You brought your money from",money(i),"to ",money(i)+wages(i,1)+wages(i,1)*15
money(i)=money(i)+wages(i,1)+wages(i,1)*15
else
print*,"Sorry, You lost your wager of",wages(i,1)
endif
endif !3
if(bet(i)=="11")then
if(roll(1,1)+roll(2,1)==11)then
print*,"Congrats! You win!"
print*,"You brought your money from",money(i),"to ",money(i)+wages(i,1)+wages(i,1)*15
money(i)=money(i)+wages(i,1)+wages(i,1)*15
else
print*,"Sorry, You lost your wager of",wages(i,1)
endif
endif !11
if(bet(i)=="7")then
if(roll(1,1)+roll(2,1)==7)then
print*,"Congrats! You win!"
print*,"You brought your money from",money(i),"to ",money(i)+wages(i,1)+wages(i,1)*4
money(i)=money(i)+wages(i,1)+wages(i,1)*4
else
print*,"Sorry, You lost your wager of",wages(i,1)
endif
endif !7
if(bet(i)=="easyway")then
do k=1,99
if(roll(1,k)+roll(2,k)==4)exit
if(roll(1,k)+roll(2,k)==6)exit
if(roll(1,k)+roll(2,k)==8)exit
if(roll(1,k)+roll(2,k)==10)exit
if(roll(1,k)+roll(2,k)==7)exit
enddo
if(roll(1,k)/=roll(2,k))then
print*,"Congrats! You win!"
if(roll(1,k)+roll(2,k)==4.or.roll(1,k)+roll(2,k)==10)then
print*,"You brought your money from",money(i),"to ",money(i)+wages(i,1)+wages(i,1)*7
money(i)=money(i)+wages(i,1)+wages(i,1)*7
else
if(roll(1,k)+roll(2,k)==4.or.roll(1,k)+roll(2,k)==10)then
print*,"You brought your money from",money(i),"to ",money(i)+wages(i,1)+wages(i,1)*9
money(i)=money(i)+wages(i,1)+wages(i,1)*9
else
print*,"Sorry, You lost your wager of",wages(i,1)
endif
endif
endif
endif !hard
if(bet(i)=="hardway")then
do k=1,99
if(roll(1,k)+roll(2,k)==4)exit
if(roll(1,k)+roll(2,k)==6)exit
if(roll(1,k)+roll(2,k)==8)exit
if(roll(1,k)+roll(2,k)==10)exit
if(roll(1,k)+roll(2,k)==7)exit
enddo
if(roll(1,k)==roll(2,k))then
print*,"Congrats! You win!"
if(roll(1,k)+roll(2,k)==4.or.roll(1,k)+roll(2,k)==10)then
print*,"You brought your money from",money(i),"to ",money(i)+wages(i,1)+wages(i,1)*7
money(i)=money(i)+wages(i,1)+wages(i,1)*7
else
if(roll(1,k)+roll(2,k)==4.or.roll(1,k)+roll(2,k)==10)then
print*,"You brought your money from",money(i),"to ",money(i)+wages(i,1)+wages(i,1)*9
money(i)=money(i)+wages(i,1)+wages(i,1)*9
else
print*,"Sorry, You lost your wager of",wages(i,1)
endif
endif
endif
endif !hard
if(bet(i)=="big6")then
do k=1,99
if(roll(1,k)+roll(2,k)==6)exit
if(roll(1,k)+roll(2,k)==7)exit
enddo
if(roll(1,k)+roll(2,k)==6)then
print*,"You win!"
print*,"You brought your money from",money(i),"to ",money(i)+wages(i,1)*2
money(i)=money(i)+wages(i,1)*2
else
print*,"Sorry, You lost your wager of",wages(i,1)
endif
endif !big6
if(bet(i)=="big8")then
do k=1,99
if(roll(1,k)+roll(2,k)==8)exit
if(roll(1,k)+roll(2,k)==7)exit
enddo
if(roll(1,k)+roll(2,k)==8)then
print*,"You win!"
print*,"You brought your money from",money(i),"to ",money(i)+wages(i,1)*2
money(i)=money(i)+wages(i,1)*2
else
print*,"Sorry, You lost your wager of",wages(i,1)
endif
endif !big8
if(bet(i)=="hilo")then
if(roll(1,1)+roll(2,1)==2.or.roll(1,1)+roll(2,1)==12)then
print*,"Congrats! You win!"
print*,"You brought your money from",money(i),"to ",money(i)+wages(i,1)+wages(i,1)*15
money(i)=money(i)+wages(i,1)+wages(i,1)*15
else
print*,"Sorry, You lost your wager of",wages(i,1)
endif
endif !hilo
if(bet(i)=="anycraps")then
if(roll(1,1)+roll(2,1)==2.or.roll(1,1)+roll(2,1)==12.or.roll(1,1)+roll(2,1)==3)then
print*,"Congrats! You win!"
print*,"You brought your money from",money(i),"to ",money(i)+wages(i,1)+wages(i,1)*7
money(i)=money(i)+wages(i,1)+wages(i,1)*7
else
print*,"Sorry, You lost your wager of",wages(i,1)
endif
endif !any
if(bet(i)=="field")then
if(roll(1,1)+roll(2,1)==3.or.roll(1,1)+roll(2,1)==4.or.roll(1,1)+roll(2,1)==9.or.roll(1,1)+roll(2,1)==10)then
print*,"Congrats! You win!"
print*,"You brought your money from",money(i),"to ",money(i)+wages(i,1)*2
money(i)=money(i)+wages(i,1)*2
else
if(roll(1,1)+roll(2,1)==2.or.roll(1,1)+roll(2,1)==12)then
print*,"Congrats! You win!"
print*,"You brought your money from",money(i),"to ",money(i)+wages(i,1)*3
money(i)=money(i)+wages(i,1)*3
else
if(roll(1,1)+roll(2,1)==11)then
print*,"Congrats! You win!"
print*,"You brought your money from",money(i),"to ",money(i)+wages(i,1)*2
money(i)=money(i)+wages(i,1)*2
else
print*,"Sorry, You lost your wager of",wages(i,1)
endif
endif
endif
endif !field
if(bet(i)=="c&e")then
if(roll(1,1)+roll(2,1)==2.or.roll(1,1)+roll(2,1)==12.or.roll(1,1)+roll(2,1)==3)then
print*,"Congrats! Your craps bet won!"
print*,"You brought your money from",money(i),"to ",money(i)+wages(i,1)+wages(i,1)*3
money(i)=money(i)+wages(i,1)+wages(i,1)*3
else
if(roll(1,1)+roll(2,1)==11)then
print*,"Congrats! Your elevens bet won!"
print*,"You brought your money from",money(i),"to ",money(i)+wages(i,1)+wages(i,1)*7
money(i)=money(i)+wages(i,1)+wages(i,1)*7
else
print*,"Sorry, You lost your wager of",wages(i,1)+wages(i,2)+wages(i,3)+wages(i,4)
endif
endif
endif !any
if(bet(i)=="thehorn")then
if(roll(1,1)+roll(2,1)==2)then
print*,"Congrats! Your 2 bet won!"
print*,"You brought your money from",money(i),"to ",money(i)+wages(i,1)+wages(i,1)*6.75
money(i)=money(i)+wages(i,1)+wages(i,1)*6.75
else
if(roll(1,1)+roll(2,1)==12)then
print*,"Congrats! Your 12's bet won!"
print*,"You brought your money from",money(i),"to ",money(i)+wages(i,1)+wages(i,1)*6.75
money(i)=money(i)+wages(i,1)+wages(i,1)*6.75
else
if(roll(1,1)+roll(2,1)==3)then
print*,"Congrats! Your 3's bet won!"
print*,"You brought your money from",money(i),"to ",money(i)+wages(i,1)+wages(i,1)*3
money(i)=money(i)+wages(i,1)+wages(i,1)*3
else
if(roll(1,1)+roll(2,1)==11)then
print*,"Congrats! Your 11's bet won!"
print*,"You brought your money from",money(i),"to ",money(i)+wages(i,1)+wages(i,1)*3
money(i)=money(i)+wages(i,1)+wages(i,1)*3
else
print*,"Sorry, You lost your wager of",wages(i,1)
endif
endif
endif
endif
endif !horn
i=i+1
enddo
endif !dontpassline
name(amt+1)=name(1)
money(amt+1)=money(1)
do i=1,amt-1
name(i)=name(i+1)
money(i)=money(i+1)
enddo
name(amt)=name(amt+1)
money=money(amt+1)
endif
print*,"Is everyone done? if the answer is yes, then everyone will be done."
read*,yorn
enddo
do i=1,20
if(name(i)=="")then
n=i-1
endif
enddo
do pass=1,n-1
do i=1,n-pass
if(money(i)>money(i+1))then
tempmoney=money(i)
money(i)=money(i+1)
money(i+1)=tempmoney
tempname=name(i)
name(i)=name(i+1)
name(i+1)=tempname
endif
enddo
enddo
print*,"*****Leaderboards*****"
print*,"Place Name Money"
do i=1,amt
write(*,819)" ",i," ",name(i)," ",money(i)
enddo
819 format(a,i2,a,a,a,f7.2)
110 format(a,a,a)
100 format(a,a)
endprogram
subroutine init_random_seed()
integer::i,n,clock
integer,dimension(:),allocatable::seed
call random_seed(size=n)
allocate(seed(n))
call system_clock(count=clock)
seed=clock+37*(/(i-1,i=1,n)/)
call random_seed(put=seed)
deallocate(seed)
end subroutine
Here is the error:
f95 craps.f95
In file craps.f95:823
enddo
1
Error: Expecting END IF statement at (1)
In file craps.f95:850
endprogram
1
Error: Expecting END IF statement at (1)
In file craps.f95:853
subroutine init_random_seed()
1
Error: Unclassifiable statement at (1)
In file craps.f95:855
integer::i,n,clock
1
Error: Symbol 'i' at (1) already has basic type of INTEGER
In file craps.f95:856
integer,dimension(,allocatable::seed
1
Error: Unexpected data declaration statement at (1)
In file craps.f95:858
allocate(seed(n))
1
Error: Syntax error in ALLOCATE statement at (1)
In file craps.f95:865
end subroutine
1
Error: Expecting END IF statement at (1)
Error: Unexpected end of file in 'craps.f95'
You are viewing our Forum Archives. To view or take place in current topics click here.