This file contains hidden or 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
#include<iostream> | |
#include<queue> | |
#define INT_MAX 1000000 | |
using namespace std; | |
/* Author : Prateek Narang */ | |
int findMinMoves(int *board,int n){ | |
//We will use BFS to calculate shortest path | |
//moves[i] maintains the min number of moves to reach position i |
This file contains hidden or 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 game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-code', { preload: preload, create: create, update: update }); | |
var sprite; | |
function preload() { | |
game.load.image('phaser', 'assets/sprites/phaser.png'); | |
} | |
function create() { |
This file contains hidden or 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
function init(){ | |
canvas = document.getElementById('mycanvas'); | |
pen = canvas.getContext('2d'); | |
W = canvas.width; | |
H = canvas.height; | |
score = 0; | |
snake = { | |
length:5, |
This file contains hidden or 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
function loadImages(){ | |
enemyImage = new Image(); | |
shipImage = new Image(); | |
enemyImage.src = "Images/enemy.png"; | |
shipImage.src = "Images/player.png"; | |
} |
This file contains hidden or 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 GameState = { | |
///Some Hidden Objects | |
init:function(){ | |
//console.log("In init"); | |
this.physics.startSystem(Phaser.Physics.ARCADE); | |
this.physics.arcade.gravity.y = 1000; | |
This file contains hidden or 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 game = new Phaser.Game(320,514,Phaser.AUTO,'game_div'); | |
var c=0; | |
var userName =0 ; | |
var main_state={ | |
preload:function(){ | |
this.game.stage.backgroundColor='#0B0B61'; | |
var text = "Loading...."; |
This file contains hidden or 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
#include<iostream> | |
using namespace std; | |
/// N - steps in ladder, jump max 1,2,3 | |
int countWays(int n){ | |
if(n==0){ | |
return 1; | |
} | |
if(n<0){ | |
return 0; |
This file contains hidden or 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
#include<iostream> | |
using namespace std; | |
int coinsNeeded(int coins[],int amount,int n){ | |
if(amount==0){ | |
return 0; | |
} | |
int ans = INT_MAX; |
This file contains hidden or 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
#include<iostream> | |
using namespace std; | |
int knapsack(int wts[],int prices[],int N,int W){ | |
///Base Case | |
if(N==0||W==0){ | |
return 0; | |
} | |
///Rec Case |
This file contains hidden or 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
#include<iostream> | |
#include<climits> | |
using namespace std; | |
int query(int *tree,int index,int s,int e,int qs,int qe){ | |
///No Overlap | |
if(qs>e || qe<s){ | |
return INT_MAX; | |
} | |
///Complete Overlap |
OlderNewer