Showing posts with label Python. Show all posts
Showing posts with label Python. Show all posts

Tuesday, 22 September 2015

PyCLOCK - A simple analog clock with python and pygame

Hi all. How it's going?

I'm back and this time pygame is ruling my mind.
I combined the Parametric form of equation of a cirle with pygame and got this neat analog clock as the reuslt.

See the screen shot below.

HAVE AN IDEA? WOULD U LIKE ME TO PROGRAM IT?  Share it with me via e-mail here. I'll be kind enough to mention your name and will surely implement your idea if I am capable of doing so.  ;)

Give it a go here:   Datafilehost

Saturday, 4 April 2015

Task 1,2 & 3

As the name of this post says, here are all the three tasks solved.

The tasks 1 and 2 are in a single python script which accepts all the input data and then writes the output data to a file. The second script implements the task 3. It accesses the data stored by task 2 and displays it.

Download Task 1 and 2 here
and Task 3 here. (Link down. will be up soon)

HIT THE +1 Button if you want to thank for this.

Saturday, 28 March 2015

Dots and Boxes game with python and pygame!

Yes! it is Dots and Boxes this time and its really working and that too without those complex algorithms that you get to see when you search the web.

My Algorithm:

1. Let the user play first.
2. When the computer gets its turn, it first searches for boxes that can be completed in one move.
3. It completes one of such boxes if found else it finds out the 'two-sided' boxes (those which have two sides marked) and stores in a list.
4. Now the list stores the boxes which will lead the computer to lose one precious point to the user.
5. The computer dares not even to touch the boxes and finds the lines which are safe to mark.
6. If the computer finds no safe lines then it finds out the chains of boxes which the user can form if the computer takes its turn.
7. Then it finds out the smallest chain and marks one line in it to minimise the loss.
8. This way, the computer has a good chance of winning and this is an enjoyable game.

HIT +1 IF YOU LIKE THE IDEA

Give it a try: Download




Tuesday, 10 March 2015

HTML PageMaker GUI v1.1

Hello Python Lovers.
Today After quite some-time I am back with a new Tkinter GUI python script.

This program provides an easy to use GUI for my older page maker.

So Download it here and give it a try.

Happy HTML Pagemaking...

And...
Don't Forget to hit +1





Next Expected Post: Solution to Task 3. See details here.

Tuesday, 30 December 2014

War Of The Numbers - New version! (Update)

This program here is an update to the older war of the numbers.
It contains many changes:

Power-ups : The Golden Shot, The Shield, Freeze , Reverse

Code  Optimization : Performance is now better due to code optimization which now doesn't wastes any processing cycles.

Menu : A Menu created.

Improvements coming in the near future:
Full-screen, Better sound, Objectives and achievements, High Scores, etc.

Download here: http://goo.gl/JHwRmS

The game is action:





Thursday, 25 December 2014

Square Root of a number with Python. - NO IN-BUILT FUNCTION USED!

Yes! I made the program after typing some tricky code-lines.
This program really does the task without using in-built functions.

Instead, It uses the Long-Division method taught at school.
But it is not as accurate as the in-built functions. But it is not as much different. The Function I designed first converts the number into 2-digit numbers and then operates using the long-division algorithm.

Please like Us on Facebook here if you want to support Python Palace.

To show the accuracy of the calculations, I have also given the results produced by the In-Built Function (pow) along with my Function's output.

Credits to +NavdeepSinghQUADD for the idea of this program.

Download here: http://goo.gl/rxLa4V   (UppIT.com)

Thx for visiting. Keep coming...



Tuesday, 2 December 2014

Equation of an Ellipse with python

Welcome readers,

I have another program to share.
This program will find the equation of an ellipse for you.
Just provide the values you have.

This program supports 8 combinations of values and can find the equation of ellipse if it is given sufficient values required.

Requires values:

Vertices and Foci

or

Equation of major axis and a and b

or

Length of major axis and Foci

or

Length of minor axis and Foci

or

a and Foci

or

Equation of major axis and 2 points through which the ellipse passes

or

Eccentricity and  Equation of major axis and a point lying on ellipse

or

Foci and Eccentricity



** This program can find the equations which have 1/something as the coefficients of the variables and is not reliable for coefficients like something(1)/something(2) as it converts such coefficients to 1/(something(1)/something(2)) and the value returned is approximate and not exact.






 Download Program: Datafilehost


Like Python Palace on Facebook

And

don't forget to join this site.

Gurpreet Singh




Sunday, 30 November 2014

See the new game I'm working on! - Fruits everywhere with pygame...

This is another game which is purely made with python and pygame.

This is a fruit collection game that would help you kill time and also learn some programming tactics if you see the source code carefully.

The code is self explanatory so i didn't comment.
I will if someone wants me to do so.

The game consists of an empty fruit basket which you need to fill up by collecting the free falling fruits. Beware of the bombs which take away 10 Scores and the cool bombs which rip you of one live. Lives are precious and you get three.
Lost a life? You have a chance to get one falling along those fruits but it takes a long time to appear.

Your high scores are stored and don't get cleared when you close the game.

This version currently works only with linux (posix). Sorry for windows users.
E-mail me here and I will post a version for windows too! if you find the game worth doing so.

The game ain't tough. It's fun. Enjoy...
Download : datafilehost




Thursday, 2 October 2014

GCalc 2

Hi Friends.
I had previously posted a calculator which was a simple and minimalistic calculator.
It had many errors like two symbols occurring together would raise an error.
This program has absolutely no error. And it supports solving a whole expression in one step!

It has improved functionality. Why don't you download it yourself?

Download - Datafilehost





Friday, 12 September 2014

SUDOKU2.0 - Game with python (GUI)

Hi Guys
Today I have another enjoyable program to share. You may remember the terminal Sudoku puzzle game that I posted a couple of weeks ago (see here). That program is difficult to use and it makes the already difficult game even more difficult.

This program makes it very easy to play the game as you do not need to use the keyboard and everything can be done with the use of the mouse only.

Much more to tell about the program....
...Why don't you use it yourself?

Download the program: Datafilehost

Have an Idea? Share with me here. I will program it!







******************* UPDATE ***********************

Well, I have some modifications in this new program.

1. Removed the 'OK' button.
     Earlier, I had to use it to change the color of the button after the check button was used but now, It is done automatically.
2. Added a timer.

Download: Datafilehost


Monday, 1 September 2014

Spelling Corrector with Python -

While coming across a post by Peter Norvig (see the post) about "How to write a Spelling Corrector" , I got an Idea of making one myself. In the above post, Peter Norvig had mentioned the theory behind the working of a spelling corrector.
He had made a program which was of only 24 lines and achieved 80%-85% accuracy. After reading the theory (most of which went off my head), I decided to make another program for the same task which is very simple to understand. Peter Norwig's program is very good but not beginner friendly and those (like me) who do not know about sets, collections, re module can not understand what the program does. I used the same theory( as much as I understood ) but in a separate way. I got from the post that the main idea was to modify the word in every possible way and then check each word for being an English word. The probability of possible words does the task then. The most probable word has to be chosen.
For finding the most probable word, Peter Norwig made a file named big.txt which is a concatenation of many Sherlock Holmes stories and other books and novels which contains a couple of million words. The file hence, contains the most used English words.
The file was used to make a dictionary which stored the no. of occurences of each of the words.
The file weighed 6.xx MB and to make the size small, I made a file in which I stored only the dictionary and the file is about 453.1 KB in size.
Then the most occurring word is chosen from the dictionary and returned.

That's it but that's not too easy, despite 61 lines of code, My program achieves only about 80% accuracy which is enough for toying but not that good.
The program can correct 345,230 words!

Download the program and text file here: Datafilehost

Note: Keep both the files in the above archive in the same folder for the program to work.


See the program in action:


Saturday, 16 August 2014

The Number Magnifier

This is a simple 23 lines program which just converts your numbers into strings of numbers which are magnified. You may haven't understood me. This program does this:

                              ___
                             |
  5    becomes       |___
                                   |
                              ___|

It can convert all the ten digits and can display all number combinations from 0 to 9,999,999,999 !


You can even install it as a module.

install pip using sudo apt-get install python-pip
and then run this command in the terminal : pip install numtod

Usage for the module
Use:  from convert import numbers
       numbers(number)

Download it here: Datafilehost


Thursday, 14 August 2014

Tic-Tac-Toe (GUI) game with python

Hello everyone.
I am here to share another program with you. It is - PyTic-Tac-Toe (as I call it).
This is a simple yet enjoyable Tic-Tac-Toe (Noughts and Crosses) game based on an older(not much) tic-tac-toe game program.

This version has some bugfixes in the A.I. that confronts the user.

Improved A.I. (Impossible to defeat for at least me)
GUI version. (No need to input numbers!)

Download it here: Datafilehost

Enjoy!

Screens:









Monday, 4 August 2014

Converting Numbers to Words using Python

Converting numbers to words is not something so very needed in daily life but it is fun and maybe useful too.
This program is designed for this very task.
It can convert numbers with up to 24 figures i.e 0 to 999999999999999999999999 !

I do not think it would be easy to convert even a 14 figure number into words and this program does that up to 24.(Yeah, It is ought to do so as it took almost 90 lines of code and  about one hour of mine)

So, Hang on for more such stuff if you like python and python palace.

Download program: Datafilehost

This program was deleted by the file host due to inactivity. I have 'rebuilt' it. 
Check out the new post for this program here. 

Screen-shots:

Code:


 
 OutPut:


Sunday, 27 July 2014

Tic Tac Toe - Game Program with Python

Hello Friends.
Today I have another program to share.

This is a game - Tic Tac Toe

You are going to love it if you have memories of playing it on paper with your friends. Here, in this program, you cannot play it with your friends. Instead, You play with the computer itself!

I've created a function in the program which uses mere selections to block the user if he/she is going to win. The computer is not very easy to defeat and at the same time it is not impossible to defeat.

While starting, the program asks the user for choosing a symbol, decides who goes first - the user or the computer through a simple toss and then prints the pattern of the board for the user to make it easy for him to play. The pattern is like this:

 0  | 1  | 2
___|___|___
 3  | 4  | 5
___|___|___
 6  | 7  | 8
     |     |

The user has to enter the number of the cell where he wants to put his symbol.
For instance if the user has chosen the symbol "O" and wants his symbol to be placed in the middle(4th) cell then he must give 4 as the input when asked for his choice and the board will then look like this:

     |     | 
___|___|___
     | O | 
___|___|___
     |     | 
     |     |

Then the computer will tackle the user.

Enjoy.

The source code (the program) can be downloaded here: Datafilehost

Thanks for visiting. Keep Coming... and don't forget to join this site and explore more.

--------------------------------------- * UPDATE * ---------------------------------------
Fixed a bug - The program was raising error when the user entered wrong number(>8 or <0) or an alphabet. It gave an error and then closed itself. Now, It checks for valid input and functions only if the input is valid and asks for input again otherwise.

I also improved the A.I. which was earlier only preventing the user from winning. Now, It tries to win itself too.

Download update: Datafilehost


See the code:








The Game in action:




I have commented the program line by line and it is easy to understand for everyone. But if you have any problem, Comment or E-Mail me here.

And, don't forget to join this site.

By Gurpreet Singh