Skip to content

Commit

Permalink
add missing exo in git
Browse files Browse the repository at this point in the history
  • Loading branch information
parmentelat committed Dec 5, 2020
1 parent 76ec56f commit 8f8a278
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions exercises/checkers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# pylint: disable=c0111
import numpy as np

from nbautoeval import Args, ExerciseFunctionNumpy, ImshowRenderer


# @BEG@ name=checkers
def checkers(size):
"""
Un damier
le coin (0, 0) vaut 0
"""
I, J = np.indices((size, size))
return (I + J) % 2
# @END@


checkers_inputs = [
Args(3),
Args(1),
Args(0),
Args(2),
Args(4),
]


exo_checkers = ExerciseFunctionNumpy(
checkers,
checkers_inputs,
nb_examples=2,
result_renderer=ImshowRenderer(css_width="100px", cmap='gray'),
)

0 comments on commit 8f8a278

Please sign in to comment.