This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"color_scheme": "Packages/Color Scheme - Default/Monokai Bright.tmTheme", | |
"ignored_packages": | |
[ | |
"Vintage" | |
], | |
"trim_trailing_white_space_on_save": true | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Algorithm for snakes and Ladders game in python | |
1)There are two players and they are given a dice | |
2)Typically the game board has 100 cells starting from 1 to 100 | |
3)There are snakes and ladders in different cells. And each has either a ladder or a snake or nothing but not both snake and ladder in the same cell. | |
4)I use two python dictionaries namely 'snakes' and 'ladders' to declare the positions of snakes and ladders. | |
5)I make starting cell number of snake or ladder as 'key' and ending cell number as 'value' of the dictionary. | |
6)Define a function to roll the dice i.e., accepting the input from Player1 and Player2 with a checking condition of dice number to be between 1 & 6. | |
7)Define a function to check if Player1 or Player2 found ladder or a snake mouth. | |
8)Check for the 'key's in both dictionaries & proceed accordingly. | |
9)The rolling of dice continues until any of the player reaches above 99, if any of the players reach 100 they will be declared as winner of the game. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""".....code for the bus tracking system by the help of pyramid frame work.....""" | |
from wsgiref.simple_server import make_server | |
from pyramid.config import Configurator | |
from pyramid.response import Response | |
from sqlalchemy import create_engine | |
from busroutes import BusRoute | |
from busroutes import Base | |
from sqlalchemy.orm import sessionmaker | |
from sqlalchemy.ext.declarative import declarative_base |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""".....code for the bus tracking system by the help of pyramid frame work.....""" | |
from wsgiref.simple_server import make_server | |
from pyramid.config import Configurator | |
from pyramid.response import Response | |
from sqlalchemy import create_engine | |
from busroutes import BusRoute | |
from busroutes import Base | |
from sqlalchemy.orm import sessionmaker | |
from sqlalchemy.ext.declarative import declarative_base |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sqlalchemy.ext.declarative import declarative_base | |
from sqlalchemy import Column, Integer, String | |
Base = declarative_base() | |
class BusRoute(Base): | |
__tablename__ = 'busroutes' | |
bus_no = Column(Integer, primary_key=True) | |
start_point = Column(String(100)) | |
end_point = Column(String(100)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bin | |
include | |
lib |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def fib(): | |
a,b,c,l,n=-1,1,0,[],int(raw_input("enter the end of series:")) | |
for i in range(n+1): | |
c=a+b | |
b,a=c,b | |
l.append(c) | |
n1=int(raw_input("enter the position:")) | |
print l[n1-1] | |
if __name__=='__main__': |