diff --git a/README.md b/README.md index 13b3019..d8bb947 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,32 @@ Python-based spaceship dodging game in terminal using curses (windows-curses), no pygame required. +> Windows version of Python doesn't come with built-in module `curses`, but you can work around by using `windows-curses` +### Linux + +```bash +# unit test for windows +conda env create -f environment.yml -n spaceship # env name +conda activate spaceship +# run the program +python test.py --canvas_height 30 --canvas_width 30 --diff_level 2 +``` + +demo + + + +### Windows ```bash # unit test for windows conda env create -f environment_win.yml -n spaceship # env name conda activate spaceship -python test.py +# run the program +python test.py --canvas_height 30 --canvas_width 30 --diff_level 2 ``` +demo + +![](https://i.loli.net/2021/05/14/i3oxKlQY9mcg74s.gif) + diff --git a/demo/demo.gif b/demo/demo_win.gif similarity index 100% rename from demo/demo.gif rename to demo/demo_win.gif diff --git a/environment.yml b/environment.yml new file mode 100644 index 0000000..e1ea3cb --- /dev/null +++ b/environment.yml @@ -0,0 +1,24 @@ +name: spaceship +channels: + - defaults +dependencies: + - _libgcc_mutex=0.1=main + - ca-certificates=2021.4.13=h06a4308_1 + - certifi=2020.12.5=py39h06a4308_0 + - ld_impl_linux-64=2.33.1=h53a641e_7 + - libffi=3.3=he6710b0_2 + - libgcc-ng=9.1.0=hdf63c60_0 + - libstdcxx-ng=9.1.0=hdf63c60_0 + - ncurses=6.2=he6710b0_1 + - openssl=1.1.1k=h27cfd23_0 + - pip=21.0.1=py39h06a4308_0 + - python=3.9.4=hdb3f193_0 + - readline=8.1=h27cfd23_0 + - setuptools=52.0.0=py39h06a4308_0 + - sqlite=3.35.4=hdfb4753_0 + - tk=8.6.10=hbc83047_0 + - tzdata=2020f=h52ac0ba_0 + - wheel=0.36.2=pyhd3eb1b0_0 + - xz=5.2.5=h7b6447c_0 + - zlib=1.2.11=h7b6447c_3 +prefix: /home/luchaoqi/miniconda3/envs/spaceship diff --git a/main.py b/main.py index a8cbd28..59cf2f1 100644 --- a/main.py +++ b/main.py @@ -79,7 +79,7 @@ def main(nlines=10,ncols=30,begin_y=0,begin_x=0,difficulty=2): # sourcery no-me parser.add_argument("--canvas_width", nargs='?', default=30, type=int,help="width of canvas") parser.add_argument("--begin_y", nargs='?', default=0, type=int,help="position of upper margin of canvas") parser.add_argument("--begin_x", nargs='?', default=0, type=int,help="position of left margin of canvas") - parser.add_argument("--diff_level", nargs='?', default=1, type=int, choices=[0,1,2], help="difficulty level: control the number of obstacles/move speed") + parser.add_argument("--diff_level", nargs='?', default=1, type=int, choices=[0,1,2], help="difficulty level: control the number of obstacles/move speed. Choices = [0,1,2]. Defaults to 2") args = parser.parse_args() main(nlines=args.canvas_height,ncols=args.canvas_width,difficulty=args.diff_level) \ No newline at end of file