Chromium Code Reviews| OLD | NEW | 
|---|---|
| 1 Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 
| 2 for details. All rights reserved. Use of this source code is governed by a | 2 for details. All rights reserved. Use of this source code is governed by a | 
| 3 BSD-style license that can be found in the LICENSE file. | 3 BSD-style license that can be found in the LICENSE file. | 
| 4 | 4 | 
| 5 Dartcombat is a sample game which illustrates how to use isolate communication | 5 Dartcombat is a sample game which illustrates how to use isolate communication | 
| 6 and futures. | 6 and futures. | 
| 7 | 7 | 
| 8 Building and running: | 8 Building and running: | 
| 9 | 9 | 
| 10 1. go to the top-level directory of the project: | 10 1. go to the top-level directory of the project: | 
| 11 $ cd dart/ | 11 $ cd dart/ | 
| 12 | 12 | 
| 13 2. build the dartc compiler: | 13 2. build the dartc compiler: | 
| 14 $ ./tools/build.py --arch=ia32 | 14 $ ./tools/build.py --arch=ia32 | 
| 15 | 15 | 
| 16 3. run the htmlconverter tool, that converts the dart code to javascript: | 16 3. either compile the Dart code to JavaScript, or load the code directly into | 
| 17 $ python ./client/tools/htmlconverter.py \ | 17 Dartium: | 
| 18 client/samples/dartcombat/dartcombat.html -o out/ | |
| 19 | 18 | 
| 20 4. open the generated file in a browser: | 19 - to compile the code: | 
| 21 $ google-chrome out/client/samples/dartcombat/dartcombat-js.html | 20 $(DART_SDK)/bin/frogc --out=dartcombat.dart.js dartcombat.dart | 
| 
 
Siggi Cherem (dart-lang)
2012/04/04 18:02:21
does dart.js search 'foo.dart' and 'foo.dart.js'?
 
 | |
| 21 | |
| 22 4. open the generated file in a browser (either Dartium, Chrome, or another | |
| 23 supported browser): | |
| 24 $ google-chrome dartcombat.html | |
| 22 | 25 | 
| 23 Using dartcombat: | 26 Using dartcombat: | 
| 24 | 27 | 
| 25 Dartcombat works as follows: | 28 Dartcombat works as follows: | 
| 26 - screen: The screen shows 4 grids. On the left is what player1 knows (his board | 29 - screen: The screen shows 4 grids. On the left is what player1 knows (his board | 
| 27 in detail, and his partial knowledge of player2's board), on the right is what | 30 in detail, and his partial knowledge of player2's board), on the right is what | 
| 28 player2 knows. | 31 player2 knows. | 
| 29 | 32 | 
| 30 - setup: You can place boats on the top boards by clicking and dragging the | 33 - setup: You can place boats on the top boards by clicking and dragging the | 
| 31 mouse. | 34 mouse. | 
| 32 | 35 | 
| 33 - shooting: You can shoot by clicking on the bottom grids. To highlight isolate | 36 - shooting: You can shoot by clicking on the bottom grids. To highlight isolate | 
| 34 communication and futures, we made each click a supershoot: if a boat is hit, | 37 communication and futures, we made each click a supershoot: if a boat is hit, | 
| 35 the player will automatically scan all cells around the initial shot, and | 38 the player will automatically scan all cells around the initial shot, and | 
| 36 progresively hit the boat and sink it. | 39 progresively hit the boat and sink it. | 
| OLD | NEW |