dp 分别计算从左到右.从右到左.从上到下.从下到上4个方向可能的值,然后计算所有为‘0’的地方的4个方向的值的最大值 https://www.cnblogs.com/grandyang/p/5599289.html class Solution { public: /** * @param grid: Given a 2D grid, each cell is either 'W', 'E' or '0' * @return: an integer, the maximum enemies y…
原题链接在这里:https://leetcode.com/problems/bomb-enemy/description/ 题目: Given a 2D grid, each cell is either a wall 'W', an enemy 'E' or empty '0' (the number zero), return the maximum enemies you can kill using one bomb.The bomb kills all the enemies in t…
Given a 2D grid, each cell is either a wall 'W', an enemy 'E' or empty '0' (the number zero), return the maximum enemies you can kill using one bomb.The bomb kills all the enemies in the same row and column from the planted point until it hits the wa…
914. Flip Game https://www.cnblogs.com/grandyang/p/5224896.html 从前到后遍历,遇到连续两个'+',就将两个加号变成'-'组成新的字符串加入到结果中. class Solution { public: vector<string> generatePossibleNextMoves(string &s) { // write your code here vector<string> result; ;i <…
Alex and Lee play a game with piles of stones.  There are an even number of piles arranged in a row, and each pile has a positive integer number of stones piles[i]. The objective of the game is to end with the most stones.  The total number of stones…
Long long ago there is a strong tribe living on the earth. They always have wars and eonquer others.One day, there is another tribe become their target. The strong tribe has decide to terminate them!!!There are m villages in the other tribe. Each vil…
一.步骤: 1.创建三个Cube,并将这三个Cube的Cube的Tag设为Enemy 2.导入第一人称视角的资源 3.创建名为Targeting的C#脚本 4.编写Targeting脚本,并将它附到第一人称的对象上 二.Targeting脚本 using UnityEngine; using System.Collections; using System.Collection.Generic; public class Targetting:MonoBehaviour{ public List…
bomb炸弹实验 首先对bomb这个文件进行反汇编,得到一个1000+的汇编程序,看的头大. phase_1: 0000000000400ef0 <phase_1>: 400ef0: 48 83 ec 08 sub $0x8,%rsp 400ef4: be 18 1b 40 00 mov $0x401b18,%esi 400ef9: e8 10 04 00 00 callq 40130e <strings_not_equal> 400efe: 85 c0 test %eax,%ea…
Arithmetic of Bomb Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 129    Accepted Submission(s): 94 Problem Description 众所周知,度度熊非常喜欢数字. 它最近在学习小学算术,第一次发现这个世界上居然存在两位数,三位数……甚至N位数! 但是这回的算术题可并不简单,由于…
Enemy类在Enemy.js中,类Enemy类继承自PhysicsSprite,以便于可以使用物理引擎中的一些特性. 原版的Enemy.js: var Enemy = cc.PhysicsSprite.extend({//PhysicsSprite enemyType: 0, //敌人类型 initialHitPoints: 0, //初始的生命值 hitPoints: 0, //当前的生命值 velocity: null, //速度 space: null, //所在物理空间 ctor: f…
Arithmetic of Bomb Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 151    Accepted Submission(s): 108 Problem Description 众所周知,度度熊非常喜欢数字. 它最近在学习小学算术,第一次发现这个世界上居然存在两位数,三位数……甚至N位数! 但是这回的算术题可并不简单,由…
首先是代码: MyDirectX.h: #pragma once //header file #define WIN32_EXTRA_LEAN #define DIRECTINPUT_VERSION 0x0800 #include<Windows.h> #include<d3d9.h> #include<d3dx9.h> #include<dinput.h> #include<xinput.h> #include<time.h> #i…
LeetCode 461. 汉明距离 or LintCode 365. 二进制中有多少个1 题目一:LeetCode 461. 汉明距离 LeetCode 461.明距离(Hamming Distance) 两个整数之间的汉明距离指的是这两个数字对应二进制位不同的位置的数目.给出两个整数 x 和 y,计算它们之间的汉明距离. 注意 0 ≤ x, y < 2^31. 示例 Java 代码 class Solution { public int hammingDistance(int x, int…
bomblab这节搞的是二进制拆弹,可以通俗理解为利用反汇编知识找出程序的六个解锁密码. 早就听闻BOMBLAB的大名,再加上我一直觉得反汇编是个很艰难的工作,开工前我做好了打BOSS心理准备.实际上手后发现比想象的要简单. 我觉得这多亏了作者没有搞代码优化,让我能比较轻易的还原出源代码,甚至一眼看出所用的数据结构.但凡它搞一点儿代码混淆,都会把这次实验变成一次苦痛之旅. 前置小技巧 1.gdb调试汇编 我试了一番后觉得用以下几条指令在全屏模式下调试是体验最好的 gdb -tui ./bomb…
Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties: Integers in each row are sorted in ascending from left to right. Integers in each column are sorted in ascending from top to bottom.…
跳跃游戏 给出一个非负整数数组,你最初定位在数组的第一个位置. 数组中的每个元素代表你在那个位置可以跳跃的最大长度. 判断你是否能到达数组的最后一个位置. 样例 A = [2,3,1,1,4],返回 true. A = [3,2,1,0,4],返回 false. 解题 更新 public class Solution { /** * @param A: A list of integers * @return: The boolean answer */ public boolean canJu…
Given n balloons, indexed from 0 to n-1. Each balloon is painted with a number on it represented by array nums. You are asked to burst all the balloons. If the you burst balloon i you will get nums[left] * nums[i] * nums[right] coins. Here left and r…
Note: 后面数字n表明刷的第n + 1遍, 如果题目有**, 表明有待总结 Conclusion questions: [LeetCode] questions conclustion_BFS, DFS LeetCode questions conclustion_Path in Tree [LeetCode] questions conlusion_InOrder, PreOrder, PostOrder traversal [LeetCode] questions for Dynamic…
Questions: [LeetCode] 198. House Robber _Easy tag: Dynamic Programming [LeetCode] 221. Maximal Square _ Medium Tag: Dynamic Programming [LeetCode] 62. Unique Paths_ Medium tag: Dynamic Programming [LeetCode] 64. Minimum Path Sum_Medium tag: Dynamic P…
昨天没有更新内容,今天相对多写一些. 因为我们已经基本完成游戏框架,但是游戏结束后,并不知道怎样比较好开始.我本来本着懒的原则,想结束后显示一个黑屏,然后你重新点一下鼠标就重新开始.但是那样实在太不像个热爱生活的程序员了,所以我决定用更合适的方法解决这个问题. 为此,我决定实现一个相对比较过得去的按钮. 为了实现按钮,我先创建一个测试程序体.然后在上面先实现一个按钮类的功能. 具体的测试程序,我就不详说了,反正就是你去创建一个这样的小窗口: 然后在上面完成一个按钮的类. 我设想的按钮应该是这样的…
The AI has the following actions available: Action Function Shoot Fires the Kalashnikov Reload Reload the Kalashnikov with a full magazine Use bomb Use a bomb Use health pack Use a health pack to replenish health to full Move to tactical position Mov…
html 5例如,下面的代码段: <!DOCTYPE html> <html> <head> <meta charset="utf-8"/> </head> <body onkeydown="getCommand();"> <h1>hmtl5-经典的坦克大战</h1> <!--坦克大战的战场--> <canvas id="tankMap&quo…
https://github.com/PacktPublishing/Game-Development-Patterns-and-Best-Practices https://github.com/mattCasanova/Mach5 1. Introduction to Design Patterns (已看) 2. One Instance to Rule Them All - Singletons (已看) 3. Creating Flexibility with the Componen…
一.前言 今天我们来讲一个最最最常见的一个小游戏--打飞机!是的,打飞机!还记得小时候在玩儿的雷电,应该是打飞机最早的样子了吧.直到现在,也有微信打飞机,全民飞机大战,全民打飞机等游戏的出现,这些游戏基本都是在我们小时候玩儿的打飞机的原型上增加特效音效以及更多新的玩儿法,在这基础上进行的创新.其实作为开发者来说,仔细看这款游戏,也并不是什么高大上的游戏,其他很多元素.逻辑,都是我们常见的,比如滚动背景,定时产生敌人等.真正开发一款打飞机游戏,其实只要一天就够了,但这个游戏的经典玩法却是很难超越的…
Under Attack Time Limit:  10 Seconds      Memory Limit:  65536 KB  Doctor serves at a military air force base. One day, the enemy launch a sudden attack and the base is under heavy fire. The fighters in the airport must take off to intercept enemy bo…
一.前言 笔者闲来无事,某天github闲逛,看到了游戏引擎的专题,引起了自己的兴趣,于是就自己捣腾了一下Cocos2dx-JS.由于是学习,所谓纸上得来终觉浅,只是看文档看sample看demo,并不会让自己有多大的提升,于是一开始就计划写一个小游戏,以作为自己完成这个阶段学习的一个标志,也算是目标导向吧. 百牛信息技术bainiu.ltd整理发布于博客园完整源码移步Github: https://github.com/RogerKang/JasonAmbitionOnline Demo: h…
# -*- coding:utf-8 -*- import pygame import sys from pygame.locals import * from pygame.font import * import time import random class Hero(object): #玩家 英雄类 def __init__(self, screen_temp): self.x = 210 self.y = 700 self.life = 21 # self.life = 100 se…
使用JustWeEngine开发微信打飞机: 作者博客: 博客园 引擎地址:JustWeEngine 示例代码:EngineDemo JustWeEngine? JustWeEngine是托管在Github 的一个开源的Android原生开发框架,可以让Android的开发人员 非常便捷,无需切换语言和编译器的制作Android原生游戏. 使用方法 引入Engine作为Library进行使用. 引入"/jar"文件夹下的jar包. 使用Gradle构建: Step 1. Add the…
被人物编辑器折腾了一个月,最终还是交了点成品上去(还要很多优化都还么做).  刚接手这项工作时觉得没概念,没想法,不知道.后来就去看<<Unity5.X从入门到精通>>中有关于自定义编辑器(自定义Inspector和自定义Scene或GUI)的一些例子,还包括看了 雨松的编辑器教程 和 自定义结构显示在Inspector的方法 看完之后也实战了一下就算入了门,就分析自己项目的人物对应的数据,如下图: 上述数据其实很简单但是对于我这种初学者来说就有点难度,首先因为Actions 和…
本文主要记录在学习过程中遇到的JavaScript难点或者容易疏忽的细节,也方便自己日后翻阅学习. 1.arr.length === + arr.length arr.length === + arr.length 是一种鸭式辨型的判断方法.这句话包含两层意思: arr有length这个属性 arr.length是一个Number(可以试一下x === +x) 鸭式辨型的经典假设:只要是会游泳的鸟类,不管它是什么,我都把它当成鸭子.只要arr有length这个属性,且它是个Number,我都把a…