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
var ids = ['IN-AN', 'IN-AP', 'IN-AR', 'IN-AS', 'IN-BR', 'IN-CH', 'IN-CT', 'IN-DD', 'IN-DL', 'IN-DN', 'IN-GA', 'IN-GJ', | |
'IN-HP', 'IN-HR', 'IN-JH', 'IN-JK', 'IN-KA', 'IN-KL', 'IN-LD', 'IN-MH', 'IN-ML', 'IN-MN', 'IN-MP', | |
'IN-MZ', 'IN-NL', 'IN-OR', 'IN-PB', 'IN-PY', 'IN-RJ', 'IN-SK', 'IN-TG', 'IN-TN', 'IN-TR', | |
'IN-UP', 'IN-UT', 'IN-WB']; | |
function init(evt) { | |
if ( window.svgDocument == null ) { | |
svgDocument = evt.target.ownerDocument; | |
} |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<title>India Interactive SVG Map on the SSaurel's Blog</title> | |
<style type="text/css"> | |
#title { | |
font-size: 25px; | |
fill: black; |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<title>India Interactive SVG Map on the SSaurel's Blog</title> | |
</head> | |
<body> | |
<svg height="800" width="1000"> | |
<path | |
id="IN-AN" |
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
import tkinter as tk | |
import random as rand | |
import threading | |
import os | |
#define some constants | |
WIDTH = 1000 | |
HEIGHT = 700 | |
MARGIN = 15 |
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
# Now, we can define the Pong Game Object | |
class Pong: | |
def __init__(self, root, width, height, margin): | |
paddlewidth = width / 50 | |
paddleheight = height / 12 | |
self.leftpoints = 0 | |
self.lefttxt = None | |
self.rightpoints = 0 | |
self.righttxt = None | |
self.render = True # True when we need to render the game on the canvas |
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
# Now, it is time to design the Paddle for our Pong Game | |
class Paddle: | |
def __init__(self, canvas, topx, topy, width, height, boardheight): | |
self.topx = topx | |
self.topy = topy | |
self.width = width | |
self.height = height | |
self.boardheight = boardheight | |
self.score = 0 | |
self.canvas = canvas |
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
# First, we design the Ball Object | |
class Ball: | |
def __init__(self, canvas, width, velocity, boardwidth, boardheight): | |
self.width = width | |
self.boardwidth = boardwidth | |
self.boardheight = boardheight | |
# we center the ball on the board | |
self.topx = boardwidth / 2 - width / 2 | |
self.topy = boardheight / 2 - width / 2 | |
self.velocity = velocity |
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
public String intToRoman(int arabic) { | |
StringBuilder roman = new StringBuilder(); | |
if (arabic == 10) { | |
roman.append("X"); | |
} else { | |
while (arabic-- > 0) { | |
roman.append("I"); | |
} | |
} |
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
import tkinter as tk | |
import random | |
from copy import deepcopy | |
class FlippingBitsGame: | |
def __init__(self, level): | |
self.level = level # Level = size of the square | |
self.target = [[0] * level for _ in range(level)] # the board to obtain when you play | |
self.board = [[0] * level for _ in range(level)] # the current board played by the user | |
self.solved = 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
def onclick(self, event): | |
if self.game.solved: | |
self.game.newgame() | |
self.drawboard() | |
return | |
# we get coordinates of the user's click | |
idx = int(event.x) | |
idy = int(event.y) |