Skip to content
28 changes: 21 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,25 @@ We are glad to partner with IIT Kharagpur as a part of the Kharagpur Winter of C
* [Translations of Hamlet](https://github.com/prateekiiest/Code-Sleep-Python#translations-of-hamlet)
* [Classification](https://github.com/prateekiiest/Code-Sleep-Python#classification)
* [Whisky Classification](https://github.com/prateekiiest/Code-Sleep-Python#whisky-classification)
* [Bird Migration](https://github.com/prateekiiest/Code-Sleep-Python#Bird_mirgation)
* [Social Network Analysis](https://github.com/prateekiiest/Code-Sleep-Python#social_network)
* [Prime](https://github.com/prateekiiest/Code-Sleep-Python#prime-number-finder)
* [Website status check](https://github.com/prateekiiest/Code-Sleep-Python#website_status_check)
* [Encryption-Techniques](https://github.com/prateekiiest/Code-Sleep-Python#Encryption-Techniques)
* [Inception Tic-Tac-Toe](https://github.com/prateekiiest/Code-Sleep-Python#inception_tic-tac-toe)

* [Bird Migration](https://github.com/prateekiiest/Code-Sleep-Python#bird-migration)
* [Social Network Analysis](https://github.com/prateekiiest/Code-Sleep-Python#social-network-analysis)
* [Prime](https://github.com/prateekiiest/Code-Sleep-Python#Prime)
* [Website status check](https://github.com/prateekiiest/Code-Sleep-Python#website-status-check)
* [Encryption-Techniques](#encryption-techniques)
* [Inception Tic-Tac-Toe](https://github.com/prateekiiest/Code-Sleep-Python#inception-tic-tac-toe)
* [Sprint](https://github.com/prateekiiest/Code-Sleep-Python#sprint)
* [Floating Text](#floating-text)

----------------------------------

### Tic-Tac-Toe

Tic-Tac-Toe (or noughts and crosses) is a simple strategy game in which two players take turns placing a mark on a 3x3 board, attempting to make a row, column, or diagonal of three with their mark. In this homework, we will use the tools we've covered in the past two weeks to create a Tic-Tac-Toe simulator and evaluate basic winning strategies.

![](https://upload.wikimedia.org/wikipedia/commons/8/8e/TicTacToe-6549127nnXOp.gif) Players soon discover that best play from both parties leads to a draw. Because of the simplicity of Tic-Tac-Toe, it is often used as a pedagogical tool for teaching the concepts of good sportsmanship and the branch of artificial intelligence that deals with the searching of game trees. It is straightforward to write a computer program to play Tic-Tac-Toe perfectly, to enumerate the 765 essentially different positions (the state space complexity), or the 26.830 possible games up to rotations and reflections (the game tree complexity) on this space.
![](https://upload.wikimedia.org/wikipedia/commons/8/8e/TicTacToe-6549127nnXOp.gif)

Players soon discover that best play from both parties leads to a draw. Because of the simplicity of Tic-Tac-Toe, it is often used as a pedagogical tool for teaching the concepts of good sportsmanship and the branch of artificial intelligence that deals with the searching of game trees. It is straightforward to write a computer program to play Tic-Tac-Toe perfectly, to enumerate the 765 essentially different positions (the state space complexity), or the 26.830 possible games up to rotations and reflections (the game tree complexity) on this space.

**[CODE](https://github.com/prateekiiest/Code-Sleep-Python/blob/master/tic-tac-toe/code.py)**

Expand All @@ -63,6 +67,7 @@ Tic-Tac-Toe (or noughts and crosses) is a simple strategy game in which two play
### Hangman

Hangman is a simple game where a player will guess a word letter by letter.

![](http://daramcq.github.io/img/hangman-game-5.png)

In this project, you will create a program that generates a random word that you must guess.
Expand Down Expand Up @@ -178,6 +183,15 @@ Encryption is an interesting piece of technology that works by scrambling data s

----------------------------------------------------

### Floating Text

Floating Text is a simple program which displays a given String as a floating string on the terminal.

![demo](/floating_text/floating_text.gif)

**[CODE](/floating_text/floating_text.py)**

----------------------------------------------------

## Getting started with Python

Expand Down
Binary file added floating_text/floating_text.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
248 changes: 248 additions & 0 deletions floating_text/floating_text.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,248 @@
#import os
import time

width =79

text = raw_input("Enter the text: ").upper()

printedtext = [ "","","","","" ]

characters = { " " : [ " ",
" ",
" ",
" ",
" " ],

"A" : [ " * ",
" * * ",
"* *",
"*****",
"* *" ],

"B" : [ "**** ",
"* *",
"**** ",
"* *",
"**** " ],

"C" : [ " ****",
"* ",
"* ",
"* ",
" ****" ],

"D" : [ "**** ",
"* *",
"* *",
"* *",
"**** " ],

"E" : [ "*****",
"* ",
"*****",
"* ",
"*****" ],

"F" : [ "*****",
"* ",
"*****",
"* ",
"* " ],

"G" : [ " ****",
"* ",
"* ***",
"* *",
" ****" ],

"H" : [ "* *",
"* *",
"*****",
"* *",
"* *" ],

"I" : [ "*****",
" * ",
" * ",
" * ",
"*****" ],

"J" : [ "*****",
" * ",
" * ",
"* * ",
"**** " ],

"K" : [ "* *",
"* * ",
"*** ",
"* * ",
"* *" ],

"L" : [ "* ",
"* ",
"* ",
"* ",
"*****" ],

"M" : [ "* *",
"** **",
"* * *",
"* *",
"* *" ],

"N" : [ "* *",
"** *",
"* * *",
"* **",
"* *" ],

"O" : [ " *** ",
"* *",
"* *",
"* *",
" *** " ],

"P" : [ "**** ",
"* *",
"**** ",
"* ",
"* " ],

"Q" : [ " *** ",
"** *",
"* * *",
" *** ",
" * " ],

"R" : [ "**** ",
"* *",
"**** ",
"* * ",
"* *" ],

"S" : [ " ****",
"* ",
" *** ",
" *",
"**** " ],
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about numbers ?

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And remove the cls not found command.

Its obstructing the view

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The program is just for English alphabets.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I will fix that.


"T" : [ "*****",
" * ",
" * ",
" * ",
" * " ],

"U" : [ "* *",
"* *",
"* *",
"* *",
" *** " ],

"V" : [ "* *",
"* *",
"* *",
" * * ",
" * " ],

"W" : [ "* *",
"* *",
"* * *",
"** **",
"* *" ],

"X" : [ "* *",
" * * ",
" * ",
" * * ",
"* *" ],

"Y" : [ "* *",
"* *",
" * * ",
" * ",
" * " ],

"Z" : [ "*****",
" * ",
" * ",
" * ",
"*****" ],

"1" : [ " ** ",
"* * ",
" * ",
" * ",
"*****" ],

"2" : [ "*****",
" *",
"*****",
"* ",
"*****" ],

"3" : [ "*****",
" *",
" ****",
" *",
"*****" ],

"4" : [ "* *",
"* *",
"*****",
" *",
" *" ],

"5" : [ "*****",
"* ",
"*****",
" *",
"*****" ],

"6" : [ "*****",
"* ",
"*****",
"* *",
"*****" ],

"7" : [ "*****",
" * ",
" * ",
" * ",
"* " ],

"8" : [ "*****",
"* *",
"*****",
"* *",
"*****" ],

"9" : [ "*****",
"* *",
"*****",
" *",
"*****" ],

"0" : [ "*****",
"* *",
"* *",
"* *",
"*****" ]

}


for row in range(5):
for char in text:
printedtext[row] += (str(characters[char][row]) + " ")

offset = width
while True:
#os.system("cls") #clears the terminal to show the output.
for row in range(5):
print(" " * offset + printedtext[row][max(0,offset*-1):width - offset])
offset -=1

if offset <= ((len(text)+2)*6) * -1:
offset = width
time.sleep(0.1)