Game of "nested loop mating problem"
takehiko/nlmate
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
$ ruby nlmate -0 [Tutorial] "nlmate" is a game for you to solve the nested loop mating problem, called after the Shogi mating problem (a.k.a. Tsume-Shogi). Your task is typing in two "for statements" which work as the nested loop to conform to the goal sequence. After the entry, the fixed codes in C surround and enclose your instructions and the source file is automatically compiled to decide if the output is the same as the goal. The input which begins with the word other than "for" is not allowed, except that you may type "quit" to stop playing the game. All you have to do for the first task is punch in "for (i = 0; i <= 2; i++)" and "for (j = 0; j <= 2; j++)" in series. Don't forget to hit the Enter key to let me know your answer! [Level 1] Goal: (0,0),(0,1),(0,2),(1,0),(1,1),(1,2),(2,0),(2,1),(2,2), Outer loop: for (i = 0; i <= 2; i++) Inner loop: for (j = 0; j <= 2; j++) ======================================== #include <stdio.h> int main(void) { int i = 123, j = 456; for (i = 0; i <= 2; i++) for (j = 0; j <= 2; j++) printf("(%d,%d),", i, j); return 0; } ======================================== Output: (0,0),(0,1),(0,2),(1,0),(1,1),(1,2),(2,0),(2,1),(2,2), Goal: (0,0),(0,1),(0,2),(1,0),(1,1),(1,2),(2,0),(2,1),(2,2), Correct! $ ruby nlmate --help Usage: nlmate [options] -0, --tutorial Tutorial mode (Level 1 only) --beginner Beginner mode (up to Level 3, default) --kaikin Kaikin mode (up to Level 9) -d, --dir=VAL Working directory -v, --var=VAL Value for variation -l, --level=VAL Fixed level --from=VAL Start level --to=VAL End level --[no-]playtime Print play time
About
Game of "nested loop mating problem"
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published