-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7ccf6cd
commit 9778530
Showing
4 changed files
with
79 additions
and
31 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
from airpower.draw import * | ||
from airpower.prolog import startprolog, endprolog | ||
from airpower.turn import startturn, endturn | ||
from airpower.aircraft import Aircraft | ||
from airpower.azimuth import setnorth | ||
from airpower.map import setmap, drawmap |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import airpower.map as apmap | ||
import airpower.azimuth as apazimuth | ||
import airpower.turn as apturn | ||
|
||
def startprolog(sheets, compassrose, north="up"): | ||
print("--- start prolog ---") | ||
apazimuth.setnorth(north) | ||
apmap.setmap(sheets, compassrose) | ||
apmap.drawmap() | ||
apturn.restart() | ||
print() | ||
|
||
def endprolog(): | ||
print("--- end prolog ---") | ||
print() |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import airpower.map as apmap | ||
|
||
_turn = None | ||
_maxturn = 0 | ||
|
||
def restart(): | ||
global _turn | ||
_turn = 1 | ||
|
||
def startturn(turn): | ||
global _turn | ||
global _maxturn | ||
if not isinstance(turn, int) or turn < 1: | ||
raise ValueError("invalid turn %d." % turn) | ||
if turn > _maxturn + 1: | ||
raise ValueError("attempt to start turn %d out of sequence." % turn) | ||
_turn = turn | ||
_maxturn = max(_maxturn, _turn) | ||
print("--- start of turn %d ---" % _turn) | ||
print("") | ||
apmap.drawmap() | ||
|
||
def endturn(): | ||
global _turn | ||
print("--- end of turn %d ---" % _turn) | ||
print("") | ||
_turn = None | ||
|
||
def turn(): | ||
return _turn | ||
|
||
def restart(): | ||
global _turn | ||
global _maxturn | ||
_turn = None | ||
_maxturn = 0 |