如图,绿方块是起点,红方块终点;蓝方块是水(障碍物)。想像在图的周围加上边界,建立坐标系,x和y分别从1开始,则x取值[1,9],y取值[1,7],起点坐标(3,4),终点坐标(7,4);为简单起见,将坐标以一个整数标记:100 * y + x.
路径搜寻过程中,有一点与参考文章不同的是,障碍物的角被认为是可穿过的,只要穿过之后的坐标不是障碍物或边界。
参阅:http://www.cppblog.com/christanxw/archive/2006/04/07/5126.html
英文原文:http://www.gamedev.net/reference/articles/articl ...
确定将一定数量的钱(以分为单位)转换成两角五分的硬币,一角硬币,五分和一分硬币的方法总数。
import java.util.Stack;
public class Coin {
private static int[] coins = {25,10,5,1};
private static Stack<Integer> roots =new Stack<Integer>();
private static void divide(int num){
for (int coin : coins){
...
又有很久没运动了。昨天做了几组俯卧撑,胸肌和肱三头肌疼的不轻。记录一下,看能坚持几天。
2008.2.13 最多的一次做15个
2008.2.14 最多的一次做14个
2008.2.15 最多的一次做15个
2008.2.16 5个(被大妞严重干扰了锻炼情绪)
2008.2.17 -1
2008.2.18 15
# -*- coding: utf-8 -*-
"""
some function by metaphy,2007-04-03,copyleft
version 0.2
"""
import urllib, httplib, urlparse
import re
import random
"""judge url exists or not,by others"""
def httpExists(url):
host, path = urlparse.urlsplit(url)[1:3]
if ':' in host:
# port ...
词法分析package compile;
/**
* 词法分析:返回数字和操作符号的序列
* @author metaphy
* 2007-6-14
*/
public class Lexer {
public static final String EOS = " " ; /*token之间的分隔符*/
public static final String DONE ="=" ; /*token结束的标记*/
private StringBuffer tokens = new StringBuffer();
private String expressi ...
public class Queens {
private int[] queens = new int[8]; //解数组
private int[] colflag =new int[8]; //列冲突标记
private int[] flags1 = new int[15]; //对角线冲突标记
private int[] flags2 = new int[15]; //对角线冲突标记
private int roots ;
private void trySet(int row){
for (int column=0; column < 8; col ...
- 浏览: 16456 次
- 性别:

- 来自: 大连

- 详细资料
搜索本博客
我的相册
theend
共 10 张
共 10 张
最近加入圈子
最新评论
-
近期英语学习计划
任重而道远 mmd 学外语真是场持久战
-- by metaphy -
从Spring MVC-step-by-ste ...
引用汗一个 教授派的吧啥意思...
-- by metaphy -
从Spring MVC-step-by-ste ...
汗一个 教授派的吧
-- by jianfeng008cn -
翻译:Java游戏开发
whycloud 写道 Nighthaven 写道 其实我觉得这书的中文 ...
-- by Nighthaven -
翻译:Java游戏开发
而且这本的中文版我看过的,总的来讲还不是特别的烂 不过支持lz自己翻译,翻译的过 ...
-- by whycloud






评论排行榜