Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[pull] master from avinashkranjan:master #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
pull merged 8 commits into Uncodedtech:master from avinashkranjan:master
May 11, 2021
Merged
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
4 changes: 2 additions & 2 deletions .github/pull_request_template.md
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ Title: \<write script title here\>

Folder: \<type the folder name that contains your script\>

Requirments: \<type the name of text file containing the required to install python packages, type None if no file required\>
Requirements: \<type the name of text file containing the required to install python packages, type None if no file required\>

Script: \<Enter the name of the ``.py`` file (The main entry point of the program)\>

Arguments: \<enter any arguments that the script needs but `-` separeted like: h-c-m\>

Contributor: \<Enter your Github handle/username without url\>

Description: \<Enter a one line description that describes your script. Also, explain the arguments usage here\>
Description: \<Enter a one line description that describes your script. Also, explain the arguments usage here\>
4 changes: 2 additions & 2 deletions .github/scripts/Update_Database.py
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
category = r"- \[x\] (.+)"
name = r"Title: (.+)"
path = r"Folder: (.+)"
requirments_path = r"Requirments: (.+)"
requirments_path = r"Requirements: (.+)"
entry = r"Script: (.+)"
arguments = r"Arguments: (.+)"
contributor = r"Contributor: (.+)"
Expand Down Expand Up @@ -116,4 +116,4 @@ def extract_from_pr_body(pr_body, pa_token):
if __name__ == "__main__":
# Get PR body and pass pa_token
data = sys.argv[1]
extract_from_pr_body(data, sys.argv[2])
extract_from_pr_body(data, sys.argv[2])
25 changes: 25 additions & 0 deletions Base-N_Calc/Readme.md
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Base-N Calculator

It is a GUI based script that allows user to enter a number of any base and convert it to another. However, there is a small limitation for the conversion.

* The base should not be smaller than 2.
* Alphabetic symbols are not used in conversions, you'll have to convert this part by yourself. To know why check this [link](https://www.mathsisfun.com/numbers/bases.html)

# Installation

Nothing to be installed, just run the script directly.

# Usage

1) Fill the required fields.
2) the conversion result will be displayed in the Result Entry.

# Output

Converted number to base Y.

# Authors

Written by [XZANATOL](https://www.github.com/XZANATOL).

The project was built as a contribution during [GSSOC'21](https://gssoc.girlscript.tech/).
Binary file added Base-N_Calc/data/GSSOC.png
View file Open in desktop
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
[フレーム]
159 changes: 159 additions & 0 deletions Base-N_Calc/script.py
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
from tkinter import *

def SetStatusError():
""" Sets Status bar label to error message """
Status["text"] = "Wronge Input(s)... :\ "
Status["fg"] = "red"


def Con_Base_X_to_Dec(num, base_x):
# Converting the integeral part
integeral_part = str(int(num))[::-1] # Extract integerals in reverse order
i=0
res = 0
for number in integeral_part:
element = int(number) * (base_x**i) # Convert each number to decimal
res += element # Add element to result
i+=1

# Converting the decimal part
decimal_part = str(num)
decimal_part = decimal_part[decimal_part.index(".")+1:] # Extract decimal part using string manipulation
i = -1
for decimal in decimal_part:
element = int(decimal) * (base_x**i) # Convert each number to decimal
res += element # Add element to result
i += -1

# Return total result
return res


def Con_Dec_to_Base_Y(num, base_y):
# Converting the integeral part
integeral_part = int(num)
res_int = []
while int(integeral_part) != 0:
integeral_part = integeral_part / base_y # Divide number by base
element = (integeral_part - int(integeral_part)) * base_y # Get the remainder
res_int.append(str(int(element))) # Append element
res_int = res_int[::-1] # Numbers are organised from LCM to HCM

# Converting the decimal part
decimal_part = num - int(num)
res_dec = []
while (decimal_part != 0):
decimal_part = (decimal_part - int(decimal_part)) * base_y # Multiply decimal part by base
if str(int(decimal_part)) in res_dec: # Check if not duplicated, for no infinite loops
break
res_dec.append(str(int(decimal_part))) # Append element

# Organize result
if len(res_dec) == 0:
res = res_int # If result has decimal numbers
else:
res = res_int + ["."] + res_dec # If not

# Return grouped result
return " ".join(res)


def Main():
""" Function to validate entry fields """
# <----- Validation ----->
# Validate Number
num = Num_Val.get()
try:
num = float(num)
except:
Num.focus()
SetStatusError()
return
# Validate Base X
base_x = Base_X_Val.get()
try:
base_x = int(base_x)
except:
Base_X.focus()
SetStatusError()
return
# Validate Base X
base_y = Base_Y_Val.get()
try:
base_y = int(base_y)
except:
Base_Y.focus()
SetStatusError()
return
# If same bases are entered
if base_x == base_y or base_x<2 or base_y<2:
Status["text"] = "Huh?! -_- "
Status["fg"] = "orange"
return
# <----- check base x value ----->
if base_x == 10:
Result = Con_Dec_to_Base_Y(num, base_y)
if base_y == 10:
Result = Con_Base_X_to_Dec(num, base_x)
else:
Result = Con_Base_X_to_Dec(num, base_x)
Result = Con_Dec_to_Base_Y(Result, base_y)

Status["text"] = "Successfull Conversion! :0 "
Status["fg"] = "green"
Result_Entry_Val.set(Result)


# <----- GUI Code Beginning ----->
main_window = Tk()
main_window.title("Base-N Calculator")
Icon = PhotoImage(file="./Base-N_Calc/data/GSSOC.png")
main_window.iconphoto(False, Icon)
main_window.geometry("420x250")


# <----- Elements for number that is going to be converted ----->
Num_Label = Label(main_window, text="Enter Number :", anchor=E, font=("Calibri", 9))
Num_Label.place(x=30,y=30)
Num_Val = StringVar()
Num = Entry(main_window, textvariable=Num_Val, font=("Calibri", 9))
Num.place(x=120,y=32)


# <----- Elements for Base-X ----->
Base_X_Label = Label(main_window, text="Base-X :", anchor=E, font=("Calibri", 9))
Base_X_Label.place(x=250,y=30)
Base_X_Val = StringVar()
Base_X = Entry(main_window, textvariable=Base_X_Val, font=("Calibri", 9))
Base_X.place(x=305,y=32,width=30)


# <----- Elements for Base-Y ----->
Base_Y_Label = Label(main_window, text="Base-Y :", anchor=E, font=("Calibri", 9))
Base_Y_Label.place(x=250,y=50)
Base_Y_Val = StringVar()
Base_Y = Entry(main_window, textvariable=Base_Y_Val, font=("Calibri", 9))
Base_Y.place(x=305,y=52,width=30)


# <----- Elements for calculate button ----->
Calculate_Button = Button(main_window, text="Convert", font=("Calibri", 9), command=Main)
Calculate_Button.place(x=180,y=75,width=80)


# <----- Elements for Result ----->
Result_Label = Label(main_window, text="Result :", anchor=E, font=("Calibri", 9))
Result_Label.place(x=100,y=130)
Result_Entry_Val = StringVar()
Result_Entry = Entry(main_window, textvariable=Result_Entry_Val, font=("Calibri", 9))
Result_Entry.configure(state='readonly')
Result_Entry.place(x=150,y=130)


# <----- Elements for Status Bar ----->
Status = Label(main_window, text="Hello!! :D", fg="green", font=("Calibri", 9), bd=1, relief=SUNKEN, anchor=W, padx=3)
Status.pack(side=BOTTOM, fill=X)


# <----- Load Main Window ----->
main_window.mainloop()
2 changes: 1 addition & 1 deletion Master Script/datastore.json
View file Open in desktop

Large diffs are not rendered by default.

Binary file added Spaceship_Game/Assets/Red_Spaceship.png
View file Open in desktop
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
[フレーム]
Binary file added Spaceship_Game/Assets/Yellow_Spaceship.png
View file Open in desktop
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
[フレーム]
Binary file added Spaceship_Game/Assets/space.jpg
View file Open in desktop
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
[フレーム]
17 changes: 17 additions & 0 deletions Spaceship_Game/README.md
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# SPACESHIP GAME

- The python script makes use of Pygame, a popular GUI module, to develop an interactive multiplayer Spaceship Game.
- The 2 players compete to aim bullets at each other and the first player to lose their health, loses.

## Requirements:

All the packages essential for running the script can be installed as follows:

``` sh
$ pip install -r requirements.txt
```

## Working:

![GIF](https://media.giphy.com/media/gRjmH1VPUBZrfYV0RH/giphy.gif)

Loading

AltStyle によって変換されたページ (->オリジナル) /