Path to victory

无论身处何种境遇,总有两条道路摆在眼前:一条通往成功,另一条则通向失败。关键在于我们如何选择并采取行动。博客鼓励读者认识到希望始终存在,只要一步步前进,就能达到心中的目的地。
 

转载自:http://greatday.com/motivate/070508.html

Tuesday, May 8, 2007

Path to victory

From this moment, there is a path that leads toward victory and another path that leads toward defeat. Which path is your awareness focused upon?

Each pathway is equally valid, equally realistic, and equally accessible. Which path have you chosen to follow?

The particular circumstances of this moment don't really matter that much. What matters is what you decide to do with what you have right now.

Know, without a doubt, that there is a very real path that goes from where you are now to where you would most like to be. Know it and you will surely see it.

Always, there is hope, for always you can take a step forward. Step by step, you can work your way to any place you choose.

Get yourself on the path that leads to victory, to accomplishment and fulfillment of your most deeply held purposes. That path is surely here right now, ready for you to take the next step.

-- Ralph Marston

 
Your program must allow Thor to reach the light of power. Rules Thor moves on a map which is 40 wide by 18 high. Note that the coordinates (X and Y) start at the top left! This means the most top left cell has the coordinates "X=0,Y=0" and the most bottom right one has the coordinates "X=39,Y=17". Once the program starts you are given: the variable lightX: the X position of the light of power that Thor must reach. the variable lightY: the Y position of the light of power that Thor must reach. the variable initialTX: the starting X position of Thor. the variable initialTY: the starting Y position of Thor. At the end of the game turn, you must output the direction in which you want Thor to go among: N (North) NE (North-East) E (East) SE (South-East) S (South) SW (South-West) W (West) NW (North-West) Each movement makes Thor move by 1 cell in the chosen direction. Victory Conditions You win when Thor reaches the light of power Lose Conditions Thor moves outside the map Initial phase Thor starts on the map at position (3, 6). The light is at position (3, 8). Round 1 Action S: Thor moves towards south. New position is (3, 7). Round 2 Action S: Thor moves towards south. New position is (3, 8). Note Do not forget to execute the tests from the "Test cases" panel. Beware: the tests given and the validators used to compute the score are slightly different in order to avoid hard coded solutions. Game Input The program must first read the initialization data from the standard input, then, in an infinite loop, provides on the standard output the instructions to move Thor. Initialization input Line 1: 4 integers lightX lightY initialTX initialTY. (lightX, lightY) indicates the position of the light. (initialTX, initialTY) indicates the initial position of Thor. Input for a game round Line 1: the number of remaining moves for Thor to reach the light of power: remainingTurns. You can ignore this data but you must read it. Output for a game round A single line providing the move to be made: N NE E SE S SW W ou NW Constraints 0 ≤ lightX < 40 0 ≤ lightY < 18 0 ≤ initialTX < 40 0 ≤ initialTY < 18 Response time for a game round ≤ 100ms
08-13
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值