Skip to content

Commit

Permalink
finish linux env test
Browse files Browse the repository at this point in the history
  • Loading branch information
Luchao Qi committed May 13, 2021
1 parent ee5b454 commit b073b67
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 2 deletions.
23 changes: 22 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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

<iframe width="857" height="565" src="https://www.youtube.com/embed/x4g7NjKTjqw" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

### 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)

File renamed without changes
24 changes: 24 additions & 0 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit b073b67

Please sign in to comment.