diff --git a/rc/README.md b/rc/README.md new file mode 100644 index 000000000..065a81709 --- /dev/null +++ b/rc/README.md @@ -0,0 +1,119 @@ +## rc (restrictions checker) + +This program analyses a go source file and displays in standard output the imports, functions, array types and loops used without authorization. + +### By default: + +- NO imports and NO built-in functions are allowed. +- NO casting is allowed either. +- Only functions declared inside the source file are allowed. +- All array types are allowed +- Loops are allowed + +### Flags + +- Two flags are defined: + - `--cast` allows casting to every built-in type. + - `--no-for` prohibits the use of `for` loops in the program or function. + - `--no-array`: + - Prohibits all array types if no types are specified after the flag. + Ex. + ```console + _$ ./rc main.go fmt.* github.com/01-edu/z01.PrintRune len --no-array + ``` + All array type in main.go will cause an error message. + - Prohibits only the types specified after the flag + Ex. + ```console + _$ ./rc main.go fmt.* github.com/01-edu/z01.PrintRune len --no-array rune string + ``` + Only array from the type rune and string are prohibit. All other array from built-in types are allowed + +### Arguments: + +- First Argument: + +The program must be executed passing the go source file to be analyze as the first argument + +- The remaining argument (from 2 to ...): + + Can be (without any particular order): + + - Allowed imports and functions from a package + - `.*` for full imports (all functions from that package are allowed) + - ``.`` for partial imports (only the function is allowed) + - ``.`#amout` for certain amounts (only certain amount os a function is allowed) + - Ex: `fmt.*` (all functions from `fmt` are allowed), `github.com/01-edu/z01.PrintRune` (only `z01.PrintRune` is allowed), `append#2` (the only amount of `append`'s allowed is 2) + - Allowed built-in functions + - Use the name of the built-in function + - Ex: `make`, `append`, `len`. + - Allowed casting + - by using the type of casting, ex: for allowing `string` casting, use `string` + - Or use the flag `--cast`, to allow every type of casting + + - Import relative packages + - Use the relative path + - Ex: `../piscine`, `..`, `.` + + - Unallow for loops + - Use the flags `--no-for`. + - Note: remember to use it before the `--no-array` flag. + - ex: + ```console + _$ ./rc main.go fmt.* github.com/01-edu/z01.PrintRune len --no-array <...> --no-for + ``` + the last line produces undesired behaviors. + - Unallow literals + - Use the flag `--no-lit="{PATTERN}"` + - Note: `"{PATTERN}"` must be a valid RegExp. + - ex: + ```console + _$ ./rc main.go fmt.* github.com/01-edu/z01.PrintRune len --no-array --no-lit=[b-yB-Y] + ``` +- Optional lasts arguments + - The flag `--no-array` must be given as the last argument or to signal that all the arguments after are unallowed array types +### Usage: + +- To allow the import of the whole `fmt` package, `z01.PrintRune` and the built-in functions len in the file `main.go` + + The imports must be writen exactly the way are writen inside the source code, example: + +```console + _$ ./rc main.go fmt.* github.com/01-edu/z01.PrintRune len +``` +- More examples: + +- import "fmt" is allowed by executing + ```console + _$ ./rc sourcefile.go fmt.* + ``` + + - import "go/parser" is allowed by executing + ```console + _$ ./rc sourcefile.go go/parser.* + ``` + + - import "github.com/01-edu/z01" is allowed by executing + ```console + ./rc sourcefile.go github.com/01-edu/z01.* + ``` + + - import "../../../all/tests/go/solutions" is allowed by executing + ```console + _$ ./rc sourcefile.go ../../../all/tests/go/solutions + ``` + (no `.*` is needed, all the functions from this relative package are allowed) + +- allow all type of casting + + ```console + _$ ./rc sourcefile.go ../../../all/tests/go/solutions/ztail/ztail.go fmt.* github.com/01-edu/z01 os.* strconv.* make len append --cast + ``` + - this will allow all type of casting in the file ztail.go + +- to allow just one type of casting + + ```console + _$ ./rc sourcefile.go ../../../all/tests/go/solutions/ztail/ztail.go fmt.* github.com/01-edu/z01 os.* strconv.* make len append rune + ``` + - this will allow `rune`, but not `int8`, ..., `string`, `float32`, ... \ No newline at end of file diff --git a/rc/rc.go b/rc/rc.go new file mode 100644 index 000000000..ab6cf9aa7 --- /dev/null +++ b/rc/rc.go @@ -0,0 +1,754 @@ +package main + +import ( + "fmt" + "go/ast" + "go/parser" + "go/token" + "log" + "os" + "regexp" + "strconv" + "strings" +) + +const ( + identation = " " +) + +var ( + allowedImp map[string]map[string]bool // Map of the allowed imports + allowedFun map[string]bool // Map of the allowed built-in functions + // Is necessary an array to keep all the call instances. + callX []nodePos // Keeps the name of the called functions and the position in the file. + // A map is enough for function declarations because they are unique. + funcDeclPkg map[string]*funcBody // Keeps the name of the function associated to its body and its position in the file. + allArrayTypes = true + arraysInstances []nodePos + forStmts []nodePos + basicLits []nodePos + illegals []illegal + notAllowedArrayT []string + predeclaredTypes = []string{"bool", "byte", "complex64", "complex128", + "error", "float32", "float64", "int", "int8", + "int16", "int32", "int64", "rune", "string", + "uint", "uint8", "uint16", "uint32", "uint64", + "uintptr", + } + relativeImports []string + importPkg map[string]*pkgFunc + pkgName []string + allImports map[string]bool + openImports []string + funcOccurrences map[string]int +) + +//pkgFunc for all the functions of a given package +type pkgFunc struct { + functions []string + path string +} + +type funcImp struct { + pkg, fun string + pos token.Pos +} + +// All visitors +type callVisitor struct { + Calls []string + Fset *token.FileSet +} + +type fileVisitor struct { + funcDecl []string + funcCalls []string + selectExpr []string + arrayType []nodePos + Fset *token.FileSet +} + +type pkgVisitor struct { + Fset *token.FileSet +} + +type impVisitor struct { + Fset *token.FileSet + relativeImports []string +} + +// Get the position of the node in the file +type locate interface { + getPos(ast.Node) string +} + +func (i *impVisitor) getPos(n ast.Node) string { + return i.Fset.Position(n.Pos()).String() +} + +func (fv *fileVisitor) getPos(n ast.Node) string { + return fv.Fset.Position(n.Pos()).String() +} + +func (p *pkgVisitor) getPos(n ast.Node) string { + return p.Fset.Position(n.Pos()).String() +} +func (c *callVisitor) getPos(n ast.Node) string { + return c.Fset.Position(n.Pos()).String() +} + +type illegal struct { + T string + Name string + Pos string +} + +func (i *illegal) String() string { + return i.T + " " + i.Name + " " + i.Pos +} + +func getPkgFunc(path string, fsetPkg *token.FileSet) { + i := &impVisitor{Fset: fsetPkg} + p := &pkgVisitor{Fset: fsetPkg} + pkgs, err := parser.ParseDir(fsetPkg, path, nil, parser.AllErrors) + + if err != nil { + fmt.Println(err.Error()) + os.Exit(1) + } + + for pkgname := range pkgs { + pkg, _ := ast.NewPackage(fsetPkg, pkgs[pkgname].Files, nil, nil) + pkgName = append(pkgName, pkgname) + + ast.Walk(i, pkg) + ast.Walk(p, pkg) + + for _, v := range i.relativeImports { + if isIn(v, openImports) { + break + } + openImports = append(openImports, v) + getPkgFunc(path+"/"+v, fsetPkg) + } + } + +} + +//reformat from the data base +func splitArgs(args string) []string { + result := strings.Split(args, " ") + return result +} + +func rightFile(args string) string { + expectedFiles := splitArgs(args) + + for _, s := range expectedFiles { + if strings.Contains(s, ".go") { + return s + } + } + return "" +} + +func allowCastingAndImp(allowedImports []string) { + casted := false + for i, v := range allowedImports { + casted = allow(v, casted) + if v == "--no-array" { + allArrayTypes = false + notAllowedArrayT = append(notAllowedArrayT, allowedImports[i+1:]...) + break + } + } +} + +type flags struct { + l struct { // flag for char or string literal + noLit bool // true -> unallows + pattern string // this pattern + } +} + +// TODO: treat all the flags in this function +// For now, only --no-lit="{PATTERN}" +func parseFlags(args []string) *flags { + f := &flags{} + for _, v := range args { + var flag []string + if strings.Contains(v, "=") { + flag = strings.Split(v, "=") + } + if flag == nil { + continue + } + if flag[0] == "--no-lit" { + f.l.noLit = true + f.l.pattern = flag[1] + } + } + return f +} + +func removeAmount(s string) string { + strRm := strings.TrimFunc(s, func(c rune) bool { + return c >= '0' && c <= '9' || c == '#' + }) + return strRm +} + +//compares if the function is used a certain amount of times allowed +func allowedAmount(occurrences map[string]int, allowedImports []string) { + function := "" + funcSelector := "" + for _, v := range allowedImports { + //pkg in case it's a build in function and slice in case it's a selector function + pkg, slice := trimRelativeImport(v) + if slice != nil { + function = strings.Join(slice, ".") + funcSelector = removeAmount(function) + } else { + function = pkg + funcSelector = removeAmount(pkg) + } + if strings.ContainsAny(function, "#") { + strNbr := strings.TrimPrefix(function, funcSelector+"#") + nbr, err := strconv.Atoi(strNbr) + if err != nil { + log.Panic(err) + } + if occurrences[funcSelector] > nbr { + illegals = append(illegals, illegal{ + T: "illegal-amount", + Name: funcSelector + " allowed count " + strNbr + " your count " + strconv.Itoa(occurrences[funcSelector]), + }) + } + } + } +} + +func main() { + if len(os.Args) < 2 { + fmt.Println("No file or directory") + return + } + + var allowedImports []string + + if len(os.Args) > 2 { + allowedImports = splitArgs(os.Args[2]) + } + + allowCastingAndImp(allowedImports) + flag := parseFlags(allowedImports) + + filename := strings.TrimSpace(rightFile(os.Args[1])) + split := strings.Split(filename, "/") + path := strings.Join(split[:len(split)-1], "/") + + if path == "" { + path = "." + } + + fsetFile := token.NewFileSet() + fsetPkg := token.NewFileSet() + + fmt.Println("Parsing") + file, err := parser.ParseFile(fsetFile, filename, nil, parser.AllErrors) + + if err != nil { + fmt.Println(err.Error()) + os.Exit(1) + } + + // Get all the name of all functions declared in the file + w := &fileVisitor{Fset: fsetFile} + ast.Walk(w, file) + getPkgFunc(path, fsetPkg) + + for _, v := range w.funcDecl { + isFuncAllowed(v, fsetPkg) + } + + // TODO: Parsing the arguments for the --max-occurrences flag + allowedAmount(funcOccurrences, allowedImports) + + if flag != nil { + flag.unallowLits() + } + + analyzeArrayT() + analyzeForStmt(allowedImports) + + fmt.Println(identation + "OK") + + fmt.Println("Cheating") + + if len(illegals) > 0 { + for _, i := range illegals { + fmt.Println(identation + i.String()) + } + os.Exit(1) + } else { + fmt.Println(identation + "OK") + } +} + +func (f flags) unallowLits() { + if f.l.noLit { + for _, v := range basicLits { + if !f.isLitAllowed(v.name) { + illegals = append(illegals, illegal{ + T: "illegal-literal", + Name: v.name, + Pos: v.position, + }) + } + } + } +} + +func (f flags) isLitAllowed(s string) bool { + matched, err := regexp.Match(f.l.pattern, []byte(s)) + + if err != nil { + return true + } + + return !matched +} + +func analyzeForStmt(args []string) { + if isIn("--no-for", args) { + for _, v := range forStmts { + illegals = append(illegals, illegal{ + T: "illegal-loop", + Name: v.name, + Pos: v.position, + }) + } + } +} + +func analyzeArrayT() { + if !allArrayTypes { + l := len(notAllowedArrayT) + for _, v := range arraysInstances { + if l == 0 || + isIn(v.name, notAllowedArrayT) { + illegals = append(illegals, illegal{ + T: "illegal-array-type", + Name: v.name, + Pos: v.position, + }) + } + } + } +} + +func allow(s string, casted bool) bool { + if strings.ContainsRune(s, '.') { + allowImport(s) + } else { + if allowedFun == nil { + allowedFun = make(map[string]bool) + } + if strings.ContainsAny(s, "#") { + s = removeAmount(s) + } + allowedFun[s] = true + } + + if s == "--cast" && !casted { + for _, v := range predeclaredTypes { + allow(v, false) + } + return true + } + return casted +} + +// Returns true if the string matches the format of a relative import +func isRelativeImport(s string) bool { + relativeImport, _ := regexp.MatchString(`\.\.\\??`, s) + return relativeImport +} + +// Returns true if the string represents an import package +// i.e and expresion like . +func isImport(s string) bool { + matched, _ := regexp.MatchString(`.\..`, s) + return matched +} + +func trimRelativeImport(str string) (string, []string) { + var pkg string + var slice []string + if isImport(str) && !isRelativeImport(str) { + splited := strings.Split(str, "/") + slice = strings.Split(splited[len(splited)-1], ".") + splited[len(splited)-1] = slice[0] + pkg = strings.Join(splited, "/") + + if allowedImp[slice[0]] == nil { + allowedImp[slice[0]] = make(map[string]bool) + } + fn := slice[len(slice)-1] + allowedImp[slice[0]][fn] = true + } else { + pkg = str + } + return pkg, slice +} + +func allowImport(s string) { + if allowedImp == nil { + allowedImp = make(map[string]map[string]bool) + } + if allImports == nil { + allImports = make(map[string]bool) + } + + pkg, slice := trimRelativeImport(s) + + allImports[pkg] = true + + fn := "*" + if len(slice) > 1 { + fn = removeAmount(slice[1]) + } + + if allowedImp[pkg] == nil { + allowedImp[pkg] = make(map[string]bool) + } + allowedImp[pkg][fn] = true +} + +func addToIllegals(funcname string) { + for _, v := range callX { + if v.name == funcname { + pos := v.position + setIllegal("illegal-call", v.name, pos) + } + } + if funcDeclPkg[funcname] != nil { + pos := funcDeclPkg[funcname].position + setIllegal("illegal-call", funcname, pos) + + } +} + +// First ignoring the imported functions +func isFuncAllowed(funcname string, fset *token.FileSet) bool { + if allowedFun[funcname] { + return true + } + + if !isFuncDeclIn(funcname, funcDeclPkg) { + addToIllegals(funcname) + return false + } + bodyf := funcDeclPkg[funcname].body + + if bodyf == nil { + addToIllegals(funcname) + fmt.Println("Body is nil") + return false + } + c := &callVisitor{Fset: fset} + ast.Walk(c, bodyf) + + res := true + + for _, v := range c.Calls { + if v == funcname { + continue + } + allowed := isFuncAllowed(v, fset) + if !allowed { + addToIllegals(funcname) + for _, v := range c.Calls { + if v == funcname { + continue + } + allowed := isFuncAllowed(v, fset) + if !allowed { + addToIllegals(funcname) + } + res = res && allowed + } + } + res = res && allowed + } + return res +} + +func isFuncDeclIn(funcname string, fundecl map[string]*funcBody) bool { + return fundecl[funcname] != nil +} + +func isFuncCallIn(funcname string, funP []nodePos) bool { + for _, v := range funP { + if v.name == funcname { + return true + } + } + return false +} + +func isIn(s string, slc []string) bool { + for _, v := range slc { + if s == v { + return true + } + } + return false +} + +// Keeps the positions of each function call and declaration +type funcBody struct { + position string + body *ast.BlockStmt +} + +type nodePos struct { + position string + name string +} + +func (fv *fileVisitor) Visit(n ast.Node) ast.Visitor { + fv.checkImport(n) + if ide, ok := n.(*ast.CallExpr); ok { + if opt, ok := ide.Fun.(*ast.Ident); ok { + fv.funcCalls = append(fv.funcCalls, opt.Name) + newFun := nodePos{position: fv.getPos(n), name: opt.Name} + callX = append(callX, newFun) + } + } + + if expr, ok := n.(*ast.SelectorExpr); ok { + if x, ok := expr.X.(*ast.Ident); ok { + fv.selectExpr = append(fv.selectExpr, x.Name+"."+expr.Sel.Name) + + //saves the function in to the map, from the package + if importPkg[x.Name] != nil { + importPkg[x.Name].functions = append(importPkg[x.Name].functions, x.Name+"."+expr.Sel.Name) + } + if funcOccurrences == nil { + funcOccurrences = make(map[string]int) + } + funcOccurrences[x.Name+"."+expr.Sel.Name]++ + } + } + + if ex, ok := n.(*ast.ArrayType); ok { + if op, ok := ex.Elt.(*ast.Ident); ok { + fv.arrayType = append(fv.arrayType, nodePos{ + name: op.Name, + position: fv.getPos(n), + }) + } + + } + + if exp, ok := n.(*ast.FuncDecl); ok { + fv.funcDecl = append(fv.funcDecl, exp.Name.Name) + for _, v := range exp.Type.Params.List { + if _, ok := v.Type.(*ast.FuncType); ok { + if allowedFun == nil { + allowedFun = make(map[string]bool) + } + for _, name := range v.Names { + allowedFun[name.Name] = true + } + } + } + } + + if ex, ok := n.(*ast.AssignStmt); ok { + if exp, ok := ex.Rhs[0].(*ast.FuncLit); ok { + if ide, ok := ex.Lhs[0].(*ast.Ident); ok { + if funcDeclPkg == nil { + funcDeclPkg = make(map[string]*funcBody) + } + funcDeclPkg[ide.Name] = &funcBody{body: exp.Body, position: fv.getPos(n)} + } + } + } + + return fv +} + +func positionIsIn(illegals []illegal, pos string) bool { + for _, v := range illegals { + if v.Pos == pos { + return true + } + } + return false +} + +func (p *pkgVisitor) Visit(n ast.Node) ast.Visitor { + if exp, ok := n.(*ast.FuncDecl); ok { + if funcDeclPkg == nil { + funcDeclPkg = make(map[string]*funcBody) + } + funcDeclPkg[exp.Name.Name] = &funcBody{body: exp.Body, position: p.getPos(n)} + for _, pkg := range pkgName { + if importPkg[pkg] != nil && isIn(pkg+"."+exp.Name.Name, importPkg[pkg].functions) { + funcDeclPkg[pkg+"."+exp.Name.Name] = &funcBody{body: exp.Body, position: p.getPos(n)} + } + } + } + + if ex, ok := n.(*ast.AssignStmt); ok { + if exp, ok := ex.Rhs[0].(*ast.FuncLit); ok { + if ide, ok := ex.Lhs[0].(*ast.Ident); ok { + if funcDeclPkg == nil { + funcDeclPkg = make(map[string]*funcBody) + } + funcDeclPkg[ide.Name] = &funcBody{body: exp.Body, position: p.getPos(n)} + } + } + } + return p +} + +func setIllegal(illegalType, funcName, pos string) { + if !positionIsIn(illegals, pos) { + illegals = append(illegals, illegal{ + T: illegalType, + Name: funcName, + Pos: pos, + }) + } +} + +// Signals that exists at least one callExpr in the node +func (c *callVisitor) Visit(n ast.Node) ast.Visitor { + if id, ok := n.(*ast.BasicLit); ok { + if id.Kind != token.CHAR && id.Kind != token.STRING { + return nil + } + basicLits = append(basicLits, nodePos{position: c.getPos(n), name: id.Value}) + } + + if exp, ok := n.(*ast.CallExpr); ok { + if fun, ok := exp.Fun.(*ast.Ident); ok { + c.Calls = append(c.Calls, fun.Name) + newFun := nodePos{position: c.getPos(n), name: fun.Name} + callX = append(callX, newFun) + if funcOccurrences == nil { + funcOccurrences = make(map[string]int) + } + funcOccurrences[fun.Name]++ + return c + } + } + // SelectorExpr is when we access a value (dot opperator) + // We need to check those for specific functions + if expr, ok := n.(*ast.SelectorExpr); ok { + x, ok := expr.X.(*ast.Ident) + if !ok { + // in this case we are deep in an access + // example, fmt is banned, but pouet isn't. + // we must allow pouet.fmt.x but not fmt.x + // this is the pouet.fmt.x case. + return c + } + pkg := allowedImp[x.Name] + f := x.Name + "." + expr.Sel.Name + if funcDeclPkg[f] != nil { + c.Calls = append(c.Calls, f) + return c + } + + if pkg == nil { + if allImports[x.Name] { + pos := c.getPos(n) + setIllegal("illegal-access", f, pos) + } + return c + } + if !pkg["*"] && !pkg[expr.Sel.Name] { + // all the package is not whiteList and is not explicitly allowed + pos := c.getPos(n) + setIllegal("illegal-access", f, pos) + } + } + + if ex, ok := n.(*ast.ArrayType); ok { + if op, ok := ex.Elt.(*ast.Ident); ok { + arraysInstances = append(arraysInstances, nodePos{ + name: op.Name, + position: c.getPos(n), + }) + } + } + + if _, ok := n.(*ast.ForStmt); ok { + forStmts = append(forStmts, nodePos{ + name: "for", + position: c.getPos(n), + }) + } + + return c +} + +func (fv *fileVisitor) checkImport(n ast.Node) ast.Visitor { + if spec, ok := n.(*ast.ImportSpec); ok { + pkg := spec.Path.Value[1 : len(spec.Path.Value)-1] + if allowedImp[pkg] == nil { + pos := fv.getPos(n) + setIllegal("illegal-import", pkg, pos) + return fv + } + // if the import is named, we need to move it to the new name + name := "" + if spec.Name != nil { + name = spec.Name.Name + } else if strings.ContainsRune(pkg, '/') { + parts := strings.Split(pkg, "/") + name = parts[len(parts)-1] + } + if allowedImp[pkg] != nil { + if name != "" { + allowedImp[name] = allowedImp[pkg] + allowedImp[pkg] = nil + } + } + + if isRelativeImport(pkg) { + if importPkg == nil { + importPkg = make(map[string]*pkgFunc) + } + if name != "" { + importPkg[name] = &pkgFunc{ + path: pkg, + } + } + relativeImports = append(relativeImports, name) + } + } + return fv +} + +func (i *impVisitor) Visit(n ast.Node) ast.Visitor { + if spec, ok := n.(*ast.ImportSpec); ok { + pkg := spec.Path.Value[1 : len(spec.Path.Value)-1] + if allImports == nil { + allImports = make(map[string]bool) + } + pkgSplit := strings.Split(pkg, "/") + + allImports[pkg] = true + allImports[pkgSplit[len(pkgSplit)-1]] = true + + if isRelativeImport(pkg) { + i.relativeImports = append(i.relativeImports, pkg) + } + } + return i +} diff --git a/scripts/configure_ubuntu.sh b/scripts/configure_ubuntu.sh index d0209b350..c73961fb1 100755 --- a/scripts/configure_ubuntu.sh +++ b/scripts/configure_ubuntu.sh @@ -154,7 +154,7 @@ rm -f /swapfile sed -i '/swapfile/d' /etc/fstab # Put temporary and cache folders as tmpfs -echo 'tmpfs /tmp tmpfs defaults,noatime,rw,nosuid,nodev,noexec,mode=1777,size=1G 0 0' >> /etc/fstab +echo 'tmpfs /tmp tmpfs defaults,noatime,rw,nosuid,nodev,mode=1777,size=1G 0 0' >> /etc/fstab # Install additional drivers ubuntu-drivers install ||: diff --git a/scripts/go.sh b/scripts/go.sh index aef473f49..41311ed4e 100755 --- a/scripts/go.sh +++ b/scripts/go.sh @@ -6,9 +6,9 @@ script_dir="$(cd -P "$(dirname "$BASH_SOURCE")" && pwd)" cd $script_dir . set.sh -wget https://dl.google.com/go/go1.13.7.linux-amd64.tar.gz -tar -C /usr/local -xzf go1.13.7.linux-amd64.tar.gz -rm go1.13.7.linux-amd64.tar.gz +wget https://dl.google.com/go/go1.14.linux-amd64.tar.gz +tar -C /usr/local -xzf go1.14.linux-amd64.tar.gz +rm go1.14.linux-amd64.tar.gz echo 'export PATH=$PATH:/usr/local/go/bin' >> /etc/profile # Set-up all users diff --git a/scripts/install-debian.sh b/scripts/install-debian.sh new file mode 100755 index 000000000..f91e86040 --- /dev/null +++ b/scripts/install-debian.sh @@ -0,0 +1,161 @@ +#!/usr/bin/env bash + +# Unofficial Bash Strict Mode +set -euo pipefail +IFS=' +' + +# Debian stable OS +apt-get update +apt-get -y upgrade +apt-get -y dist-upgrade + +# Disable OpenStack SSH malware +mv /home/debian/.ssh/authorized_keys /root/.ssh/authorized_keys ||: +sed -i '/Generated-by-Nova/d' /root/.ssh/authorized_keys ||: +chown root:root /root/.ssh/authorized_keys ||: + +# Terminal goodies +touch .hushlogin + +cat <<'EOF'>> /root/.bashrc +export LS_OPTIONS="--color=auto" +eval "`dircolors`" + +alias ctop="docker run --rm -it --name=ctop -v /var/run/docker.sock:/var/run/docker.sock:ro quay.io/vektorlab/ctop" +alias df="df --si" +alias du="du -cs --si" +alias free="free -h --si" +alias l="ls $LS_OPTIONS -al --si --group-directories-first" +alias less="less -i" +alias nano="nano -clDOST4" +alias pstree="pstree -palU" +alias gobuild='CGO_ENABLED=0 GOARCH=amd64 go build -trimpath -ldflags="-s -w"' + +export HISTFILESIZE= +export HISTSIZE= +export HISTTIMEFORMAT="%F %T " + +GOPATH=$HOME/go +HISTCONTROL=ignoreboth +HISTFILESIZE= +HISTSIZE= +HISTTIMEFORMAT="%F %T " +EOF + +cat <> /etc/inputrc +set completion-ignore-case +set show-all-if-ambiguous On +set show-all-if-unmodified On +EOF + +cat <> /etc/bash.bashrc +if ! shopt -oq posix; then + if [ -f /usr/share/bash-completion/bash_completion ]; then + . /usr/share/bash-completion/bash_completion + elif [ -f /etc/bash_completion ]; then + . /etc/bash_completion + fi +fi +EOF + +# Basic packages +apt-get -y install man bash-completion git ufw jq curl build-essential netcat wget psmisc lz4 file net-tools brotli unzip zip moreutils xauth sysfsutils rsync iperf pv tree mc screen + +# Configure screen +cat <<'EOF'>> /etc/screenrc +startup_message off +shell -$SHELL +defscrollback 100000 +bind l eval clear "scrollback 0" "scrollback 100000" +EOF + +# Configure SSH +cat <> /etc/ssh/sshd_config +Port 521 +PasswordAuthentication no +AllowUsers root +X11UseLocalhost no +EOF +service ssh restart + +touch /root/.Xauthority + +# Firewall +ufw allow in 80/tcp +ufw allow in 443/tcp +ufw allow in 521/tcp +ufw logging off +ufw --force enable +ufw --force delete 4 +ufw --force delete 4 +ufw --force delete 4 + +# Optimize +systemctl disable unattended-upgrades.service apt-daily.timer apt-daily-upgrade.timer console-setup.service keyboard-setup.service remote-fs.target man-db.timer systemd-timesyncd.service +apt-get -y purge apparmor +sed -i 's/MODULES=most/MODULES=dep/g' /etc/initramfs-tools/initramfs.conf +sed -i 's/COMPRESS=gzip/COMPRESS=lz4/g' /etc/initramfs-tools/initramfs.conf +update-initramfs -u +echo 'GRUB_TIMEOUT=0' >> /etc/default/grub +update-grub +apt-get -y purge exim\* + +for i in $(seq 0 $(nproc --ignore 1)); do + echo "devices/system/cpu/cpu${i}/cpufreq/scaling_governor = performance" >> /etc/sysfs.conf +done + +# Disable sleep when closing laptop screen +echo HandleLidSwitch=ignore >> /etc/systemd/logind.conf + +# noatime +sed -i 's| / ext4 | / ext4 noatime,|g' /etc/fstab + +# Disable swap +swapoff -a +sed -i '/swap/d' /etc/fstab + +# node.JS & yarn +curl -sL https://deb.nodesource.com/setup_12.x | bash - +apt-get -y install nodejs +curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - +echo "deb https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list +apt-get update +apt-get -y install yarn + +# Docker +apt-get -y install apt-transport-https ca-certificates curl gnupg2 software-properties-common +curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add - +add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable" +apt-get update +apt-get -y install docker-ce docker-ce-cli containerd.io + +# ripgrep +curl -LO https://github.com/BurntSushi/ripgrep/releases/download/11.0.2/ripgrep_11.0.2_amd64.deb +dpkg -i ripgrep_11.0.2_amd64.deb +rm ripgrep_11.0.2_amd64.deb + +# Go +wget https://dl.google.com/go/go1.14.linux-amd64.tar.gz +tar -C /usr/local -xzf go1.14.linux-amd64.tar.gz +rm go1.14.linux-amd64.tar.gz +echo 'export PATH=$PATH:/usr/local/go/bin' >> /etc/profile + +# Netdata +# bash <(curl -Ss https://my-netdata.io/kickstart-static64.sh) --no-updates --stable-channel --disable-telemetry + +# Caddy +curl https://getcaddy.com | bash -s personal http.ipfilter + +# Generate SSH key +ssh-keygen -ted25519 -f ~/.ssh/id_ed25519 -N '' + +# Cleanup +sed -i '/^deb-src/d' /etc/apt/sources.list +apt-get update +apt-get -y purge unattended-upgrades +apt-get -y autoremove --purge +apt-get clean + +# The end +reboot diff --git a/subjects/abort.en.md b/subjects/abort.en.md index dd2db0fe3..d7b7be872 100644 --- a/subjects/abort.en.md +++ b/subjects/abort.en.md @@ -14,7 +14,7 @@ func Abort(a, b, c, d, e int) int { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/abort.fr.md b/subjects/abort.fr.md index 964905702..94b837a70 100644 --- a/subjects/abort.fr.md +++ b/subjects/abort.fr.md @@ -14,7 +14,7 @@ func Abort(a, b, c, d, e int) int { ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main diff --git a/subjects/activebits.en.md b/subjects/activebits.en.md index 4a6e7393b..f5e7ad220 100644 --- a/subjects/activebits.en.md +++ b/subjects/activebits.en.md @@ -14,7 +14,7 @@ func ActiveBits(n int) uint { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/activebits.fr.md b/subjects/activebits.fr.md index 6e3962903..b3bbc65fc 100644 --- a/subjects/activebits.fr.md +++ b/subjects/activebits.fr.md @@ -14,7 +14,7 @@ func ActiveBits(n int) uint { ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main diff --git a/subjects/addlinkednumbers.en.md b/subjects/addlinkednumbers.en.md index 1daf1d0ae..70481c4e9 100644 --- a/subjects/addlinkednumbers.en.md +++ b/subjects/addlinkednumbers.en.md @@ -27,7 +27,7 @@ type NodeAddL struct { Num int } -func AddLinkedNumbers(num1, num1 *NodeAddL) *NodeAddL { +func AddLinkedNumbers(num1, num2 *NodeAddL) *NodeAddL { } ``` @@ -40,12 +40,11 @@ Here is a possible program to test your function: package main import ( - "fmt" + "fmt" ) func pushFront(node *NodeAddL, num int) *NodeAddL { - // ... - // Write yourself + } func main() { diff --git a/subjects/addprimesum.en.md b/subjects/addprimesum.en.md index f11d99434..4143acaf5 100644 --- a/subjects/addprimesum.en.md +++ b/subjects/addprimesum.en.md @@ -4,7 +4,7 @@ Write a program that takes a positive integer as argument and displays the sum of all prime numbers inferior or equal to it followed by a newline (`'\n'`). -- If the number of arguments is different from 1, or if the argument is not a positive number, the program displays `0` followed by a newline. +- If the number of arguments is different from 1, or if the argument is not a positive number, the program displays `0` followed by a newline. ### Usage @@ -14,6 +14,12 @@ student@ubuntu:~/[[ROOT]]/test$ ./test 5 10 student@ubuntu:~/[[ROOT]]/test$ ./test 7 17 +student@ubuntu:~/[[ROOT]]/test$ ./test -2 +0 +student@ubuntu:~/[[ROOT]]/test$ ./test 0 +0 +student@ubuntu:~/[[ROOT]]/test$ ./test +0 student@ubuntu:~/[[ROOT]]/test$ ./test 5 7 0 student@ubuntu:~/[[ROOT]]/test$ diff --git a/subjects/addprimesum.fr.md b/subjects/addprimesum.fr.md index c8b06eee4..8c431d06f 100644 --- a/subjects/addprimesum.fr.md +++ b/subjects/addprimesum.fr.md @@ -4,7 +4,7 @@ Écrire un programme qui prend un entier positif comme argument et qui affiche la somme de tous les nombres premiers inférieurs ou égaux à celui-ci, suivie d'un retour à la ligne (`'\n'`). -- Si le nombre d'arguments est différent de 1, ou si l'argument n'est pas un nombre positif, le programme affiche `0` suivi d'un retour à la ligne. +- Si le nombre d'arguments est différent de 1, ou si l'argument n'est pas un nombre positif, le programme affiche `0` suivi d'un retour à la ligne. ### Utilisation diff --git a/subjects/advancedsortwordarr.en.md b/subjects/advancedsortwordarr.en.md index 562793381..10168e531 100644 --- a/subjects/advancedsortwordarr.en.md +++ b/subjects/advancedsortwordarr.en.md @@ -14,7 +14,7 @@ func AdvancedSortWordArr(array []string, f func(a, b string) int) { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/advancedsortwordarr.fr.md b/subjects/advancedsortwordarr.fr.md index a1ae8a3b1..c4fcb75e8 100644 --- a/subjects/advancedsortwordarr.fr.md +++ b/subjects/advancedsortwordarr.fr.md @@ -14,7 +14,7 @@ func AdvancedSortWordArr(array []string, f func(a, b string) int) { ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main diff --git a/subjects/alphacount.en.md b/subjects/alphacount.en.md index 8895e8c2d..da478b4f3 100644 --- a/subjects/alphacount.en.md +++ b/subjects/alphacount.en.md @@ -17,7 +17,7 @@ func AlphaCount(str string) int { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/alphacount.fr.md b/subjects/alphacount.fr.md index 8895e8c2d..da478b4f3 100644 --- a/subjects/alphacount.fr.md +++ b/subjects/alphacount.fr.md @@ -17,7 +17,7 @@ func AlphaCount(str string) int { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/anagram.en.md b/subjects/anagram.en.md index 619eb2719..e46cd6dd8 100644 --- a/subjects/anagram.en.md +++ b/subjects/anagram.en.md @@ -34,23 +34,24 @@ Here is a possible program to test your function: ```go package main + import ( - piscine ".." - "fmt" + piscine ".." + "fmt" ) func main() { - test1 := piscine.IsAnagram("listen", "silent") - fmt.Println(test1) + test1 := piscine.IsAnagram("listen", "silent") + fmt.Println(test1) - test2 := piscine.IsAnagram("alem", "school") - fmt.Println(test2) + test2 := piscine.IsAnagram("alem", "school") + fmt.Println(test2) - test3 := piscine.IsAnagram("neat", "a net") - fmt.Println(test3) + test3 := piscine.IsAnagram("neat", "a net") + fmt.Println(test3) - test4 := piscine.IsAnagram("anna madrigal", "a man and a girl") - fmt.Println(test4) + test4 := piscine.IsAnagram("anna madrigal", "a man and a girl") + fmt.Println(test4) } ``` @@ -63,4 +64,4 @@ true false true true -``` \ No newline at end of file +``` diff --git a/subjects/any.en.md b/subjects/any.en.md index 2fcca7fee..8b2f5d36f 100644 --- a/subjects/any.en.md +++ b/subjects/any.en.md @@ -4,7 +4,7 @@ Write a function `Any` that returns `true`, for a `string` array : -- if, when that `string` array is passed through an `f` function, at least one element returns `true`. +- if, when that `string` array is passed through an `f` function, at least one element returns `true`. ### Expected function @@ -16,7 +16,7 @@ func Any(f func(string) bool, arr []string) bool { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/any.fr.md b/subjects/any.fr.md index a783a4aa6..9e2dc88ec 100644 --- a/subjects/any.fr.md +++ b/subjects/any.fr.md @@ -16,7 +16,7 @@ func Any(f func(string) bool, arr []string) bool { ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main diff --git a/subjects/appendrange.en.md b/subjects/appendrange.en.md index b5bd235a6..2029de17d 100644 --- a/subjects/appendrange.en.md +++ b/subjects/appendrange.en.md @@ -20,7 +20,7 @@ func AppendRange(min, max int) []int { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/appendrange.fr.md b/subjects/appendrange.fr.md index 669683023..66f0b91d5 100644 --- a/subjects/appendrange.fr.md +++ b/subjects/appendrange.fr.md @@ -20,7 +20,7 @@ func AppendRange(min, max int) []int { ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main diff --git a/subjects/ascii-art-web/ascii-art-web-export-file.audit.en.md b/subjects/ascii-art-web/ascii-art-web-export-file.audit.en.md index 94e509f57..a2473e9c3 100644 --- a/subjects/ascii-art-web/ascii-art-web-export-file.audit.en.md +++ b/subjects/ascii-art-web/ascii-art-web-export-file.audit.en.md @@ -6,7 +6,7 @@ ###### Does the exported file matches the output? ##### Try to open and change the exported file. -###### Are the exported files read and write for the user only? +###### Are the exported files read and write for the user? ###### Does the project use the HTTP header [Content-Type](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Type) to indicate the media type of the resource? diff --git a/subjects/ascii-art-web/ascii-art-web.audit.en.md b/subjects/ascii-art-web/ascii-art-web.audit.en.md index 058b06e69..bfa1cf362 100644 --- a/subjects/ascii-art-web/ascii-art-web.audit.en.md +++ b/subjects/ascii-art-web/ascii-art-web.audit.en.md @@ -73,8 +73,8 @@ o-o-o o--o o-o o o o o-o | | o o ##### Try to navigate between all the available pages in the website. ###### Are all the pages working? Does the project implement [404 status](https://www.restapitutorial.com/httpstatuscodes.html)? -###### Does the project implement HTTP status [400 bad request](https://kinsta.com/knowledgebase/400-bad-request/#causes)? -###### Does the project implement HTTP status [500 internal server error](https://www.restapitutorial.com/httpstatuscodes.html)? +###### Does the project handle [HTTP status 400 - Bad Request](https://kinsta.com/knowledgebase/400-bad-request/#causes)? +###### Does the project handle [HTTP status 500 - Internal Server Errors](https://www.restapitutorial.com/httpstatuscodes.html)? ##### Try making a request to the server (clicking a button to generate the ascii-art representation on the website) ###### Is the communication between [server and client](https://www.geeksforgeeks.org/client-server-model/) well established? diff --git a/subjects/atoi.en.md b/subjects/atoi.en.md index 485dd295e..5a8738a2d 100644 --- a/subjects/atoi.en.md +++ b/subjects/atoi.en.md @@ -2,13 +2,13 @@ ### Instructions -- Write a [function](TODO-LINK) that simulates the behaviour of the `Atoi` function in Go. `Atoi` transforms a number represented as a `string` in a number represented as an `int`. +- Write a function that simulates the behaviour of the `Atoi` function in Go. `Atoi` transforms a number represented as a `string` in a number represented as an `int`. -- `Atoi` returns `0` if the `string` is not considered as a valid number. For this exercise **non-valid `string` chains will be tested**. Some will contain non-digits characters. +- `Atoi` returns `0` if the `string` is not considered as a valid number. For this exercise **non-valid `string` chains will be tested**. Some will contain non-digits characters. -- For this exercise the handling of the signs + or - **does have** to be taken into account. +- For this exercise the handling of the signs + or - **does have** to be taken into account. -- This function will **only** have to return the `int`. For this exercise the `error` result of atoi is not required. +- This function will **only** have to return the `int`. For this exercise the `error` result of atoi is not required. ### Expected function @@ -20,7 +20,7 @@ func Atoi(s string) int { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/atoi.fr.md b/subjects/atoi.fr.md index 59fe80c4d..44aca8e0e 100644 --- a/subjects/atoi.fr.md +++ b/subjects/atoi.fr.md @@ -2,13 +2,13 @@ ### Instructions -- Écrire une fonction qui reproduit le comportement de la fonction `Atoi` en Go. `Atoi` transforme un nombre représenté en `string` (chaîne de caractères) en `int` (entier). +- Écrire une fonction qui reproduit le comportement de la fonction `Atoi` en Go. `Atoi` transforme un nombre représenté en `string` (chaîne de caractères) en `int` (entier). -- `Atoi` retourne `0` si la `string` n'est pas considéré un nombre valide. Pour cet exercice des **`string` non valides seront testées!**. Certaines contiendront d'autres caractères que des chiffres. +- `Atoi` retourne `0` si la `string` n'est pas considéré un nombre valide. Pour cet exercice des **`string` non valides seront testées!**. Certaines contiendront d'autres caractères que des chiffres. -- Pour cet exercice la gestion des signes + ou - **doit être** prise en compte. +- Pour cet exercice la gestion des signes + ou - **doit être** prise en compte. -- Cette fonction aura **seulement** à retourner l'`int` (entier). Pour cet exercice le retour d'erreur d'atoi de go n'est pas demandé. +- Cette fonction aura **seulement** à retourner l'`int` (entier). Pour cet exercice le retour d'erreur d'atoi de go n'est pas demandé. ### Fonction attendue @@ -20,7 +20,7 @@ func Atoi(s string) int { ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main diff --git a/subjects/atoibase.en.md b/subjects/atoibase.en.md index 8674ec303..af936db7a 100644 --- a/subjects/atoibase.en.md +++ b/subjects/atoibase.en.md @@ -28,7 +28,7 @@ func AtoiBase(s string, base string) int { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/atoibase.fr.md b/subjects/atoibase.fr.md index 334841b6b..096bca6a8 100644 --- a/subjects/atoibase.fr.md +++ b/subjects/atoibase.fr.md @@ -8,9 +8,9 @@ Si la base n'est pas valide elle retourne `0`: Règles de validité d'une base : -- Une base doit contenir au moins 2 caractères. -- Chaque caractère d'une base doit être unique. -- Une base ne doit pas contenir les caractères `+` ou `-`. +- Une base doit contenir au moins 2 caractères. +- Chaque caractère d'une base doit être unique. +- Une base ne doit pas contenir les caractères `+` ou `-`. Seuls des nombres en `string` valides seront testés. @@ -26,7 +26,7 @@ func AtoiBase(s string, base string) int { ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main diff --git a/subjects/atoibaseprog.en.md b/subjects/atoibaseprog.en.md index 9dbc79a8a..1740f542e 100644 --- a/subjects/atoibaseprog.en.md +++ b/subjects/atoibaseprog.en.md @@ -15,13 +15,13 @@ This means that: Write a function that takes a `string` number and its `string` base in parameters and returns its conversion as an `int`. -If the base or the `string` number is not valid it returns `0`: +If the base or the `string` number is not valid it returns `0` Validity rules for a base : -- A base must contain at least 2 characters. -- Each character of a base must be unique. -- A base should not contain `+` or `-` characters. +- A base must contain at least 2 characters. +- Each character of a base must be unique. +- A base should not contain `+` or `-` characters. Only valid `string` numbers will be tested. @@ -37,7 +37,7 @@ func AtoiBase(s string, base string) int { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/atoibaseprog.fr.md b/subjects/atoibaseprog.fr.md index a3b8a9ad7..b90290768 100644 --- a/subjects/atoibaseprog.fr.md +++ b/subjects/atoibaseprog.fr.md @@ -19,9 +19,9 @@ Si la base n'est pas valide elle retourne `0`: Règles de validité d'une base : -- Une base doit contenir au moins 2 caractères. -- Chaque caractère d'une base doit être unique. -- Une base ne doit pas contenir les caractères `+` ou `-`. +- Une base doit contenir au moins 2 caractères. +- Chaque caractère d'une base doit être unique. +- Une base ne doit pas contenir les caractères `+` ou `-`. Seuls des nombres en `string` valides seront testés. @@ -37,7 +37,7 @@ func AtoiBase(s string, base string) int { ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main diff --git a/subjects/atoiprog.en.md b/subjects/atoiprog.en.md index d270f821e..3355f3f58 100644 --- a/subjects/atoiprog.en.md +++ b/subjects/atoiprog.en.md @@ -13,13 +13,13 @@ This means that: ### Instructions -- Write a [function](TODO-LINK) that simulates the behaviour of the `Atoi` function in Go. `Atoi` transforms a number represented as a `string` in a number represented as an `int`. +- Write a function that simulates the behaviour of the `Atoi` function in Go. `Atoi` transforms a number represented as a `string` in a number represented as an `int`. -- `Atoi` returns `0` if the `string` is not considered as a valid number. For this exercise **non-valid `string` chains will be tested**. Some will contain non-digits characters. +- `Atoi` returns `0` if the `string` is not considered as a valid number. For this exercise **non-valid `string` chains will be tested**. Some will contain non-digits characters. -- For this exercise the handling of the signs + or - **does have** to be taken into account. +- For this exercise the handling of the signs + or - **does have** to be taken into account. -- This function will **only** have to return the `int`. For this exercise the `error` result of atoi is not required. +- This function will **only** have to return the `int`. For this exercise the `error` result of atoi is not required. ### Expected function @@ -31,7 +31,7 @@ func Atoi(s string) int { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/balancedstring.en.md b/subjects/balancedstring.en.md index c42e7d5df..e9b589a85 100644 --- a/subjects/balancedstring.en.md +++ b/subjects/balancedstring.en.md @@ -4,7 +4,8 @@ Balanced string is a string that has equal quantity of 'C' and 'D' characters. -Write a program that takes a string and outputs maximum amount of balanced strings with `\n` at the end of line. +Write a program that takes a string and outputs maximum amount of balanced strings without ignoring any letters. +Display output with `\n` at the end of line. If the number of arguments is not 1, display `\n`. diff --git a/subjects/basicatoi.en.md b/subjects/basicatoi.en.md index a78aa6987..6fcca0fc3 100644 --- a/subjects/basicatoi.en.md +++ b/subjects/basicatoi.en.md @@ -2,13 +2,13 @@ ### Instructions -- Write a function that simulates the behaviour of the atoi function in Go. Atoi transforms a number defined as a `string` in a number defined as an `int`. +- Write a function that simulates the behaviour of the atoi function in Go. Atoi transforms a number defined as a `string` in a number defined as an `int`. -- Atoi returns `0` if the `string` is not considered as a valid number. For this exercise **only valid** `string` chains will be tested. They will only contain one or several digits as characters. +- Atoi returns `0` if the `string` is not considered as a valid number. For this exercise **only valid** `string` chains will be tested. They will only contain one or several digits as characters. -- For this exercise the handling of the signs `+` or `-` does not have to be taken into account. +- For this exercise the handling of the signs `+` or `-` does not have to be taken into account. -- This function will **only** have to return the `int`. For this exercise the `error` return of atoi is not required. +- This function will **only** have to return the `int`. For this exercise the `error` return of atoi is not required. ### Expected function @@ -20,7 +20,7 @@ func BasicAtoi(s string) int { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/basicatoi.fr.md b/subjects/basicatoi.fr.md index 510cf1bed..9a68092c8 100644 --- a/subjects/basicatoi.fr.md +++ b/subjects/basicatoi.fr.md @@ -2,13 +2,13 @@ ### Instructions -- Écrire une fonction qui reproduit le comportement de la fonction atoi en Go. Atoi transforme un nombre représenté en `string` (chaîne de caractères) en `int` (entier). +- Écrire une fonction qui reproduit le comportement de la fonction atoi en Go. Atoi transforme un nombre représenté en `string` (chaîne de caractères) en `int` (entier). -- Atoi retourne `0` si la `string` n'est pas considéré un nombre valide. Pour cet exercice **seulement des** `string` **valides** seront testées. Elles ne contiendront que un ou plusieurs chiffres comme charact. +- Atoi retourne `0` si la `string` n'est pas considéré un nombre valide. Pour cet exercice **seulement des** `string` **valides** seront testées. Elles ne contiendront que un ou plusieurs chiffres comme charact. -- Pour cet exercice la gestion des signes `+` ou `-` ne doit pas être prise en compte. +- Pour cet exercice la gestion des signes `+` ou `-` ne doit pas être prise en compte. -- Cette fonction aura **seulement** à retourner l'`int` (entier). Pour cet exercice le retour d'erreur d'atoi de go n'est pas demandé. +- Cette fonction aura **seulement** à retourner l'`int` (entier). Pour cet exercice le retour d'erreur d'atoi de go n'est pas demandé. ### Fonction attendue @@ -20,7 +20,7 @@ func BasicAtoi(s string) int { ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main diff --git a/subjects/basicatoi2.en.md b/subjects/basicatoi2.en.md index 347ea9fdb..78a812f5e 100644 --- a/subjects/basicatoi2.en.md +++ b/subjects/basicatoi2.en.md @@ -2,13 +2,13 @@ ### Instructions -- Write a function that simulates the behaviour of the atoi function in Go. Atoi transforms a number defined as a `string` in a number defined as an `int`. +- Write a function that simulates the behaviour of the atoi function in Go. Atoi transforms a number defined as a `string` in a number defined as an `int`. -- Atoi returns `0` if the `string` is not considered as a valid number. For this exercise **non-valid `string` chains will be tested**. Some will contain non-digits characters. +- Atoi returns `0` if the `string` is not considered as a valid number. For this exercise **non-valid `string` chains will be tested**. Some will contain non-digits characters. -- For this exercise the handling of the signs `+` or `-` does not have to be taken into account. +- For this exercise the handling of the signs `+` or `-` does not have to be taken into account. -- This function will **only** have to return the `int`. For this exercise the `error` return of atoi is not required. +- This function will **only** have to return the `int`. For this exercise the `error` return of atoi is not required. ### Expected function @@ -20,7 +20,7 @@ func BasicAtoi2(s string) int { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/basicatoi2.fr.md b/subjects/basicatoi2.fr.md index 61246a18c..67e6a3b5d 100644 --- a/subjects/basicatoi2.fr.md +++ b/subjects/basicatoi2.fr.md @@ -2,13 +2,13 @@ ### Instructions -- Écrire une fonction qui reproduit le comportement de la fonction atoi en Go. Atoi transforme un nombre représenté en `string` (chaîne de caractères) en `int` (entier). +- Écrire une fonction qui reproduit le comportement de la fonction atoi en Go. Atoi transforme un nombre représenté en `string` (chaîne de caractères) en `int` (entier). -- Atoi retourne `0` si la `string` n'est pas considérée comme un nombre valide. Pour cet exercice des **`string` non valides seront testées!**. Certaines contiendront d'autres caractères que des chiffres. +- Atoi retourne `0` si la `string` n'est pas considérée comme un nombre valide. Pour cet exercice des **`string` non valides seront testées!**. Certaines contiendront d'autres caractères que des chiffres. -- Pour cet exercice la gestion des signes `+` ou `-` ne doit pas être prise en compte. +- Pour cet exercice la gestion des signes `+` ou `-` ne doit pas être prise en compte. -- Cette fonction aura **seulement** à retourner l'`int` (entier). Pour cet exercice le retour d'erreur d'atoi de go n'est pas demandé. +- Cette fonction aura **seulement** à retourner l'`int` (entier). Pour cet exercice le retour d'erreur d'atoi de go n'est pas demandé. ### Fonction attendue @@ -20,7 +20,7 @@ func BasicAtoi2(s string) int { ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main diff --git a/subjects/basicjoin.en.md b/subjects/basicjoin.en.md index 869c538b1..f04104468 100644 --- a/subjects/basicjoin.en.md +++ b/subjects/basicjoin.en.md @@ -14,7 +14,7 @@ func BasicJoin(strs []string) string { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/basicjoin.fr.md b/subjects/basicjoin.fr.md index a350c684a..4a4b1a65e 100644 --- a/subjects/basicjoin.fr.md +++ b/subjects/basicjoin.fr.md @@ -14,7 +14,7 @@ func BasicJoin(strs []string) string { ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main diff --git a/subjects/boolean.en.md b/subjects/boolean.en.md index c83c28574..cff70f99d 100644 --- a/subjects/boolean.en.md +++ b/subjects/boolean.en.md @@ -4,11 +4,11 @@ Create a `.go` file. -- The code below has to be copied in that file. +- The code below has to be copied in that file. -- The necessary changes have to be applied so that the program works. +- The necessary changes have to be applied so that the program works. -- The program must be submitted inside a folder with the name `boolean`. +- The program must be submitted inside a folder with the name `boolean`. ### Code to be copied diff --git a/subjects/boolean.fr.md b/subjects/boolean.fr.md index 1d8573364..35314bf7c 100644 --- a/subjects/boolean.fr.md +++ b/subjects/boolean.fr.md @@ -4,11 +4,11 @@ Créer un fichier `.go`. -- Le code ci-dessous doit être copié dans ce fichier. +- Le code ci-dessous doit être copié dans ce fichier. -- Les changements nécéssaires doivent être appliqués pour que le programme fonctionne. +- Les changements nécéssaires doivent être appliqués pour que le programme fonctionne. -- Le programme doit être rendu dans un dossier nommé `boolean`. +- Le programme doit être rendu dans un dossier nommé `boolean`. ### Code à copier diff --git a/subjects/brainfuck.en.md b/subjects/brainfuck.en.md index 5cf1dd5e8..32cd78308 100644 --- a/subjects/brainfuck.en.md +++ b/subjects/brainfuck.en.md @@ -9,13 +9,13 @@ The code will always be valid, with less than 4096 operations. Every operator consists of a single character : -- '>' increment the pointer -- '<' decrement the pointer -- '+' increment the pointed byte -- '-' decrement the pointed byte -- '.' print the pointed byte on standard output -- '[' go to the matching ']' if the pointed byte is 0 (loop start) -- ']' go to the matching '[' if the pointed byte is not 0 (loop end) +- '>' increment the pointer +- '<' decrement the pointer +- '+' increment the pointed byte +- '-' decrement the pointed byte +- '.' print the pointed byte on standard output +- '[' go to the matching ']' if the pointed byte is 0 (loop start) +- ']' go to the matching '[' if the pointed byte is not 0 (loop end) Any other character is a comment. diff --git a/subjects/brainfuck.fr.md b/subjects/brainfuck.fr.md index 988cec7e8..32871e9ba 100644 --- a/subjects/brainfuck.fr.md +++ b/subjects/brainfuck.fr.md @@ -9,13 +9,13 @@ Le `Brainfuck` est un langage minimaliste. Il consiste en un slice de `byte` (oc Chaque opérateur consiste en un seul caractère : -- '>' incrémente le pointeur -- '<' décrémente le pointeur -- '+' incrémente le byte pointé -- '-' décrémente le byte pointé -- '.' affiche le byte pointé sur la sortie standard -- '[' se rend à son ']' correspondant si le byte pointé est 0 (début de la boucle) -- ']' se rend à son '[' correspondant si le byte pointé n'est pas 0 (fin de la boucle) +- '>' incrémente le pointeur +- '<' décrémente le pointeur +- '+' incrémente le byte pointé +- '-' décrémente le byte pointé +- '.' affiche le byte pointé sur la sortie standard +- '[' se rend à son ']' correspondant si le byte pointé est 0 (début de la boucle) +- ']' se rend à son '[' correspondant si le byte pointé n'est pas 0 (fin de la boucle) Tout autre caractère est un commentaire. diff --git a/subjects/btreeapplybylevel.en.md b/subjects/btreeapplybylevel.en.md index 7519b0b30..47e6216b2 100644 --- a/subjects/btreeapplybylevel.en.md +++ b/subjects/btreeapplybylevel.en.md @@ -14,7 +14,7 @@ func BTreeApplyByLevel(root *TreeNode, f func(...interface{}) (int, error)) { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/btreeapplybylevel.fr.md b/subjects/btreeapplybylevel.fr.md index 49e7d1030..5fa5f6dc8 100644 --- a/subjects/btreeapplybylevel.fr.md +++ b/subjects/btreeapplybylevel.fr.md @@ -14,7 +14,7 @@ func BTreeApplyByLevel(root *TreeNode, fn interface{}) { ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main diff --git a/subjects/btreeapplyinorder.en.md b/subjects/btreeapplyinorder.en.md index debf4df75..e78f7ea15 100644 --- a/subjects/btreeapplyinorder.en.md +++ b/subjects/btreeapplyinorder.en.md @@ -14,14 +14,14 @@ func BTreeApplyInorder(root *TreeNode, f func(...interface{}) (int, error)) { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main import ( - "fmt" - piscine ".." + "fmt" + piscine ".." ) func main() { diff --git a/subjects/btreeapplyinorder.fr.md b/subjects/btreeapplyinorder.fr.md index 29e9042eb..2eba00758 100644 --- a/subjects/btreeapplyinorder.fr.md +++ b/subjects/btreeapplyinorder.fr.md @@ -14,14 +14,14 @@ func BTreeApplyInorder(root *TreeNode, f func(...interface{}) (int, error)) { ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main import ( - "fmt" - piscine ".." + "fmt" + piscine ".." ) func main() { diff --git a/subjects/btreeapplypostorder.en.md b/subjects/btreeapplypostorder.en.md index 13f514a6d..ab5a245fc 100644 --- a/subjects/btreeapplypostorder.en.md +++ b/subjects/btreeapplypostorder.en.md @@ -14,14 +14,14 @@ func BTreeApplyPostorder(root *TreeNode, f func(...interface{}) (int, error)) { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main import ( - "fmt" - piscine ".." + "fmt" + piscine ".." ) func main() { diff --git a/subjects/btreeapplypostorder.fr.md b/subjects/btreeapplypostorder.fr.md index 297d87ce8..3d0a2dc23 100644 --- a/subjects/btreeapplypostorder.fr.md +++ b/subjects/btreeapplypostorder.fr.md @@ -14,14 +14,14 @@ func BTreeApplyPostorder(root *piscine.TreeNode, f func(...interface{}) (int, er ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main import ( - "fmt" - piscine "." + "fmt" + piscine "." ) func main() { diff --git a/subjects/btreeapplypreorder.en.md b/subjects/btreeapplypreorder.en.md index 0f3383ab9..79518befd 100644 --- a/subjects/btreeapplypreorder.en.md +++ b/subjects/btreeapplypreorder.en.md @@ -14,7 +14,7 @@ func BTreeApplyPreorder(root *TreeNode, f func(...interface{}) (int, error)) { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/btreeapplypreorder.fr.md b/subjects/btreeapplypreorder.fr.md index 55d3c02df..3b8e6373c 100644 --- a/subjects/btreeapplypreorder.fr.md +++ b/subjects/btreeapplypreorder.fr.md @@ -14,7 +14,7 @@ func BTreeApplyPreorder(root *TreeNode, f func(...interface{}) (int, error)) { ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main diff --git a/subjects/btreedeletenode.en.md b/subjects/btreedeletenode.en.md index 46389306c..2c90da5c8 100644 --- a/subjects/btreedeletenode.en.md +++ b/subjects/btreedeletenode.en.md @@ -16,7 +16,7 @@ func BTreeDeleteNode(root, node *TreeNode) *TreeNode { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/btreedeletenode.fr.md b/subjects/btreedeletenode.fr.md index 008bb0c99..91a8954c4 100644 --- a/subjects/btreedeletenode.fr.md +++ b/subjects/btreedeletenode.fr.md @@ -16,7 +16,7 @@ func BTreeDeleteNode(root, node *TreeNode) *TreeNode { ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main diff --git a/subjects/btreeinsertdata.en.md b/subjects/btreeinsertdata.en.md index fd15db5d5..1a35ba5ce 100644 --- a/subjects/btreeinsertdata.en.md +++ b/subjects/btreeinsertdata.en.md @@ -21,25 +21,25 @@ func BTreeInsertData(root *TreeNode, data string) *TreeNode { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main import ( - "fmt" - piscine ".." + "fmt" + piscine ".." ) func main() { - root := &piscine.TreeNode{Data: "4"} - piscine.BTreeInsertData(root, "1") - piscine.BTreeInsertData(root, "7") - piscine.BTreeInsertData(root, "5") - fmt.Println(root.Left.Data) - fmt.Println(root.Data) - fmt.Println(root.Right.Left.Data) - fmt.Println(root.Right.Data) + root := &piscine.TreeNode{Data: "4"} + piscine.BTreeInsertData(root, "1") + piscine.BTreeInsertData(root, "7") + piscine.BTreeInsertData(root, "5") + fmt.Println(root.Left.Data) + fmt.Println(root.Data) + fmt.Println(root.Right.Left.Data) + fmt.Println(root.Right.Data) } ``` diff --git a/subjects/btreeinsertdata.fr.md b/subjects/btreeinsertdata.fr.md index 865200e72..56083792e 100644 --- a/subjects/btreeinsertdata.fr.md +++ b/subjects/btreeinsertdata.fr.md @@ -21,25 +21,25 @@ func BTreeInsertData(root *TreeNode, data string) *TreeNode { ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main import ( - "fmt" - piscine ".." + "fmt" + piscine ".." ) func main() { - root := &piscine.TreeNode{Data: "4"} - piscine.BTreeInsertData(root, "1") - piscine.BTreeInsertData(root, "7") - piscine.BTreeInsertData(root, "5") - fmt.Println(root.Left.Data) - fmt.Println(root.Data) - fmt.Println(root.Right.Left.Data) - fmt.Println(root.Right.Data) + root := &piscine.TreeNode{Data: "4"} + piscine.BTreeInsertData(root, "1") + piscine.BTreeInsertData(root, "7") + piscine.BTreeInsertData(root, "5") + fmt.Println(root.Left.Data) + fmt.Println(root.Data) + fmt.Println(root.Right.Left.Data) + fmt.Println(root.Right.Data) } ``` diff --git a/subjects/btreeisbinary.en.md b/subjects/btreeisbinary.en.md index efa222f14..ca87f236f 100644 --- a/subjects/btreeisbinary.en.md +++ b/subjects/btreeisbinary.en.md @@ -14,7 +14,7 @@ func BTreeIsBinary(root *TreeNode) bool { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/btreeisbinary.fr.md b/subjects/btreeisbinary.fr.md index b24089599..26ad752a8 100644 --- a/subjects/btreeisbinary.fr.md +++ b/subjects/btreeisbinary.fr.md @@ -14,7 +14,7 @@ func BTreeIsBinary(root *TreeNode) bool { ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main diff --git a/subjects/btreelevelcount.en.md b/subjects/btreelevelcount.en.md index 762ab299b..0d7c47d64 100644 --- a/subjects/btreelevelcount.en.md +++ b/subjects/btreelevelcount.en.md @@ -14,7 +14,7 @@ func BTreeLevelCount(root *TreeNode) int { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/btreelevelcount.fr.md b/subjects/btreelevelcount.fr.md index 4e3d0090f..20a18f922 100644 --- a/subjects/btreelevelcount.fr.md +++ b/subjects/btreelevelcount.fr.md @@ -14,7 +14,7 @@ func BTreeLevelCount(root *TreeNode) int { ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main diff --git a/subjects/btreemax.en.md b/subjects/btreemax.en.md index e7f571755..230c5ac47 100644 --- a/subjects/btreemax.en.md +++ b/subjects/btreemax.en.md @@ -14,7 +14,7 @@ func BTreeMax(root *TreeNode) *TreeNode { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/btreemax.fr.md b/subjects/btreemax.fr.md index 5d59fba4c..60d22364e 100644 --- a/subjects/btreemax.fr.md +++ b/subjects/btreemax.fr.md @@ -14,7 +14,7 @@ func BTreeMax(root *TreeNode) *TreeNode { ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main diff --git a/subjects/btreemin.en.md b/subjects/btreemin.en.md index 64826e842..13bf7a888 100644 --- a/subjects/btreemin.en.md +++ b/subjects/btreemin.en.md @@ -14,7 +14,7 @@ func BTreeMin(root *TreeNode) *TreeNode { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/btreemin.fr.md b/subjects/btreemin.fr.md index bd6dff01a..0161f1874 100644 --- a/subjects/btreemin.fr.md +++ b/subjects/btreemin.fr.md @@ -14,7 +14,7 @@ func BTreeMin(root *TreeNode) *TreeNode { ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main diff --git a/subjects/btreeprintroot.en.md b/subjects/btreeprintroot.en.md index dd6892616..91872c95b 100644 --- a/subjects/btreeprintroot.en.md +++ b/subjects/btreeprintroot.en.md @@ -20,18 +20,18 @@ func PrintRoot(root *TreeNode){ ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main func main() { - //rootNode initialized with the value "who" - //rootNode1 initialized with the value "are" - //rootNode2 initialized with the value "you" - printRoot(rootNode) - printRoot(rootNode1) - printRoot(rootNode2) + //rootNode initialized with the value "who" + //rootNode1 initialized with the value "are" + //rootNode2 initialized with the value "you" + printRoot(rootNode) + printRoot(rootNode1) + printRoot(rootNode2) } ``` diff --git a/subjects/btreeprintroot.fr.md b/subjects/btreeprintroot.fr.md index 826a25969..734d667b4 100644 --- a/subjects/btreeprintroot.fr.md +++ b/subjects/btreeprintroot.fr.md @@ -20,18 +20,18 @@ func PrintRoot(root *TreeNode){ ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main func main() { - //rootNode initialized with the value "who" - //rootNode1 initialized with the value "are" - //rootNode2 initialized with the value "you" - printRoot(rootNode) - printRoot(rootNode1) - printRoot(rootNode2) + //rootNode initialized with the value "who" + //rootNode1 initialized with the value "are" + //rootNode2 initialized with the value "you" + printRoot(rootNode) + printRoot(rootNode1) + printRoot(rootNode2) } ``` diff --git a/subjects/btreesearchitem.en.md b/subjects/btreesearchitem.en.md index 445d63e9c..00d13efbd 100644 --- a/subjects/btreesearchitem.en.md +++ b/subjects/btreesearchitem.en.md @@ -14,7 +14,7 @@ func BTreeSearchItem(root *TreeNode, elem string) *TreeNode { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/btreesearchitem.fr.md b/subjects/btreesearchitem.fr.md index faf6c1051..9e0e97e3a 100644 --- a/subjects/btreesearchitem.fr.md +++ b/subjects/btreesearchitem.fr.md @@ -14,7 +14,7 @@ func BTreeSearchItem(root *TreeNode, elem string) *TreeNode { ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main diff --git a/subjects/btreetransplant.en.md b/subjects/btreetransplant.en.md index ed15540be..4748db9dd 100644 --- a/subjects/btreetransplant.en.md +++ b/subjects/btreetransplant.en.md @@ -14,7 +14,7 @@ func BTreeTransplant(root, node, rplc *TreeNode) *TreeNode { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/btreetransplant.fr.md b/subjects/btreetransplant.fr.md index e12683238..c5a425d60 100644 --- a/subjects/btreetransplant.fr.md +++ b/subjects/btreetransplant.fr.md @@ -14,7 +14,7 @@ func BTreeTransplant(root, node, rplc *TreeNode) *TreeNode { ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main diff --git a/subjects/capitalize.en.md b/subjects/capitalize.en.md index 8c32b148b..24482ce4c 100644 --- a/subjects/capitalize.en.md +++ b/subjects/capitalize.en.md @@ -16,7 +16,7 @@ func Capitalize(s string) string { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/capitalize.fr.md b/subjects/capitalize.fr.md index a73e81a11..1cd67916b 100644 --- a/subjects/capitalize.fr.md +++ b/subjects/capitalize.fr.md @@ -16,7 +16,7 @@ func Capitalize(s string) string { ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main diff --git a/subjects/capitalizeprog.en.md b/subjects/capitalizeprog.en.md index 49a87b711..0151c867d 100644 --- a/subjects/capitalizeprog.en.md +++ b/subjects/capitalizeprog.en.md @@ -4,11 +4,11 @@ Write a program that capitalizes the first letter of each word **and** lowercases the rest of each word of a `string`. -- A word is a sequence of **alphanumerical** characters. +- A word is a sequence of **alphanumerical** characters. -- If there is more than one argument the program should print `Too many arguments`. +- If there is more than one argument the program should print `Too many arguments`. -- If there is no arguments given the program should print a newline ("`\n`"). +- If there is no arguments given the program should print a newline ("`\n`"). ### Usage : diff --git a/subjects/capitalizeprog.fr.md b/subjects/capitalizeprog.fr.md index 521f39c1f..1ad465d5e 100644 --- a/subjects/capitalizeprog.fr.md +++ b/subjects/capitalizeprog.fr.md @@ -4,11 +4,11 @@ Écrire un programme qui met en majuscule la première lettre de chaque mot et en minuscule les autres lettres du reste du mot d'une `string`. -- Un mot est une suite de caractères **alphanumériques**. +- Un mot est une suite de caractères **alphanumériques**. -- Si il y a plus d'un argument le programme doit afficher `Too many arguments`. +- Si il y a plus d'un argument le programme doit afficher `Too many arguments`. -- Si il n'y a pas d'arguments le programme doit afficher un retour à la ligne (`'\n'`). +- Si il n'y a pas d'arguments le programme doit afficher un retour à la ligne (`'\n'`). ### Utilisation : diff --git a/subjects/cat.en.md b/subjects/cat.en.md index 6667d9a8b..bb9b18c1e 100644 --- a/subjects/cat.en.md +++ b/subjects/cat.en.md @@ -4,23 +4,23 @@ Write a program that has the same behaviour as the system's `cat` command-line. -- The `options` do not have to be handled. +- The `options` do not have to be handled. -- If the program is called without arguments it should take the `input` and print it back (as shown with the "Hello" example below). +- If the program is called without arguments it should take the `input` and print it back (as shown with the "Hello" example below). -- In the program folder create two files named `quest8.txt` and `quest8T.txt`. +- In the program folder create two files named `quest8.txt` and `quest8T.txt`. -- Copy to the `quest8.txt` file the following sentence : +- Copy to the `quest8.txt` file the following sentence : `"Programming is a skill best acquired by practice and example rather than from books" by Alan Turing` -- Copy to the `quest8T.txt` file the following sentence : +- Copy to the `quest8T.txt` file the following sentence : `"Alan Mathison Turing was an English mathematician, computer scientist, logician, cryptanalyst. Turing was highly influential in the development of theoretical computer science, providing a formalisation of the concepts of algorithm and computation with the Turing machine, which can be considered a model of a general-purpose computer. Turing is widely considered to be the father of theoretical computer science and artificial intelligence."` -- In case of error the program should print the error. +- In case of error the program should print the error. -- The program must be submitted inside a folder named `cat`. +- The program must be submitted inside a folder named `cat`. ```console student@ubuntu:~/[[ROOT]]/cat$ go build diff --git a/subjects/cat.fr.md b/subjects/cat.fr.md index dba3f97c1..4629e309f 100644 --- a/subjects/cat.fr.md +++ b/subjects/cat.fr.md @@ -4,23 +4,23 @@ Écrire un programme qui a le même comportement que la ligne de commande `cat`. -- Les `options` ne doivent pas être gérés. +- Les `options` ne doivent pas être gérés. -- Si le programme est éxécuté sans arguments il doit prendre l'`input` et l'afficher. +- Si le programme est éxécuté sans arguments il doit prendre l'`input` et l'afficher. -- Dans le dossier du programme créer deux fichiers nommés `quest8.txt` et `quest8T.txt`. +- Dans le dossier du programme créer deux fichiers nommés `quest8.txt` et `quest8T.txt`. -- Copier dans le fichier `quest8.txt` la phrase suivante : +- Copier dans le fichier `quest8.txt` la phrase suivante : `"Programming is a skill best acquired by pratice and example rather than from books" by Alan Turing` -- Copier dans le fichier `quest8T.txt` la phrase suivante : +- Copier dans le fichier `quest8T.txt` la phrase suivante : `"Alan Mathison Turing was an English mathematician, computer scientist, logician, cryptanalyst. Turing was highly influential in the development of theoretical computer science, providing a formalisation of the concepts of algorithm and computation with the Turing machine, which can be considered a model of a general-purpose computer. Turing is widely considered to be the father of theoretical computer science and artificial intelligence."` -- En cas d'erreur le programme doit afficher l'erreur. +- En cas d'erreur le programme doit afficher l'erreur. -- Le programme doit être rendu dans un dossier nommé `cat`. +- Le programme doit être rendu dans un dossier nommé `cat`. ### Utilisation: diff --git a/subjects/changeorder.en.md b/subjects/changeorder.en.md index 6a4816c4e..7f044ba07 100644 --- a/subjects/changeorder.en.md +++ b/subjects/changeorder.en.md @@ -68,7 +68,7 @@ func main() { Its output: ```console -$> go build -$> ./main +$ go build +$ ./main 1 -> 3 -> 5 -> 2 -> 4 ``` diff --git a/subjects/chunk.en.md b/subjects/chunk.en.md new file mode 100644 index 000000000..eed3e2b1c --- /dev/null +++ b/subjects/chunk.en.md @@ -0,0 +1,55 @@ +## chunk + +## **WARNING! VERY IMPORTANT!** + +For this exercise a function will be tested **with the exam own main**. However the student **still needs** to submit a structured program: + +This means that: + +- The package needs to be named `package main`. +- The submitted code needs one declared function main(```func main()```) even if empty. +- The function main declared needs to **also pass** the `Restrictions Checker`(illegal functions tester). It is advised for the student to just empty the function main after its own testings are done. +- Every other rules are obviously the same than for a `program`. + +### Instructions + +Write a function called `Chunk` that receives as parameters a slice, `slice []int`, and an number `size int`. The goal of this function is to chunk a slice into many sub slices where each sub slice has the length of `size`. + +- If the `size` is `0` it should print `\n` + +### Expected function + +```go +func Chunk(slice []int, size int) { + +} +``` + +### Usage + +Here is a possible program to test your function : + +```go +package main + +func main() { + Chunk([]int{}, 10) + Chunk([]int{0, 1, 2, 3, 4, 5, 6, 7}, 0) + Chunk([]int{0, 1, 2, 3, 4, 5, 6, 7}, 3) + Chunk([]int{0, 1, 2, 3, 4, 5, 6, 7}, 5) + Chunk([]int{0, 1, 2, 3, 4, 5, 6, 7}, 4) +} +``` + +And its output : + +```console +student@ubuntu:~/[[ROOT]]/test$ go build +student@ubuntu:~/[[ROOT]]/test$ ./test +[] + +[[0 1 2] [3 4 5] [6 7]] +[[0 1 2 3 4] [5 6 7]] +[[0 1 2 3] [4 5 6 7]] +student@ubuntu:~/[[ROOT]]/test$ +``` diff --git a/subjects/cl-camp1.en.md b/subjects/cl-camp1.en.md index c03a15d2d..d559cec06 100644 --- a/subjects/cl-camp1.en.md +++ b/subjects/cl-camp1.en.md @@ -10,11 +10,11 @@ The instincts are coming back... Put in a file `mastertheLS` the command line that will: -- list the files and directories of the current directory. -- Ignore the hidden files, the "." and the "..". -- Separates the resuls with commas. -- Order them by ascending order of creation date. -- Have the directories ends with a `/`. +- list the files and directories of the current directory. +- Ignore the hidden files, the "." and the "..". +- Separates the resuls with commas. +- Order them by ascending order of creation date. +- Have the directories ends with a `/`. ### Hint diff --git a/subjects/cl-camp1.fr.md b/subjects/cl-camp1.fr.md index 6f63db485..8ffabc991 100644 --- a/subjects/cl-camp1.fr.md +++ b/subjects/cl-camp1.fr.md @@ -10,11 +10,11 @@ Les instincts resurgissent... Mettez dans un fichier `mastertheLS` la ligne de commande qui: -- listera les fichiers et dossiers dans le dossier courant. -- Ignorera les fichiers cachés, le "." et le "..". -- Separarera le resultat avec des virgules. -- Les triera pas ordre croissant de date de création. -- Placera un `/` en face des dossiers. +- listera les fichiers et dossiers dans le dossier courant. +- Ignorera les fichiers cachés, le "." et le "..". +- Separarera le resultat avec des virgules. +- Les triera pas ordre croissant de date de création. +- Placera un `/` en face des dossiers. ### Indice diff --git a/subjects/cl-camp3.en.md b/subjects/cl-camp3.en.md index 5372dcba5..9e6f12a24 100644 --- a/subjects/cl-camp3.en.md +++ b/subjects/cl-camp3.en.md @@ -6,9 +6,9 @@ Create a file `look`, which will look for and show, in the current directory and its sub-folders all the files : -- starting with an `a` or, -- all the files ending with a `z` or, -- all files starting with `z` and ending with `a!`. +- starting with an `a` or, +- all the files ending with a `z` or, +- all files starting with `z` and ending with `a!`. ### Hint diff --git a/subjects/cl-camp3.fr.md b/subjects/cl-camp3.fr.md index d96b147e6..558e16b61 100644 --- a/subjects/cl-camp3.fr.md +++ b/subjects/cl-camp3.fr.md @@ -6,9 +6,9 @@ Créer un fichier `look`, qui cherchera et montrera, dans le répertoire courant et ses sous-répertoires, tous les fichiers qui: -- commence avec `a` et, -- tous les fichiers qui se terminent avec `z` et, -- tous les fichiers qui commencent avec `z` et qui se finissent avec `a!`. +- commence avec `a` et, +- tous les fichiers qui se terminent avec `z` et, +- tous les fichiers qui commencent avec `z` et qui se finissent avec `a!`. ### Indice diff --git a/subjects/cl-camp4.en.md b/subjects/cl-camp4.en.md index 7ebb9bb4a..7033b3104 100644 --- a/subjects/cl-camp4.en.md +++ b/subjects/cl-camp4.en.md @@ -6,13 +6,13 @@ Create a file `myfamily.sh`, which will show a subject's family (key: relatives). -- The quotes have to be removed. +- The quotes have to be removed. -- The subject will be decided depending on his ID which will be contained in the environment variable HERO_ID. +- The subject will be decided depending on his ID which will be contained in the environment variable HERO_ID. -* Where to look : https://[[DOMAIN]]/assets/superhero/all.json +* Where to look : https://[[DOMAIN]]/assets/superhero/all.json -* What to use : curl, jq and others... +* What to use : curl, jq and others... ### Usage diff --git a/subjects/cl-camp4.fr.md b/subjects/cl-camp4.fr.md index b9a6d09e7..0b2305f6a 100644 --- a/subjects/cl-camp4.fr.md +++ b/subjects/cl-camp4.fr.md @@ -6,13 +6,13 @@ Créer un fichier `myfamily.sh`, qui affichera la famille d'un individu (clef: relatives). -- Les guillemets doivent être enlevés. +- Les guillemets doivent être enlevés. -- L'individu sera choisi en fonction de son ID qui sera contenu dans la variable d'environment HERO_ID. +- L'individu sera choisi en fonction de son ID qui sera contenu dans la variable d'environment HERO_ID. -* Où chercher : https://[[DOMAIN]]/assets/superhero/all.json +* Où chercher : https://[[DOMAIN]]/assets/superhero/all.json -* Quoi utiliser : `curl`, `jq` et d'autres... +* Quoi utiliser : `curl`, `jq` et d'autres... ### Utilisation diff --git a/subjects/cl-camp5.en.md b/subjects/cl-camp5.en.md index 7b68ade9f..37210ce32 100644 --- a/subjects/cl-camp5.en.md +++ b/subjects/cl-camp5.en.md @@ -6,7 +6,7 @@ Create a file `lookagain.sh`, which will look for, from the current directory and its sub-folders all the files: -- all the files ending with `.sh`. +- all the files ending with `.sh`. That command will only show the name of the files without the `.sh`. diff --git a/subjects/cl-camp5.fr.md b/subjects/cl-camp5.fr.md index ec919d710..10595ab79 100644 --- a/subjects/cl-camp5.fr.md +++ b/subjects/cl-camp5.fr.md @@ -6,7 +6,7 @@ Créer un fichier `lookagain.sh`, qui cherchera et montrera, dans le répertoire courant et ses sous-répertoires, tous les fichiers qui: -- qui finissent avec `.sh`. +- qui finissent avec `.sh`. Cette commande montrera le nom des fichiers sans le`.sh`. diff --git a/subjects/cl.en.md b/subjects/cl.en.md index 2aea2c97c..ef81d4901 100644 --- a/subjects/cl.en.md +++ b/subjects/cl.en.md @@ -10,11 +10,11 @@ The instincts are coming back... Put in a file `mastertheLS` the command line that will: -- list the files and folders of the current folder. -- Ignore the hidden files, the "." and the "..". -- Separates the resuls with commas. -- Order them by ascending order of creation date. -- Have the folders have a `/` in front of them. +- list the files and folders of the current folder. +- Ignore the hidden files, the "." and the "..". +- Separates the results with commas. +- Order them by ascending order of creation date. +- Have the folders have a `/` in front of them. ### Hint diff --git a/subjects/cl.fr.md b/subjects/cl.fr.md index 2aea2c97c..ef81d4901 100644 --- a/subjects/cl.fr.md +++ b/subjects/cl.fr.md @@ -10,11 +10,11 @@ The instincts are coming back... Put in a file `mastertheLS` the command line that will: -- list the files and folders of the current folder. -- Ignore the hidden files, the "." and the "..". -- Separates the resuls with commas. -- Order them by ascending order of creation date. -- Have the folders have a `/` in front of them. +- list the files and folders of the current folder. +- Ignore the hidden files, the "." and the "..". +- Separates the results with commas. +- Order them by ascending order of creation date. +- Have the folders have a `/` in front of them. ### Hint diff --git a/subjects/cleanstr.en.md b/subjects/cleanstr.en.md index 418ca119b..1cf0283db 100644 --- a/subjects/cleanstr.en.md +++ b/subjects/cleanstr.en.md @@ -3,6 +3,7 @@ ### Instructions Write a **program** that takes a `string`, and displays this `string` with exactly: + - one space between words. - without spaces nor tabs at the beginning nor at the end. - with the result followed by a newline ("`\n`"). diff --git a/subjects/cleanstr.fr.md b/subjects/cleanstr.fr.md index a55ac162f..5f7c17f8b 100644 --- a/subjects/cleanstr.fr.md +++ b/subjects/cleanstr.fr.md @@ -3,6 +3,7 @@ ### Instructions Écrire un programme qui prend une `string`, et qui affiche cette `string` avec exactement: + - un espace entre les mots. - aucun espace ni de tabulation ni au début ni à la fin. - le résultat avecsuivi d'un saut de ligne("`\n`"). diff --git a/subjects/collatzcountdown.en.md b/subjects/collatzcountdown.en.md index 6c0581f1a..e6759c810 100644 --- a/subjects/collatzcountdown.en.md +++ b/subjects/collatzcountdown.en.md @@ -4,7 +4,7 @@ Write a function, `CollatzCountdown`, that returns the number of steps necessary to reach 1 using the collatz countdown. -- It must return `-1` if `start` is equal to `0` or negative. +- It must return `-1` if `start` is equal to `0` or negative. ### Expected function @@ -16,7 +16,7 @@ func CollatzCountdown(start int) int { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/collatzcountdown.fr.md b/subjects/collatzcountdown.fr.md index 1650ff29e..005b4d0c4 100644 --- a/subjects/collatzcountdown.fr.md +++ b/subjects/collatzcountdown.fr.md @@ -4,7 +4,7 @@ Écrire une fonction, `CollatzCountdown`, qui retournes le nombre d'étapes nécéssaires pour atteindre 1 en utilisant le comptage de collatz. -- Elle doit renvoyer `-1` si `start` est égal à 0 ou négatif. +- Elle doit renvoyer `-1` si `start` est égal à 0 ou négatif. ### Fonction attendue @@ -16,7 +16,7 @@ func CollatzCountdown(start int) int { ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main diff --git a/subjects/comcheck.en.md b/subjects/comcheck.en.md index fb7472f1d..19d14407d 100644 --- a/subjects/comcheck.en.md +++ b/subjects/comcheck.en.md @@ -4,9 +4,9 @@ Write a program `comcheck` that displays on the standard output `Alert!!!` followed by newline (`'\n'`) if at least one of the arguments passed in parameter matches the `string`: -- `01`, `galaxy` or `galaxy 01`. +- `01`, `galaxy` or `galaxy 01`. -- If none of the parameters match, the program displays a nothing. +- If none of the parameters match, the program displays a nothing. ### Usage diff --git a/subjects/comcheck.fr.md b/subjects/comcheck.fr.md index d2a24d0dc..d03524915 100644 --- a/subjects/comcheck.fr.md +++ b/subjects/comcheck.fr.md @@ -4,9 +4,9 @@ écrire un programme `comcheck` qui affiche sur la sortie standard `Alert!!!` suivi d'un retour à la ligne (`'\n'`) si au moins un des arguments passé ne paramètre correspond aux `string`: -- `01`, `galaxy` ou `galaxy 01`. +- `01`, `galaxy` ou `galaxy 01`. -- si aucun des paramètres correspond, le programme affiche rien. +- si aucun des paramètres correspond, le programme affiche rien. ### Usage diff --git a/subjects/commandments.en.md b/subjects/commandments.en.md index 9081d208c..e2fe4082c 100644 --- a/subjects/commandments.en.md +++ b/subjects/commandments.en.md @@ -16,89 +16,89 @@ A few basic principles to follow ### The Commandements _(read them)_ -- Le numérique est ta passion. +- Le numérique est ta passion. -- Ton objectif à 42 : développer ton talent et tes compétences pour le marché du numérique. +- Ton objectif à 42 : développer ton talent et tes compétences pour le marché du numérique. -- L’objectif de 42 pour toi : te faire accéder au marché de l’emploi, à une longue et pérenne carrière dans le numérique, et te faire progresser socialement. +- L’objectif de 42 pour toi : te faire accéder au marché de l’emploi, à une longue et pérenne carrière dans le numérique, et te faire progresser socialement. -- L’ambition de 42 pour toi : être un pionnier du numérique de demain. +- L’ambition de 42 pour toi : être un pionnier du numérique de demain. -- Il est de ta responsabilité de gérer ta progression : 42 te propose un parcours individualisé adapté à ton rythme. +- Il est de ta responsabilité de gérer ta progression : 42 te propose un parcours individualisé adapté à ton rythme. -- Des challenges jalonnent ton parcours. 42 ne fournira aucun élément de solution. C’est ton rôle de chercher et trouver par toi-même ces solutions pour atteindre l’objectif. +- Des challenges jalonnent ton parcours. 42 ne fournira aucun élément de solution. C’est ton rôle de chercher et trouver par toi-même ces solutions pour atteindre l’objectif. -- Sois actif. N’attend pas que les choses se fassent pour toi. 42 est un parcours 100% pratique. +- Sois actif. N’attend pas que les choses se fassent pour toi. 42 est un parcours 100% pratique. -- Sois autonome dans ton cursus. N’attend pas que l’on te dise quoi faire. +- Sois autonome dans ton cursus. N’attend pas que l’on te dise quoi faire. -- Sois collaboratif, autant sur les projets solos que les projets de groupe. Face aux challenges à resoudre, l’échange et le debat sont tes meilleures armes. +- Sois collaboratif, autant sur les projets solos que les projets de groupe. Face aux challenges à resoudre, l’échange et le debat sont tes meilleures armes. -- Ne "crois" pas. Sois sûr. Techniquement, relationnelement, organisationellement, administrativement. +- Ne "crois" pas. Sois sûr. Techniquement, relationnelement, organisationellement, administrativement. -- Pour être sûr, teste, contrôle. +- Pour être sûr, teste, contrôle. -- N’ai pas peur de te tromper, d’échouer. L’échec est une étape normale vers le succès. +- N’ai pas peur de te tromper, d’échouer. L’échec est une étape normale vers le succès. -- Teste à nouveau. Collabore davantage pour tester davantage. +- Teste à nouveau. Collabore davantage pour tester davantage. -- Ose. Le risque est de se tromper. Voir le commandement 12. +- Ose. Le risque est de se tromper. Voir le commandement 12. -- Sois rigoureux dans ton travail. +- Sois rigoureux dans ton travail. -- Sois investi dans ton cursus : 50 heures par semaine est un minimum. Ta capacité de travail est une valeur. L’école est ouverte 24h/24 et 7j/7. +- Sois investi dans ton cursus : 50 heures par semaine est un minimum. Ta capacité de travail est une valeur. L’école est ouverte 24h/24 et 7j/7. -- Sois régulier dans ton travail. Un jour oui, un jour non, un coup nocturne, un coup diurne... le chaos t’empêche d’avancer. +- Sois régulier dans ton travail. Un jour oui, un jour non, un coup nocturne, un coup diurne... le chaos t’empêche d’avancer. -- Prévois un groupe de travail large et hétérogène pour y trouver facilement des idées neuves et des groupes de projet. +- Prévois un groupe de travail large et hétérogène pour y trouver facilement des idées neuves et des groupes de projet. -- Pour tes collaborations et ton travail en groupe, privilégie des étudiants qui n’ont pas déjà la solution au problème. +- Pour tes collaborations et ton travail en groupe, privilégie des étudiants qui n’ont pas déjà la solution au problème. -- Sois investi dans ton groupe de projet, et ne le laisse pas faire ton travail à ta place. +- Sois investi dans ton groupe de projet, et ne le laisse pas faire ton travail à ta place. -- Ton groupe de projet est solidaire, son succès comme son échec est de la responsabilité de tous, et les conflits se règlent en interne. +- Ton groupe de projet est solidaire, son succès comme son échec est de la responsabilité de tous, et les conflits se règlent en interne. -- Travaille à l’école. Faire du peer-learning, collaborer, cela demande d’être physiquement avec les autres. A distance cela ne fonctionne pas. +- Travaille à l’école. Faire du peer-learning, collaborer, cela demande d’être physiquement avec les autres. A distance cela ne fonctionne pas. -- Implique toi dans les évaluations de tes projets. Elles te permettent de prendre du recul. +- Implique toi dans les évaluations de tes projets. Elles te permettent de prendre du recul. -- Implique toi dans tes évaluations des projets des autres. La qualité de la communauté en dépend. +- Implique toi dans tes évaluations des projets des autres. La qualité de la communauté en dépend. -- Sois juste et teste rigoureusement tes projets comme ceux des autres en évaluation avec tes propres jeux de tests. +- Sois juste et teste rigoureusement tes projets comme ceux des autres en évaluation avec tes propres jeux de tests. -- Joue pleinement le jeu de ta scolarité dans l’état d’esprit demandé, fait tous les exercices et projets demandés. +- Joue pleinement le jeu de ta scolarité dans l’état d’esprit demandé, fait tous les exercices et projets demandés. -- Ne cherche pas des biais et des failles dans le système. Tu vas fausser ta propre formation et ta valeur sur le marché. +- Ne cherche pas des biais et des failles dans le système. Tu vas fausser ta propre formation et ta valeur sur le marché. -- Ne triche pas intentionellement. C’est amoral, cela contredit le commandement 12, et c’est du temps inutilement passé à ne pas développer tes compétences pour faire croire aux autres que tu sais coder alors que ce n’est pas le cas. +- Ne triche pas intentionellement. C’est amoral, cela contredit le commandement 12, et c’est du temps inutilement passé à ne pas développer tes compétences pour faire croire aux autres que tu sais coder alors que ce n’est pas le cas. -- Ne rends pas un projet que tu ne serais pas capable de reproduire seul à huis clos. Même si c’est parfois involontaire, c’est aussi de la triche. +- Ne rends pas un projet que tu ne serais pas capable de reproduire seul à huis clos. Même si c’est parfois involontaire, c’est aussi de la triche. -- C’est pas pour tes parents que tu travailles, ni pour le staff. C’est pour toi. +- C’est pas pour tes parents que tu travailles, ni pour le staff. C’est pour toi. -- Participe à la vie de la communauté, à son épanouissement, et sa qualité en sortie de formation. +- Participe à la vie de la communauté, à son épanouissement, et sa qualité en sortie de formation. -- Aide au respect de ces commandements par la communauté. +- Aide au respect de ces commandements par la communauté. -- Sois bienveillant et empathique vis à vis de tes camarades comme des personnes avec qui tu interagis, échanges, débats. +- Sois bienveillant et empathique vis à vis de tes camarades comme des personnes avec qui tu interagis, échanges, débats. -- N’ai pas peur du monde professionnel. +- N’ai pas peur du monde professionnel. -- Respecte le matériel. Des consignes spécifiques sont données en ce sens. +- Respecte le matériel. Des consignes spécifiques sont données en ce sens. -- Respecte les locaux. Des consignes spécifiques sont données en ce sens. +- Respecte les locaux. Des consignes spécifiques sont données en ce sens. -- Respecte les gens, étudiants, staffs, partenaires, visiteurs. +- Respecte les gens, étudiants, staffs, partenaires, visiteurs. -- Respecte la loi en vigueur dans le pays. +- Respecte la loi en vigueur dans le pays. -- Respecte les lois et consignes en vigueur liées à la consommation d’alcool. +- Respecte les lois et consignes en vigueur liées à la consommation d’alcool. -- Respecte les lois et consignes en vigueur liées à la consommation de tabac, stupéfiants, ou produits assimilés. +- Respecte les lois et consignes en vigueur liées à la consommation de tabac, stupéfiants, ou produits assimilés. -- N’hésite pas à interagir avec le staff, pour parler de tes problèmes, pour remonter des problèmes dans le cursus, pour contribuer au cursus. +- N’hésite pas à interagir avec le staff, pour parler de tes problèmes, pour remonter des problèmes dans le cursus, pour contribuer au cursus. -- Si tu t’interroges ou ne comprends pas nos choix pédagogiques, demande nous. On ne fait généralement rien au hasard. +- Si tu t’interroges ou ne comprends pas nos choix pédagogiques, demande nous. On ne fait généralement rien au hasard. ### Required diff --git a/subjects/commandments.fr.md b/subjects/commandments.fr.md index 9081d208c..e2fe4082c 100644 --- a/subjects/commandments.fr.md +++ b/subjects/commandments.fr.md @@ -16,89 +16,89 @@ A few basic principles to follow ### The Commandements _(read them)_ -- Le numérique est ta passion. +- Le numérique est ta passion. -- Ton objectif à 42 : développer ton talent et tes compétences pour le marché du numérique. +- Ton objectif à 42 : développer ton talent et tes compétences pour le marché du numérique. -- L’objectif de 42 pour toi : te faire accéder au marché de l’emploi, à une longue et pérenne carrière dans le numérique, et te faire progresser socialement. +- L’objectif de 42 pour toi : te faire accéder au marché de l’emploi, à une longue et pérenne carrière dans le numérique, et te faire progresser socialement. -- L’ambition de 42 pour toi : être un pionnier du numérique de demain. +- L’ambition de 42 pour toi : être un pionnier du numérique de demain. -- Il est de ta responsabilité de gérer ta progression : 42 te propose un parcours individualisé adapté à ton rythme. +- Il est de ta responsabilité de gérer ta progression : 42 te propose un parcours individualisé adapté à ton rythme. -- Des challenges jalonnent ton parcours. 42 ne fournira aucun élément de solution. C’est ton rôle de chercher et trouver par toi-même ces solutions pour atteindre l’objectif. +- Des challenges jalonnent ton parcours. 42 ne fournira aucun élément de solution. C’est ton rôle de chercher et trouver par toi-même ces solutions pour atteindre l’objectif. -- Sois actif. N’attend pas que les choses se fassent pour toi. 42 est un parcours 100% pratique. +- Sois actif. N’attend pas que les choses se fassent pour toi. 42 est un parcours 100% pratique. -- Sois autonome dans ton cursus. N’attend pas que l’on te dise quoi faire. +- Sois autonome dans ton cursus. N’attend pas que l’on te dise quoi faire. -- Sois collaboratif, autant sur les projets solos que les projets de groupe. Face aux challenges à resoudre, l’échange et le debat sont tes meilleures armes. +- Sois collaboratif, autant sur les projets solos que les projets de groupe. Face aux challenges à resoudre, l’échange et le debat sont tes meilleures armes. -- Ne "crois" pas. Sois sûr. Techniquement, relationnelement, organisationellement, administrativement. +- Ne "crois" pas. Sois sûr. Techniquement, relationnelement, organisationellement, administrativement. -- Pour être sûr, teste, contrôle. +- Pour être sûr, teste, contrôle. -- N’ai pas peur de te tromper, d’échouer. L’échec est une étape normale vers le succès. +- N’ai pas peur de te tromper, d’échouer. L’échec est une étape normale vers le succès. -- Teste à nouveau. Collabore davantage pour tester davantage. +- Teste à nouveau. Collabore davantage pour tester davantage. -- Ose. Le risque est de se tromper. Voir le commandement 12. +- Ose. Le risque est de se tromper. Voir le commandement 12. -- Sois rigoureux dans ton travail. +- Sois rigoureux dans ton travail. -- Sois investi dans ton cursus : 50 heures par semaine est un minimum. Ta capacité de travail est une valeur. L’école est ouverte 24h/24 et 7j/7. +- Sois investi dans ton cursus : 50 heures par semaine est un minimum. Ta capacité de travail est une valeur. L’école est ouverte 24h/24 et 7j/7. -- Sois régulier dans ton travail. Un jour oui, un jour non, un coup nocturne, un coup diurne... le chaos t’empêche d’avancer. +- Sois régulier dans ton travail. Un jour oui, un jour non, un coup nocturne, un coup diurne... le chaos t’empêche d’avancer. -- Prévois un groupe de travail large et hétérogène pour y trouver facilement des idées neuves et des groupes de projet. +- Prévois un groupe de travail large et hétérogène pour y trouver facilement des idées neuves et des groupes de projet. -- Pour tes collaborations et ton travail en groupe, privilégie des étudiants qui n’ont pas déjà la solution au problème. +- Pour tes collaborations et ton travail en groupe, privilégie des étudiants qui n’ont pas déjà la solution au problème. -- Sois investi dans ton groupe de projet, et ne le laisse pas faire ton travail à ta place. +- Sois investi dans ton groupe de projet, et ne le laisse pas faire ton travail à ta place. -- Ton groupe de projet est solidaire, son succès comme son échec est de la responsabilité de tous, et les conflits se règlent en interne. +- Ton groupe de projet est solidaire, son succès comme son échec est de la responsabilité de tous, et les conflits se règlent en interne. -- Travaille à l’école. Faire du peer-learning, collaborer, cela demande d’être physiquement avec les autres. A distance cela ne fonctionne pas. +- Travaille à l’école. Faire du peer-learning, collaborer, cela demande d’être physiquement avec les autres. A distance cela ne fonctionne pas. -- Implique toi dans les évaluations de tes projets. Elles te permettent de prendre du recul. +- Implique toi dans les évaluations de tes projets. Elles te permettent de prendre du recul. -- Implique toi dans tes évaluations des projets des autres. La qualité de la communauté en dépend. +- Implique toi dans tes évaluations des projets des autres. La qualité de la communauté en dépend. -- Sois juste et teste rigoureusement tes projets comme ceux des autres en évaluation avec tes propres jeux de tests. +- Sois juste et teste rigoureusement tes projets comme ceux des autres en évaluation avec tes propres jeux de tests. -- Joue pleinement le jeu de ta scolarité dans l’état d’esprit demandé, fait tous les exercices et projets demandés. +- Joue pleinement le jeu de ta scolarité dans l’état d’esprit demandé, fait tous les exercices et projets demandés. -- Ne cherche pas des biais et des failles dans le système. Tu vas fausser ta propre formation et ta valeur sur le marché. +- Ne cherche pas des biais et des failles dans le système. Tu vas fausser ta propre formation et ta valeur sur le marché. -- Ne triche pas intentionellement. C’est amoral, cela contredit le commandement 12, et c’est du temps inutilement passé à ne pas développer tes compétences pour faire croire aux autres que tu sais coder alors que ce n’est pas le cas. +- Ne triche pas intentionellement. C’est amoral, cela contredit le commandement 12, et c’est du temps inutilement passé à ne pas développer tes compétences pour faire croire aux autres que tu sais coder alors que ce n’est pas le cas. -- Ne rends pas un projet que tu ne serais pas capable de reproduire seul à huis clos. Même si c’est parfois involontaire, c’est aussi de la triche. +- Ne rends pas un projet que tu ne serais pas capable de reproduire seul à huis clos. Même si c’est parfois involontaire, c’est aussi de la triche. -- C’est pas pour tes parents que tu travailles, ni pour le staff. C’est pour toi. +- C’est pas pour tes parents que tu travailles, ni pour le staff. C’est pour toi. -- Participe à la vie de la communauté, à son épanouissement, et sa qualité en sortie de formation. +- Participe à la vie de la communauté, à son épanouissement, et sa qualité en sortie de formation. -- Aide au respect de ces commandements par la communauté. +- Aide au respect de ces commandements par la communauté. -- Sois bienveillant et empathique vis à vis de tes camarades comme des personnes avec qui tu interagis, échanges, débats. +- Sois bienveillant et empathique vis à vis de tes camarades comme des personnes avec qui tu interagis, échanges, débats. -- N’ai pas peur du monde professionnel. +- N’ai pas peur du monde professionnel. -- Respecte le matériel. Des consignes spécifiques sont données en ce sens. +- Respecte le matériel. Des consignes spécifiques sont données en ce sens. -- Respecte les locaux. Des consignes spécifiques sont données en ce sens. +- Respecte les locaux. Des consignes spécifiques sont données en ce sens. -- Respecte les gens, étudiants, staffs, partenaires, visiteurs. +- Respecte les gens, étudiants, staffs, partenaires, visiteurs. -- Respecte la loi en vigueur dans le pays. +- Respecte la loi en vigueur dans le pays. -- Respecte les lois et consignes en vigueur liées à la consommation d’alcool. +- Respecte les lois et consignes en vigueur liées à la consommation d’alcool. -- Respecte les lois et consignes en vigueur liées à la consommation de tabac, stupéfiants, ou produits assimilés. +- Respecte les lois et consignes en vigueur liées à la consommation de tabac, stupéfiants, ou produits assimilés. -- N’hésite pas à interagir avec le staff, pour parler de tes problèmes, pour remonter des problèmes dans le cursus, pour contribuer au cursus. +- N’hésite pas à interagir avec le staff, pour parler de tes problèmes, pour remonter des problèmes dans le cursus, pour contribuer au cursus. -- Si tu t’interroges ou ne comprends pas nos choix pédagogiques, demande nous. On ne fait généralement rien au hasard. +- Si tu t’interroges ou ne comprends pas nos choix pédagogiques, demande nous. On ne fait généralement rien au hasard. ### Required diff --git a/subjects/compact.en.md b/subjects/compact.en.md index 1ba211318..51b4527ed 100644 --- a/subjects/compact.en.md +++ b/subjects/compact.en.md @@ -5,9 +5,9 @@ Write a function `Compact` that takes a pointer to a slice of strings as the argument. This function must: -- Return the number of elements with non-`nil`. +- Return the number of elements with non-`nil`. -- Compact, i.e., delete the elements with `nil` in the slice. +- Compact, i.e., delete the elements with `nil` in the slice. ### Expected functions @@ -19,15 +19,15 @@ func Compact(ptr *[]string) int { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main import ( - "fmt" + "fmt" - piscine ".." + piscine ".." ) const N = 6 diff --git a/subjects/compact.fr.md b/subjects/compact.fr.md index 9a1e4a5d0..16b094d90 100644 --- a/subjects/compact.fr.md +++ b/subjects/compact.fr.md @@ -19,15 +19,15 @@ func Compact(ptr *[]string) int { ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main import ( - "fmt" + "fmt" - piscine ".." + piscine ".." ) const N = 6 diff --git a/subjects/compare.en.md b/subjects/compare.en.md index 9a543e0cf..d1bb0ea11 100644 --- a/subjects/compare.en.md +++ b/subjects/compare.en.md @@ -14,7 +14,7 @@ func Compare(a, b string) int { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/compare.fr.md b/subjects/compare.fr.md index 8805720d0..67f08cab8 100644 --- a/subjects/compare.fr.md +++ b/subjects/compare.fr.md @@ -14,7 +14,7 @@ func Compare(a, b string) int { ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main diff --git a/subjects/compareprog.en.md b/subjects/compareprog.en.md index 00edb2f84..c57d1da93 100644 --- a/subjects/compareprog.en.md +++ b/subjects/compareprog.en.md @@ -6,7 +6,7 @@ Write a program that behaves like the `Compare` function from the `Go` package ` This program prints a number after comparing two `string` lexicographically. -### Usage : +### Usage ```console student@ubuntu:~/compareprog$ go build diff --git a/subjects/concat.en.md b/subjects/concat.en.md index eff5227d4..7e0c1a04b 100644 --- a/subjects/concat.en.md +++ b/subjects/concat.en.md @@ -14,7 +14,7 @@ func Concat(str1 string, str2 string) string { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/concat.fr.md b/subjects/concat.fr.md index c8720d77d..948ef1de3 100644 --- a/subjects/concat.fr.md +++ b/subjects/concat.fr.md @@ -14,7 +14,7 @@ func Concat(str1 string, str2 string) string { ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main diff --git a/subjects/concatparams.en.md b/subjects/concatparams.en.md index 18289c174..62f287328 100644 --- a/subjects/concatparams.en.md +++ b/subjects/concatparams.en.md @@ -16,7 +16,7 @@ func ConcatParams(args []string) string { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/concatparams.fr.md b/subjects/concatparams.fr.md index 1cd22cd69..01cfb0743 100644 --- a/subjects/concatparams.fr.md +++ b/subjects/concatparams.fr.md @@ -16,7 +16,7 @@ func ConcatParams(args []string) string { ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main diff --git a/subjects/convertbase.en.md b/subjects/convertbase.en.md index 8e29bc79e..5ef8ef577 100644 --- a/subjects/convertbase.en.md +++ b/subjects/convertbase.en.md @@ -18,7 +18,7 @@ func ConvertBase(nbr, baseFrom, baseTo string) string { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/convertbase.fr.md b/subjects/convertbase.fr.md index 4f7050889..545abdf84 100644 --- a/subjects/convertbase.fr.md +++ b/subjects/convertbase.fr.md @@ -18,7 +18,7 @@ func ConvertBase(nbr, baseFrom, baseTo string) string { ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main diff --git a/subjects/costumeprofit.en.md b/subjects/costumeprofit.en.md new file mode 100644 index 000000000..e2c6ada59 --- /dev/null +++ b/subjects/costumeprofit.en.md @@ -0,0 +1,24 @@ +## costumeprofit + +### Instructions + +Shop is selling **a** ties, **b** scarfs, **c** waistcoats, **d** jackets. + +- You want to make a costume. There are 2 types of costumes : + - 1 - costume composed of tie and jacket. + - 2 - costume composed of scarf, waistcoat, and jacket. + +Costumes of first type cost **e** dollars, of second type cost **f** dollars. + +What is the maximum amount of dollars that shop can earn by selling costumes? + +Input will be given as 6 arguments, your output should be displayed as standard output. + +In the output put '\n' at the end. + +Input: `./main **a** **b** **c** **d** **e** **f**` + +```console +$> ./main 12 11 13 20 4 6 +102 +``` diff --git a/subjects/countif.en.md b/subjects/countif.en.md index 576a3d2fe..05e84754c 100644 --- a/subjects/countif.en.md +++ b/subjects/countif.en.md @@ -14,7 +14,7 @@ func CountIf(f func(string) bool, tab []string) int { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/countif.fr.md b/subjects/countif.fr.md index 92d3d3b9e..591e99bfe 100644 --- a/subjects/countif.fr.md +++ b/subjects/countif.fr.md @@ -14,7 +14,7 @@ func CountIf(f func(string) bool, tab []string) int { ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main diff --git a/subjects/createelem.en.md b/subjects/createelem.en.md index dcb80f1d9..13bae7444 100644 --- a/subjects/createelem.en.md +++ b/subjects/createelem.en.md @@ -18,7 +18,7 @@ func CreateElem(n *Node, value int) { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/createelem.fr.md b/subjects/createelem.fr.md index ddfaa30ae..efae0c952 100644 --- a/subjects/createelem.fr.md +++ b/subjects/createelem.fr.md @@ -18,7 +18,7 @@ func CreateElem(n *Node, value int) { ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main diff --git a/subjects/displayfile.en.md b/subjects/displayfile.en.md index e13028467..ceff04405 100644 --- a/subjects/displayfile.en.md +++ b/subjects/displayfile.en.md @@ -4,13 +4,13 @@ Write a program that displays, on the standard output, the content of a file given as argument. -- Create a file `quest8.txt` and write into it the sentence `Almost there!!` +- Create a file `quest8.txt` and write into it the sentence `Almost there!!` -- The argument of the program in this case should be, `quest8.txt`. +- The argument of the program in this case should be, `quest8.txt`. -- In case of error the program should print one the below messages accordingly: - - `File name missing`. - - `Too many arguments`. +- In case of error the program should print one the below messages accordingly: + - `File name missing`. + - `Too many arguments`. ### Usage : diff --git a/subjects/displayfile.fr.md b/subjects/displayfile.fr.md index c98641e60..3460b5662 100644 --- a/subjects/displayfile.fr.md +++ b/subjects/displayfile.fr.md @@ -4,15 +4,15 @@ Écrire un programme qui affiche, sur la sortie standard, le contenu d'un fichier donné en argument. -- Créer un fichier `quest8.txt` et écrire dedans la phrase `Almost there!!` +- Créer un fichier `quest8.txt` et écrire dedans la phrase `Almost there!!` -- L'argument pour ce programme sera, dans ce cas, `quest8.txt`. +- L'argument pour ce programme sera, dans ce cas, `quest8.txt`. -- En cas d'erreur le programme doit afficher un des deux messages suivants de manière approprié: - - `File name missing`. - - `Too many arguments`. +- En cas d'erreur le programme doit afficher un des deux messages suivants de manière approprié: + - `File name missing`. + - `Too many arguments`. -### Utilisation: +### Utilisation : ```console student@ubuntu:~/[[ROOT]]/test$ go build diff --git a/subjects/divmod.en.md b/subjects/divmod.en.md index 06714df3b..41f92cb6e 100644 --- a/subjects/divmod.en.md +++ b/subjects/divmod.en.md @@ -2,7 +2,7 @@ ### Instructions -- Write a function that will be formatted as below. +- Write a function that will be formatted as below. ### Expected function @@ -12,20 +12,20 @@ func DivMod(a int, b int, div *int, mod *int) { } ``` -- This function will divide the int **a** and **b**. -- The result of this division will be stored in the int pointed by **div**. -- The remainder of this division will be stored in the int pointed by **mod**. +- This function will divide the int **a** and **b**. +- The result of this division will be stored in the int pointed by **div**. +- The remainder of this division will be stored in the int pointed by **mod**. ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main import ( - "fmt" - piscine ".." + "fmt" + piscine ".." ) func main() { diff --git a/subjects/divmod.fr.md b/subjects/divmod.fr.md index 5f586d30e..cb2665823 100644 --- a/subjects/divmod.fr.md +++ b/subjects/divmod.fr.md @@ -2,7 +2,7 @@ ### Instructions -- Écrire une fonction qui aura le format ci-dessous. +- Écrire une fonction qui aura le format ci-dessous. ### Fonction attendue @@ -12,20 +12,20 @@ func DivMod(a int, b int, div *int, mod *int) { } ``` -- Cette fonction divisera les int **a** et **b**. -- Le résultat de la division sera stocké dans l'int pointé par **div**. -- Le reste de cette division sera stocké dans l'int pointé par **mod**. +- Cette fonction divisera les int **a** et **b**. +- Le résultat de la division sera stocké dans l'int pointé par **div**. +- Le reste de cette division sera stocké dans l'int pointé par **mod**. ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main import ( - "fmt" - piscine ".." + "fmt" + piscine ".." ) func main() { diff --git a/subjects/doop.fr.md b/subjects/doop.fr.md index 8a12b3a91..5fe81bdd9 100644 --- a/subjects/doop.fr.md +++ b/subjects/doop.fr.md @@ -6,9 +6,9 @@ Le programme doit être utilisé avec trois arguments: -- Une valeur -- Un opérateur -- Une autre valeur +- Une valeur +- Un opérateur +- Une autre valeur En cas d'opérateur invalide le programme affiche `0`. diff --git a/subjects/doppelgangerprog.en.md b/subjects/doppelgangerprog.en.md new file mode 100644 index 000000000..fe03ff3c6 --- /dev/null +++ b/subjects/doppelgangerprog.en.md @@ -0,0 +1,47 @@ +## doppelganger + +## **WARNING! VERY IMPORTANT!** + +For this exercise a function will be tested **with the exam own main**. However the student **still needs** to submit a structured program: + +This means that: + +- The package needs to be named `package main`. +- The submitted code needs one declared function main(```func main()```) even if empty. +- The function main declared needs to **also pass** the `Restrictions Checker`(illegal functions tester). It is advised for the student to just empty the function main after its own testings are done. +- Every other rules are obviously the same than for a `program`. + +### Instructions + +You are given 2 strings. Find out if first string contains second string. If it does, return index of the first string where second string occurs last time. If it does not contain, return "-1" + +### Expected function + +```go +package main + +func DoppelGanger(big, little string) int { + +} +``` + +```go +package main + +import ( + "fmt" +) + +func main() { + var result int + + result = DoppelGanger("aaaaaaa", "a") + fmt.Println(result) // 6 + + result = DoppelGanger("qwerty", "t") + fmt.Println(result) // 4 + + result = DoppelGanger("a", "b") + fmt.Println(result) // -1 +} +``` diff --git a/subjects/enigma.en.md b/subjects/enigma.en.md index c3da457e7..426254e4b 100644 --- a/subjects/enigma.en.md +++ b/subjects/enigma.en.md @@ -6,10 +6,10 @@ Write a function called `Enigma` that receives pointers to as arguments and move This function will put : -- `a` into `c`. -- `c` into `d`. -- `d` into `b`. -- `b` into `a`. +- `a` into `c`. +- `c` into `d`. +- `d` into `b`. +- `b` into `a`. ### Expected function @@ -21,7 +21,7 @@ func Enigma(a ***int, b *int, c *******int, d ****int) { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/enigma.fr.md b/subjects/enigma.fr.md index 72b024ca5..57cbf1d85 100644 --- a/subjects/enigma.fr.md +++ b/subjects/enigma.fr.md @@ -5,10 +5,10 @@ Écrire une fonction nommé `Enigma` qui prends des pointeurs comme arguments et qui interchanges leurs valeurs pour les cacher. Cette fonction déplacera : -- `a` dans `c`. -- `c` dans `d`. -- `d` dans `b`. -- `b` dans `a`. +- `a` dans `c`. +- `c` dans `d`. +- `d` dans `b`. +- `b` dans `a`. ### Fonction attendue @@ -20,7 +20,7 @@ func Enigma(a ***int, b *int, c *******int, d ****int) { ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main diff --git a/subjects/fib.en.md b/subjects/fib.en.md new file mode 100644 index 000000000..5bf6c2043 --- /dev/null +++ b/subjects/fib.en.md @@ -0,0 +1,60 @@ +## fib + +## **WARNING! VERY IMPORTANT!** + +For this exercise a function will be tested **with the exam own main**. However the student **still needs** to submit a structured program: + +This means that: + +- The package needs to be named `package main`. +- The submitted code needs one declared function main(```func main()```) even if empty. +- The function main declared needs to **also pass** the `Restrictions Checker`(illegal functions tester). It is advised for the student to just empty the function main after its own testings are done. +- Every other rules are obviously the same than for a `program`. + +### Instructions + +It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like). +Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32. + +The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for those interested. Sections 1.10.32 and 1.10.33 from "de Finibus Bonorum et Malorum" by Cicero are also reproduced in their exact original form, accompanied by English versions from the 1914 translation by H. Rackham. + +You are given a non-negative integer n, please find nth element of fibonacci sequence. +Fib(0) = 0, +Fib(1) = 1, otherwise, nth element is the sum of the 2 previous elements of the series. + +### Expected function + +```go +func Fib(n int) int { + +} +``` + +### Usage + +Here is a possible program to test your function : + +```go +package main + +import ( + "fmt" +) + +func main() { + fmt.Println(Fib(0)) + fmt.Println(Fib(1)) + fmt.Println(Fib(2)) +} +``` + +And its output : + +```console +student@ubuntu:~/[[ROOT]]/test$ go build +student@ubuntu:~/[[ROOT]]/test$ ./test +0 +1 +1 +student@ubuntu:~/[[ROOT]]/test$ +``` diff --git a/subjects/fibonacci.en.md b/subjects/fibonacci.en.md index 96059c762..6b7b298e6 100644 --- a/subjects/fibonacci.en.md +++ b/subjects/fibonacci.en.md @@ -24,14 +24,14 @@ func Fibonacci(index int) int { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main import ( -        "fmt" -        piscine ".." + "fmt" + piscine ".." ) func main() { diff --git a/subjects/fibonacci.fr.md b/subjects/fibonacci.fr.md index 173f6ae43..8d05b3ef2 100644 --- a/subjects/fibonacci.fr.md +++ b/subjects/fibonacci.fr.md @@ -30,8 +30,8 @@ Voici un éventuel `main.go` : package main import ( -        "fmt" -        piscine ".." + "fmt" + piscine ".." ) func main() { diff --git a/subjects/findnextprime.en.md b/subjects/findnextprime.en.md index 9ceeab00c..79cfc5786 100644 --- a/subjects/findnextprime.en.md +++ b/subjects/findnextprime.en.md @@ -16,7 +16,7 @@ func FindNextPrime(nb int) int { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/findnextprime.fr.md b/subjects/findnextprime.fr.md index 5ca592762..1fe3a1006 100644 --- a/subjects/findnextprime.fr.md +++ b/subjects/findnextprime.fr.md @@ -16,14 +16,14 @@ func FindNextPrime(nb int) int { ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main import ( -        "fmt" -        piscine ".." + "fmt" + piscine ".." ) func main() { diff --git a/subjects/findprevprimeprog.en.md b/subjects/findprevprimeprog.en.md new file mode 100644 index 000000000..1d134f769 --- /dev/null +++ b/subjects/findprevprimeprog.en.md @@ -0,0 +1,53 @@ +## findprevprime + +## **WARNING! VERY IMPORTANT!** + +For this exercise a function will be tested **with the exam own main**. However the student **still needs** to submit a structured program: + +This means that: + +- The package needs to be named `package main`. +- The submitted code needs one declared function main(\`\`\`func main()\`\`\`) even if empty. +- The function main declared needs to **also pass** the \`Restrictions Checker\`(illegal functions tester). It is advised for the student to just empty the function main after its own testings are done. +- Every other rules are obviously the same than for a \`program\`. + +### Instructions + +Write a function that returns the first prime number that is equal or inferior to the `int` passed as parameter. + +If there are no primes inferior to the `int` passed as parameter the function should return 0. + +### Expected function + +```go +func FindPrevPrime(nb int) int { + +} +``` + +### Usage + +Here is a possible [program](TODO-LINK) to test your function : + +```go +package main + +import ( + "fmt" +) + +func main() { + fmt.Println(FindPrevPrime(5)) + fmt.Println(FindPrevPrime(4)) +} +``` + +And its output : + +```console +student@ubuntu:~/piscine-go/test$ go build +student@ubuntu:~/piscine-go/test$ ./test +5 +3 +student@ubuntu:~/piscine-go/test$ +``` diff --git a/subjects/firstrune.en.md b/subjects/firstrune.en.md index 848882db1..971d5ffdb 100644 --- a/subjects/firstrune.en.md +++ b/subjects/firstrune.en.md @@ -14,7 +14,7 @@ func FirstRune(s string) rune { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/firstrune.fr.md b/subjects/firstrune.fr.md index 341311e75..17b39e4e0 100644 --- a/subjects/firstrune.fr.md +++ b/subjects/firstrune.fr.md @@ -14,7 +14,7 @@ func FirstRune(s string) rune { ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main diff --git a/subjects/firstword.en.md b/subjects/firstword.en.md index 971862b3c..06a5df88c 100644 --- a/subjects/firstword.en.md +++ b/subjects/firstword.en.md @@ -4,11 +4,11 @@ Write a program that takes a `string` and displays its first word, followed by a newline (`'\n'`). -- A word is a section of `string` delimited by spaces or by the start/end of the `string`. +- A word is a section of `string` delimited by spaces or by the start/end of the `string`. -- The output will be followed by a newline (`'\n'`). +- The output will be followed by a newline (`'\n'`). -- If the number of parameters is not 1, or if there are no words, the program displays a newline (`'\n'`). +- If the number of parameters is not 1, or if there are no words, the program displays a newline (`'\n'`). ### Usage diff --git a/subjects/firstword.fr.md b/subjects/firstword.fr.md index aeb27f8f3..5bca5b64c 100644 --- a/subjects/firstword.fr.md +++ b/subjects/firstword.fr.md @@ -4,11 +4,11 @@ Écrire un programme qui prend une `string` et qui affiche son premier mot, suivi d'un retour à la ligne (`'\n'`). -- Un mot est une section de `string` délimité par des espace ou par le début/fin d'une `string`. +- Un mot est une section de `string` délimité par des espace ou par le début/fin d'une `string`. -- L'output sera suivi d'un retour à la ligne (`'\n'`). +- L'output sera suivi d'un retour à la ligne (`'\n'`). -- Si le nombre de paramètres n'est pas 1, ou si il n'y a pas de mots, le programme affiche un retour à la ligne (`'\n'`). +- Si le nombre de paramètres n'est pas 1, ou si il n'y a pas de mots, le programme affiche un retour à la ligne (`'\n'`). ### Utilisation diff --git a/subjects/foldint.en.md b/subjects/foldint.en.md new file mode 100644 index 000000000..ee0557917 --- /dev/null +++ b/subjects/foldint.en.md @@ -0,0 +1,64 @@ +## foldint + +## **WARNING! VERY IMPORTANT!** + +For this exercise a function will be tested **with the exam own main**. However the student **still needs** to submit a structured program: + +This means that: + +- The package needs to be named `package main`. +- The submitted code needs one declared function main(```func main()```) even if empty. +- The function main declared needs to **also pass** the `Restrictions Checker\`(illegal functions tester). It is advised for the student to just empty the function main after its own testings are done. +- Every other rules are obviously the same than for a `program`. + +### Instructions + +Write a function called `FoldInt` that simulates the behavior of reduce from JavaScript. + +The function should have as parameters a function, `f func(int, int) int` a slice of integers, `slice []int` and an int `acc int`. You should apply for each element of the slice the arithmetic function, saving and printing it. The function will be tested with our own functions `Add, Sub, and Mul`. + +### Expected function + +```go +func FoldInt(f func(int, int) int, arr []int, n int) { + +} +``` + +### Usage + +Here is a possible program to test your function: + +```go +package main + +func main() { + table := []int{1, 2, 3} + ac := 93 + FoldInt(Add, table, ac) + FoldInt(Mul, table, ac) + FoldInt(Sub, table, ac) + fmt.Println() + + table = []int{0} + FoldInt(Add, table, ac) + FoldInt(Mul, table, ac) + FoldInt(Sub, table, ac) +} + +``` + +And its output : + +```console +student@ubuntu:~/[[ROOT]]/test$ go build +student@ubuntu:~/[[ROOT]]/test$ ./test +99 +558 +87 + +93 +0 +93 +student@ubuntu:~/[[ROOT]]/test$ +``` diff --git a/subjects/foreach.en.md b/subjects/foreach.en.md index a89661b11..afd1a34d3 100644 --- a/subjects/foreach.en.md +++ b/subjects/foreach.en.md @@ -14,7 +14,7 @@ func ForEach(f func(int), arr []int) { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/foreach.fr.md b/subjects/foreach.fr.md index c39355625..6f69a27bc 100644 --- a/subjects/foreach.fr.md +++ b/subjects/foreach.fr.md @@ -14,7 +14,7 @@ func ForEach(f func(int), arr []int) { ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main diff --git a/subjects/foreachprog.en.md b/subjects/foreachprog.en.md index b24e45c8f..0465bdb89 100644 --- a/subjects/foreachprog.en.md +++ b/subjects/foreachprog.en.md @@ -25,7 +25,7 @@ func ForEach(f func(int), arr []int) { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/forum/authentication.audit.en.md b/subjects/forum/authentication.audit.en.md new file mode 100644 index 000000000..a41aa6f60 --- /dev/null +++ b/subjects/forum/authentication.audit.en.md @@ -0,0 +1,43 @@ +#### Functional + +##### Try to login with Github. + +###### Is it possible to enter the forum? + +##### Try to login with Google. + +###### Is it possible to enter the forum? + +##### Try login with Github or Google, creating a post with that user and logout. + +###### Is the post created visible? + +##### Try to login with the user you created. + +###### Can you login and have all the rights of a registered user? + +##### Try creating an account twice with the same credential. + +###### Does it present an error? + +##### Try to enter your account with no email, password or with errors in any of them. + +###### Does it present an error and an error message? + +###### Does the registration ask for an email and a password? + +#### General + +###### +Does the project present more than two different authentication methods? + +#### Basic + +###### +Does the project run quickly and effectively (favoring of recursion, no unnecessary data requests, etc.)? + +###### +Does the code obey the [good practices](https://github.com/01-edu/public/blob/master/subjects/good-practices.en.md)? + +#### Social + +###### +Did you learn anything from this project? + +###### +Would you recommend/nominate this program as an example for the rest of the school? diff --git a/subjects/forum/authentication.en.md b/subjects/forum/authentication.en.md new file mode 100644 index 000000000..bb2f9b632 --- /dev/null +++ b/subjects/forum/authentication.en.md @@ -0,0 +1,22 @@ +## authentication + +### Objectives + +The goal of this project is to implement, into your forum, new ways of authentication. You have to be able to register and to login using at least Google and Github authentication tools. + +Some examples of authentication means are: + +- Facebook +- GitHub +- Google + +This project will help you learn about: + +- Sessions and cookies. +- Protecting routes. + +### Instructions + +- Your project must have implemented at least the two authentication examples given. +- Your project must be written in **Go**. +- The code must respect the [**good practices**](https://public.01-edu.org/subjects/good-practices.en). diff --git a/subjects/forum/forum-advanced-features.audit.en.md b/subjects/forum/forum-advanced-features.audit.en.md new file mode 100644 index 000000000..824907e53 --- /dev/null +++ b/subjects/forum/forum-advanced-features.audit.en.md @@ -0,0 +1,55 @@ +### Functional + +##### Try to like any post of your choice. + +###### Does the liked post appear on the activity page? + +##### Try to dislike any post of your choice. + +###### Does the disliked post appear on the activity page? + +##### Try to comment any post of your choice. + +###### Does the comment appear on the activity page along with the commented post you made? + +##### Try to create a new post. + +###### Does new post appear on the activity page? + +##### Try to login as another user and make a comment on the post you created above. Then return to the user that created the post. + +###### Did the user who created the post received a notification saying that the post has been commented? + +##### Try to login as another user and like the post you created above. Then return to the user that created the post. + +###### Did the user who created the post received a notification saying that the post has been liked? + +##### Try to login as another user and dislike the post you created above. Then return to the user that created the post. + +###### Did the user who created the post received a notification saying that the post has been disliked? + +##### Try to edit a post and a comment of your choice. + +###### Is it allowed to edit posts and comments? + +##### Try to remove a post and a comment of your choice. + +###### Is it allowed to remove posts and comments? + +#### General + +##### +Are there any other feature not mentioned in the [subject](https://public.01-edu.org/subjects/forum/forum-advanced-features.en)? + +#### Basic + +###### +Does the project runs quickly and effectively (Favoring of recursion, no unnecessary data requests, etc.)? + +###### +Does the code obey the [good practices](https://public.01-edu.org/subjects/good-practices.en)? + +###### +Is there a test file for this code? + +#### Social + +###### +Did you learn anything from this project? + +###### +Would you recommend/nominate this program as an example for the rest of the school? diff --git a/subjects/forum/forum-advanced-features.en.md b/subjects/forum/forum-advanced-features.en.md new file mode 100644 index 000000000..1f2583a38 --- /dev/null +++ b/subjects/forum/forum-advanced-features.en.md @@ -0,0 +1,36 @@ +## forum-advanced-features + +### Objectives + +You must follow the same [principles](https://public.01-edu.org/subjects/forum/forum.en) as the first subject. + +In `forum advanced features`, you will have to implement the following features : + +- You will have to create a way to notify users when their posts are : + + - liked/disliked + - commented + +- You have to create an activity page that tracks the user own activity. In other words, a page that : + + - Shows the user created posts + - Shows where the user left a like or a dislike + - Shows where and what the user has been commenting. For this, the comment will have to be shown, as well as the post commented + +- You have to create a section where you will be able to Edit/Remove posts and comments. + +We encourage you to add any other additional features that you find relevant. + +This project will help you learn about : + +- Data manipulation and storage + +### Instructions + +- The backend must be written in **Go** +- The code must respect the [good practices](https://public.01-edu.org/subjects/good-practices.en) +- It is recommended that the code should present a **test file** + +### Allowed packages + +- The [standard go](https://golang.org/pkg/) packages are allowed diff --git a/subjects/forum/forum-image-upload.audit.en.md b/subjects/forum/forum-image-upload.audit.en.md new file mode 100644 index 000000000..d915e2f24 --- /dev/null +++ b/subjects/forum/forum-image-upload.audit.en.md @@ -0,0 +1,37 @@ +#### Functional + +##### Try creating a post with a PNG image. + +###### Was the post created successfully? + +##### Try creating a post with a JPEG image. + +###### Was the post created successfully? + +##### Try creating a post with a GIF image. + +###### Was the post created successfully? + +##### Try to create a post with an [image](https://effigis.com/wp-content/themes/effigis_2014/img/RapidEye_RapidEye_5m_RGB_Altotting_Germany_Agriculture_and_Forestry_2009MAY17_8bits_sub_r_2.jpg) bigger than 20mb. + +###### Were you warned that this was not possible? + +##### Try navigating through the site and come back to one of the created posts. + +###### Can you still see the image associated to that post? + +#### General + +###### +Can you create a post with a different image type? + +#### Basic + +###### +Does the code obey the [good practices](https://public.01-edu.org/subjects/good-practices.en)? + +###### +Are the instructions in the website clear? + +#### Social + +###### +Did you learn anything from this project? + +###### +Would you recommend/nominate this program as an example for the rest of the school? diff --git a/subjects/forum/forum-image-upload.en.md b/subjects/forum/forum-image-upload.en.md new file mode 100644 index 000000000..02529c0be --- /dev/null +++ b/subjects/forum/forum-image-upload.en.md @@ -0,0 +1,33 @@ +## forum-image-upload + +### Objectives + +You must follow the same [principles](https://public.01-edu.org/subjects/forum/forum.en) as the first subject. + +In `forum image upload`, registered users have the possibility to create a post containing an image as well as text. + +- When viewing the post, users and guests should see the image associated to it. + +There are various extensions for images like: JPEG, SVG, PNG, GIF, etc. In this project you have to handle at least JPEG, PNG and GIF types. + +The max size of the images to load should be 20 mb. If there is an attempt to load an image greater than 20mb, an error message should inform the user that the image is too big. + +This project will help you learn about: + +- Image manipulation +- Image types + +### Hints + +- Be cautious with the size of the images. + +### Instructions + +- The backend must be written in **Go**. +- You must handle website errors. +- The code must respect the [good practices](https://public.01-edu.org/subjects/good-practices.en) +- It is recommended that the code should present a **test file**. + +### Allowed packages + +- Only the [standard go](https://golang.org/pkg/) packages are allowed diff --git a/subjects/forum/forum-moderation.audit.md b/subjects/forum/forum-moderation.audit.md new file mode 100644 index 000000000..f0d37a3d0 --- /dev/null +++ b/subjects/forum/forum-moderation.audit.md @@ -0,0 +1,49 @@ +#### Functional + +###### Does the forum present the 4 types of users? + +##### Try to enter the forum as a Guest + +###### Can you confirm that the content is only viewable? + +##### Try registering as a normal user. + +###### Can you create posts and comments? + +##### Try registering as a normal user. + +###### Can you like or dislike a post? + +##### Try registering as a moderator. Then login to an admin account and see if the admin user has received the request. + +###### Can you confirm that the admin received the request? + +##### Try accepting a moderator using the admin user. + +###### Has the moderator been promoted? + +##### Try using the moderator to delete a obscene post + +###### Can you confirm that it is possible? + +##### Try using the moderator to report a illegal post + +###### Did the admin user receive the report? + +##### Try using the admin user to answer the moderator request. + +###### Did the moderator receive the answer from the admin? + +##### Try using an admin user to demote a moderator. + +###### Can you confirm that it is possible? + +#### General + +###### +Does the project present more then 4 types of users? + +#### Social + +###### +Did you learn anything from this project? + +###### +Would you recommend/nominate this program as an example for the rest of the school? diff --git a/subjects/forum/forum-moderation.en.md b/subjects/forum/forum-moderation.en.md new file mode 100644 index 000000000..a4c954bee --- /dev/null +++ b/subjects/forum/forum-moderation.en.md @@ -0,0 +1,51 @@ +## forum-moderation + +### Objectives + +You must follow the same [principles](https://public.01-edu.org/subjects/forum/forum.en) as the first subject. + +The `forum-moderation` will be based on a moderation system. It must present a moderator that, depending on the access level of a user or the forum set-up, approves posted messages before they become publicly visible. + +- The filtering can be done depending on the categories of the post being sorted by irrelevant, obscene, illegal or insulting. + +For this optional you should take into account all types of users that can exist in a forum and their levels. + +You should implement at least 4 types of users : + +#### Guests + +- These are unregistered-users that can neither post, comment, like or dislike a post. They only have the permission to **see** those posts, comments, likes or dislikes. + +#### Users + +- These are the users that will be able to create, comment, like or dislike posts. + +#### Moderators + +- Moderators, as explained above, are users that have a granted access to special functions : + - They should be able to monitor the content in the forum by deleting or reporting post to the admin +- To create a moderator the user should request an admin for that role + +#### Administrators + +- Users that manage the technical details required for running the forum. This user must be able to : + - Promote or demote a normal user to, or from a moderator user. + - Receive reports from moderators. If the admin receives a report from a moderator, he can respond to that report + - Delete posts and comments + - Manage the categories, by being able to creating and deleting them. + +This project will help you learn about : + +- Moderation System +- User access levels + +### Allowed packages + +- All [standard go](https://golang.org/pkg/) packages are allowed. + +### Instructions + +- You must handle website errors, HTTPS status. +- You must handle all sort of technical errors. +- The code must respect the [**good practices**](https://public.01-edu.org/subjects/good-practices.en). +- It is recommended that the code should present a **test file**. diff --git a/subjects/forum/forum-security.audit.en.md b/subjects/forum/forum-security.audit.en.md new file mode 100644 index 000000000..05d9f2e94 --- /dev/null +++ b/subjects/forum/forum-security.audit.en.md @@ -0,0 +1,51 @@ +#### Functional + +##### Try opening the forum. + +###### Does the URL contain HTTPS? + +###### Is the project implementing [cipher suites](https://www.iana.org/assignments/tls-parameters/tls-parameters.xml)? + +###### Is the Go TLS structure well configured? + +###### Is the [server](https://golang.org/pkg/net/http/#Server) timeout reduced (Read, write and IdleTimeout)? + +###### Does the project implement [Rate limiting](https://en.wikipedia.org/wiki/Rate_limiting) (avoiding [DoS attacks](https://en.wikipedia.org/wiki/Denial-of-service_attack))? + +##### Try to access the database. + +###### Does the database present a password for protection? + +##### Try creating a user. Go to the database using the command `"sqlite3 "` and run `"SELECT * FROM ;"` to select all users. + +###### Are the passwords encrypted? + +##### Try to login into the forum and open the inspector(CTRL+SHIFT+i) and go to the storage to see the cookies(this can be different depending on the [browser](https://developer.mozilla.org/en-US/docs/Learn/Common_questions/What_are_browser_developer_tools)). + +###### Does the session cookie present a UUID(Universal Unique Identifier)? + +###### Does the project present a way to configure the certificates information, either via .env or config files or another method? + +###### Are only the allowed packages being used? + +#### General + +###### +Does the project implement their own certificates for the HTTPS protocol? + +###### +Does the project implement UUID(Universal Unique Identifier) for the user session? + +#### Basic + +###### +Does the project runs quickly and effectively? (no unnecessary data requests, etc) + +###### +Does the code obey the [good practices](https://public.01-edu.org/subjects/good-practices.en)? + +###### +Is there a test file for this code? + +#### Social + +###### +Did you learn anything from this project? + +###### +Can it be open-sourced / be used for other sources? + +###### +Would you recommend/nominate this program as an example for the rest of the school? diff --git a/subjects/forum/forum-security.en.md b/subjects/forum/forum-security.en.md new file mode 100644 index 000000000..f61a1f23a --- /dev/null +++ b/subjects/forum/forum-security.en.md @@ -0,0 +1,51 @@ +## forum-security + +### Objectives + +You must follow the same [principles](https://public.01-edu.org/subjects/forum/forum.en) as the first subject. + +For this project you must take into account the security of your forum. + +- You should implement a Hypertext Transfer Protocol Secure ([HTTPS](https://www.globalsign.com/en/blog/the-difference-between-http-and-https)) protocol : + + - Encrypted connection : for this you will have to generate an SSL certificate, you can think of this like a identity card for your website. You can create your certificates or use "Certificate Authorities"(CA's) + +- Clients session cookies should be unique. For instance, the session state is stored on the server and the session should present an unique identifier. This way the client has no direct access to it. Therefore, there is no way for attackers to read or tamper with session state. + +- The implementation of [Rate Limiting](https://en.wikipedia.org/wiki/Rate_limiting) must be present on this project + +- You should encrypt : + - Clients passwords + - Database, for this you will have to create a password for your database. + +This project will help you learn about : + +- HTTPS +- [Cipher suites](https://www.iana.org/assignments/tls-parameters/tls-parameters.xml) +- Goroutines +- Channels +- Rate Limiting +- Encryption + - password + - session/cookies + - Universal Unique Identifier (UUID) + +### Hints + +- You can take a look at the `openssl` manual. +- For the session cookies you can take a look at the [Universal Unique Identifier (UUID)](https://en.wikipedia.org/wiki/Universally_unique_identifier) + +### Instructions + +- You must handle website errors, HTTPS status. +- You must handle all sort of technical errors. +- The code must respect the [**good practices**](https://public.01-edu.org/subjects/good-practices.en). +- It is recommended that the code should present a **test file**. + +### Allowed packages + +- All [standard go](https://golang.org/pkg/) packages are allowed. +- golang.org/x/crypto/bcrypt +- github.com/satori/go.uuid +- github.com/mattn/go-sqlite3 +- golang.org/x/crypto/acme/autocert diff --git a/subjects/forum/forum.audit.en.md b/subjects/forum/forum.audit.en.md new file mode 100644 index 000000000..fb88882dd --- /dev/null +++ b/subjects/forum/forum.audit.en.md @@ -0,0 +1,177 @@ +#### Authentication + +###### Are an email and a password asked for in the resgistration? + +###### Does the project detect if the email or password are wrong? + +###### Does the project detect if the email or user name is already taken in the registration? + +##### Try to register as a new user in the forum. + +###### Is it possible to register? + +##### Try to login with the user you created. + +###### Can you login and have all the rights of a registered user? + +##### Try to login without any credentials. + +###### Does it show a warning message? + +###### Are sessions present in the project? + +##### Try opening two different browsers and login into one of them. Refresh the other browser. + +###### Can you confirm that the browser non logged remains unregistered? + +##### Try opening two different browsers and login into one of them. Then create a new post or just add a comment. Refresh both browsers. + +###### Does it present the comment/post on both browsers? + +#### SQLite + +###### Does the code contain at least one CREATE query? + +###### Does the code contain at least one INSERT query? + +###### Does the code contain at least one SELECT query? + +##### Try registering in the forum, open the database with `sqlite3 ` and perform a query to select all the users (Example: SELECT \* FROM users;). + +###### Does it present the user you created? + +##### Try creating a post in the forum, open the database with `sqlite3 ` and perform a query to select all the users (Example: SELECT \* FROM post;). + +###### Does it present the post you created? + +##### Try creating a comment in the forum, open the database with `sqlite3 ` and perform a query to select all the users (Example: SELECT \* FROM comment;). + +###### Does it present the comment you created? + +#### Docker + +###### Does the project have Dockerfiles? + +##### Try to run the command `"docker image build [OPTINS] PATH | URL | -"` to build the image using using the project Dockerfiles and run the command `"docker images"` to see images. + +``` +student$ docker images +REPOSITORY TAG IMAGE ID CREATED SIZE + latest 85a65d66ca39 7 seconds ago 795MB +``` + +###### Does all images build as above? + +##### Try running the command `"docker container run [OPTIONS] IMAGE [COMMAND] [ARG...]"` to start the containers using the images just created and run the command `"docker ps -a"` to see containers. + +``` +student$ docker ps -a +CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES +cc8f5dcf760f "./server" 6 seconds ago Up 6 seconds 0.0.0.0:8080->8080/tcp ascii-art-web +``` + +###### Is the docker containers running as above? + +###### Does the project present no [unused object](https://docs.docker.com/config/pruning/)? + +#### Functional + +##### Enter the forum as a non-registered user. + +###### Are you prohibited to create a post? + +##### Enter the forum as a non-registered user. + +###### Are you prohibited to create a comment? + +##### Enter the forum as a non-registered user and try to like a comment. + +###### Are you prohibited to like a post? + +##### Enter the forum as a non-registered user and try to dislike a comment. + +###### Are you prohibited to dislike a comment? + +##### Enter the forum as a registered user, go to a post and try to create a comment for it. + +###### Were you able to create the comment? + +##### Enter the forum as a registered user, go to a post and try to create an empty comment for it. + +###### Were you prohibited to create the comment? + +##### Enter the forum as a registered user and try to create a post. + +###### Were you able to create a post? + +##### Enter the forum as a registered user and try to create an empty post. + +###### Were you prohibited to create the post? + +##### Try creating a post as a registered user and try to choose a category for that post. + +###### Were you able to choose a category for that post? + +##### Enter the forum as a registered user and try to like or dislike a post. + +###### Can you like or dislike the post? + +##### Enter the forum as a registered user and try to like or dislike a comment. + +###### Can you like or dislike the comment? + +##### Enter the forum as a registered user, try liking and disliking a post and then refresh the page. + +###### Does the number of likes/dislikes change? + +##### Enter the forum as a registered user and try to like and then dislike the same post. + +###### Can you confirm that it is not possible that the post is liked and disliked at the same time? + +##### Enter the forum as a registered user and try seeing all of your created posts. + +###### Does it present the expected posts? + +##### Enter the forum as a registered user and try seeing all of your liked posts. + +###### Does it present the expected posts? + +##### Navigate to a post of your choice and see its comments. + +###### Are all users (registered or not) able to see the number of likes and dislikes that comment has? + +##### Try seeing all posts from one category using the filter. + +###### Are all posts displayed from that category? + +###### Did the server behaved as expected?(did not crashed) + +###### Does the server use the right [HTTP method](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods)? + +###### Are all the pages working? (Absence of 404 page?) + +###### Does the project handle [HTTP status 400 - Bad Requests](https://kinsta.com/knowledgebase/400-bad-request/#causes)? + +###### Does the project handle [HTTP status 500 - Internal Server Errors](https://www.restapitutorial.com/httpstatuscodes.html)? + +###### Are only the allowed packages being used? + +#### General + +###### +Does the project present a script to build the images and containers? (using a script to simplify the build) + +#### Basic + +###### +Does the project runs quickly and effectively? (Favoring recursive, no unnecessary data requests, etc) + +###### +Does the code obey the [good practices](https://public.01-edu.org/subjects/good-practices.en)? + +###### +Is there a test file for this code? + +#### Social + +###### +Did you learn anything from this project? + +###### +Can it be open-sourced / be used for other sources? + +###### +Would you recommend/nominate this program as an example for the rest of the school? diff --git a/subjects/forum/forum.en.md b/subjects/forum/forum.en.md new file mode 100644 index 000000000..7abdc829d --- /dev/null +++ b/subjects/forum/forum.en.md @@ -0,0 +1,100 @@ +## forum + +### Objectives + +This project consists in creating a web forum that allows : + +- communication between users. +- associating categories to posts. +- liking and disliking posts and comments. +- filtering posts. + +#### SQLite + +In order to store the data in your forum (like users, posts, comments, etc.) you will use the database library SQLite. + +SQLite is a popular choice as embedded database software for local/client storage in application software such as web browsers. It enables you to create a database as well as controlling it by using queries. + +To structure your database and to achieve better performance we highly advise you to take a look at the [entity relationship diagram](https://www.smartdraw.com/entity-relationship-diagram/) and build one based on your own database. + +- You must use at least one SELECT, one CREATE and one INSERT queries. + +To know more about SQLite you can check the [SQLite page](https://www.sqlite.org/index.html). + +#### Authentication + +In this segment the client must be able to `register` as a new user on the forum, by inputting their credentials. You also have to create a `login session` to access the forum and be able to add posts and comments. + +You should use cookies to allow each user to have only one opened session. Each of this sessions must contain an expiration date. It is up to you to decide how long the cookie stays "alive". + +Instructions for user registration: + +- Must ask for email + - When the email is already taken return an error response. +- Must ask for username +- Must ask for password + - The password must be encrypted when stored + +The forum must be able to check if the email provided is present in the database and if all credentials are correct. It will check if the password is the same with the one provided and, if the password is not the same, it will return an error response. + +#### Communication + +In order for users to communicate between each other, they will have to be able to create posts and comments. + +- Only registered users will be able to create posts and comments. +- When registered users are creating a post they can associate one or more categories to it. + - The implementation and choice of the categories is up to you. +- The posts and comments should be visible to all users (registered or not). +- Non-registered users will only be able to see posts and comments. + +#### Likes and Dislikes + +Only registered users will be able to like or dislike posts and comments. + +The number of likes and dislikes should be visible by all users (registered or not). + +#### Filter + +You need to implement a filter mechanism, that will allow users to filter the displayed posts by : + +- categories +- created posts +- liked posts + +You can look at filtering by categories as subforums. A subforum is a section of an online forum dedicated to a specific topic. + +Note that the last two are only available for registered users and must refer to the logged in user. + +#### Docker + +For the forum project you must use Docker. You can see all about docker basics on the [ascii-art-web-dockerize](https://public.01-edu.org/subjects/ascii-art-web/ascii-art-web-dockerize.en) subject. + +This project will help you learn about: + +- Client utilities. +- The basics of web : + - HTML + - HTTP + - Sessions and cookies +- Using and [setting up Docker](https://docs.docker.com/get-started/) + - Containerizing an application + - Compatibility/Dependency + - Creating images +- SQL language + - Manipulation of databases +- The basics of encryption + +### Instructions + +- You must use **SQLite**. +- You must handle website errors, HTTP status. +- You must handle all sort of technical errors. +- The code must respect the [**good practices**](https://public.01-edu.org/subjects/good-practices.en). +- It is recommended that the code should present a **test file**. + +### Allowed packages + +- All [standard go](https://golang.org/pkg/) packages are allowed. +- github.com/mattn/go-sqlite3 +- golang.org/x/crypto/bcrypt +- github.com/satori/go.uuid diff --git a/subjects/fprime.en.md b/subjects/fprime.en.md index 2e99ae99a..db2c2a601 100644 --- a/subjects/fprime.en.md +++ b/subjects/fprime.en.md @@ -4,11 +4,11 @@ Write a program that takes a positive `int` and displays its prime factors, followed by a newline (`'\n'`). -- Factors must be displayed in ascending order and separated by `*`. +- Factors must be displayed in ascending order and separated by `*`. -- If the number of parameters is different from 1, the program displays a newline. +- If the number of parameters is different from 1, the program displays a newline. -- The input, when there is one, will always be valid. +- The input, when there is one, will always be valid. ### Usage diff --git a/subjects/fprime.fr.md b/subjects/fprime.fr.md index 7a2264905..7dbb7f7bc 100644 --- a/subjects/fprime.fr.md +++ b/subjects/fprime.fr.md @@ -4,11 +4,11 @@ Écrire un programme qui prend un `int` positif et qui affiche ses facteurs premiers sur la sortie standard, suivi d'un retour à la ligne (`'\n'`). -- Les facteurs doivent être affichés en ordre croissant et séparés par `*`. +- Les facteurs doivent être affichés en ordre croissant et séparés par `*`. -- Si le nombre de paramètres est différent de 1, le programme affiche un retour à la ligne. +- Si le nombre de paramètres est différent de 1, le programme affiche un retour à la ligne. -- L'input (l'entrée), quand il y en a un, sera toujours valide. +- L'input (l'entrée), quand il y en a un, sera toujours valide. ### Utilisation diff --git a/subjects/game23.en.md b/subjects/game23.en.md new file mode 100644 index 000000000..b9cfe008f --- /dev/null +++ b/subjects/game23.en.md @@ -0,0 +1,58 @@ +## game23 + +## **WARNING! VERY IMPORTANT!** + +For this exercise a function will be tested **with the exam own main**. However the student **still needs** to submit a structured program: + +This means that: + +- The package needs to be named `package main`. +- The submitted code needs one declared function main(```func main()```) even if empty. +- The function main declared needs to **also pass** the `Restrictions Checker`(illegal functions tester). It is advised for the student to just empty the function main after its own testings are done. +- Every other rules are obviously the same than for a `program`. + +### Instructions + +It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like). +Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32. + +The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for those interested. Sections 1.10.32 and 1.10.33 from "de Finibus Bonorum et Malorum" by Cicero are also reproduced in their exact original form, accompanied by English versions from the 1914 translation by H. Rackham. + +You are given 2 positive integers 'a' and 'b'. Your task is to perform some operations in 'a' so that it becomes 'b'. You can only multiply 'a' by 2, and multiply 'a' by 3. If you can get to 'b', return minimal number of operations required to get from 'a' to 'b'. If you cannot get to 'b' return -1. + +### Expected function + +```go +func Game23(a, b int) int { + +} +``` + +### Usage + +Here is a possible program to test your function : + +```go +package main + +import ( + "fmt" +) + +func main() { + fmt.Println(Game23(1, 3)) + fmt.Println(Game23(2, 3)) + fmt.Println(Game23(10, 60)) +} +``` + +And its output : + +```console +student@ubuntu:~/[[ROOT]]/test$ go build +student@ubuntu:~/[[ROOT]]/test$ ./test +1 +-1 +2 +student@ubuntu:~/[[ROOT]]/test$ +``` diff --git a/subjects/good-practices.en.md b/subjects/good-practices.en.md index 708e962e3..5cb0a4fb1 100644 --- a/subjects/good-practices.en.md +++ b/subjects/good-practices.en.md @@ -7,8 +7,8 @@ - Avoid Obvious Comments - Code Grouping - Consistent Naming Scheme - - camelCase - - under_scores + - camelCase + - under_scores - [**DRY**](https://thefullstack.xyz/dry-yagni-kiss-tdd-soc-bdfu) (Don't Repeat Yourself) or [**DIE**](https://thefullstack.xyz/dry-yagni-kiss-tdd-soc-bdfu) (Duplication is Evil) principle - [**KISS**](https://thefullstack.xyz/dry-yagni-kiss-tdd-soc-bdfu) (Keep It Simple Stupid) - [**YAGNI**](https://thefullstack.xyz/dry-yagni-kiss-tdd-soc-bdfu) (You Aren’t Gonna Need It) diff --git a/subjects/groupie-trackers/groupie-trackers-filters.audit.en.md b/subjects/groupie-tracker/groupie-tracker-filters.audit.en.md similarity index 100% rename from subjects/groupie-trackers/groupie-trackers-filters.audit.en.md rename to subjects/groupie-tracker/groupie-tracker-filters.audit.en.md diff --git a/subjects/groupie-trackers/groupie-trackers-filters.en.md b/subjects/groupie-tracker/groupie-tracker-filters.en.md similarity index 83% rename from subjects/groupie-trackers/groupie-trackers-filters.en.md rename to subjects/groupie-tracker/groupie-tracker-filters.en.md index b646c3cab..618ece475 100644 --- a/subjects/groupie-trackers/groupie-trackers-filters.en.md +++ b/subjects/groupie-tracker/groupie-tracker-filters.en.md @@ -1,10 +1,10 @@ -## groupie-trackers-filters +## groupie-tracker-filters ### Objectives -You must follow the same [principles](https://public.01-edu.org/subjects/groupie-trackers/groupie-trackers.en) as the first subject. +You must follow the same [principles](https://public.01-edu.org/subjects/groupie-tracker/groupie-tracker.en) as the first subject. -- Groupie Trackers Filters consists on letting the user filter the artists/bands that will be shown. +- Groupie Tracker Filters consists on letting the user filter the artists/bands that will be shown. - Your project must incorporate at least these four filters: - filter by creation date diff --git a/subjects/groupie-trackers/groupie-trackers-geolocation.audit.en.md b/subjects/groupie-tracker/groupie-tracker-geolocalization.audit.en.md similarity index 92% rename from subjects/groupie-trackers/groupie-trackers-geolocation.audit.en.md rename to subjects/groupie-tracker/groupie-tracker-geolocalization.audit.en.md index 223e57896..d554863f1 100644 --- a/subjects/groupie-trackers/groupie-trackers-geolocation.audit.en.md +++ b/subjects/groupie-tracker/groupie-tracker-geolocalization.audit.en.md @@ -6,6 +6,7 @@ ##### Try to input `"Queen"` to see the concerts locations. ``` +north carolina usa los angeles usa, nagoya japan, osaka japan, @@ -25,9 +26,9 @@ aarhus denmark ``` ###### Are the markers displayed in the locations above? -##### Try to input `"Imagine Dragon"` to see the concerts locations. +##### Try to input `"Imagine Dragons"` to see the concerts locations. ``` -napoca germany, +berlin germany, quebec canada, del mar usa, mexico city mexico, @@ -78,13 +79,13 @@ newark usa ##### Try to input `"Red Hot Chili Peppers"` to see the concerts locations. ``` landgraaf netherlands, -los angeles california usa, +los angeles usa, rio de janeiro brazil, athens greece, -boston massachusetts, -dana point california usa, +massachusetts usa, +california usa, florence italia, -gulf shores alabama usa +alabama usa ``` ###### Are the markers displayed in the locations above? diff --git a/subjects/groupie-trackers/groupie-trackers-geolocation.en.md b/subjects/groupie-tracker/groupie-tracker-geolocalization.en.md similarity index 85% rename from subjects/groupie-trackers/groupie-trackers-geolocation.en.md rename to subjects/groupie-tracker/groupie-tracker-geolocalization.en.md index 96ea38bd0..1596ba330 100644 --- a/subjects/groupie-trackers/groupie-trackers-geolocation.en.md +++ b/subjects/groupie-tracker/groupie-tracker-geolocalization.en.md @@ -1,10 +1,10 @@ -## groupie-trackers-geolocation +## groupie-tracker-geolocalization ### Objectives -You must follow the same [principles](https://public.01-edu.org/subjects/groupie-trackers/groupie-trackers.en) as the first subject. +You must follow the same [principles](https://public.01-edu.org/subjects/groupie-tracker/groupie-tracker.en) as the first subject. -- Groupie Trackers Geolocation consists on mapping the different concerts locations of a certain artist/band given by the Client. +- Groupie Tracker Geolocation consists on mapping the different concerts locations of a certain artist/band given by the Client. - You must use a process of converting addresses (ex: Germany Mainz) into geographic coordinates (ex: 49,59380 8,15052) which you must use to place markers for the concerts locations of a certain artist/band on a map. diff --git a/subjects/groupie-trackers/groupie-trackers-search-bar.audit.en.md b/subjects/groupie-tracker/groupie-tracker-search-bar.audit.en.md similarity index 100% rename from subjects/groupie-trackers/groupie-trackers-search-bar.audit.en.md rename to subjects/groupie-tracker/groupie-tracker-search-bar.audit.en.md diff --git a/subjects/groupie-trackers/groupie-trackers-search-bar.en.md b/subjects/groupie-tracker/groupie-tracker-search-bar.en.md similarity index 82% rename from subjects/groupie-trackers/groupie-trackers-search-bar.en.md rename to subjects/groupie-tracker/groupie-tracker-search-bar.en.md index 5a36ea60d..a71df0b68 100644 --- a/subjects/groupie-trackers/groupie-trackers-search-bar.en.md +++ b/subjects/groupie-tracker/groupie-tracker-search-bar.en.md @@ -1,10 +1,10 @@ -## groupie-trackers-search-bar +## groupie-tracker-search-bar ### Objectives -You must follow the same [principles](https://public.01-edu.org/subjects/groupie-trackers/groupie-trackers.en) as the first subject. +You must follow the same [principles](https://public.01-edu.org/subjects/groupie-tracker/groupie-tracker.en) as the first subject. -Groupie-trackers-search-bar consists of creating a functional program that searches, inside your website, for a specific input text. +Groupie-tracker-search-bar consists of creating a functional program that searches, inside your website, for a specific input text. - The program should handle at least these search cases : - artist/band name diff --git a/subjects/groupie-tracker/groupie-tracker-visualization.audit.en.md b/subjects/groupie-tracker/groupie-tracker-visualization.audit.en.md new file mode 100644 index 000000000..a376bf83c --- /dev/null +++ b/subjects/groupie-tracker/groupie-tracker-visualization.audit.en.md @@ -0,0 +1,35 @@ +#### Functional + +###### Do the colors used allow a good visual contrast (ex: it is difficult to read a yellow text on a white background)? + +###### Is the design [consistent](https://digitalcommunications.wp.st-andrews.ac.uk/2016/04/07/why-is-consistency-important-in-web-design/)? (examples: every page follows the same palette of colors, is all centered or is it everything aligned to the right, etc.) + +###### Is the design [responsive](https://smallbiztrends.com/2013/05/what-is-responsive-web-design.html)? (when you change the width/ height of the page, is the site consistent?) + +###### Is the [interaction design](https://en.m.wikipedia.org/wiki/Interaction_design) good (is the interface easily usable)? + +##### Try to explore an inexistent page. + +###### Is the design for the 404 HTTP status covered? + +#### General + +###### +Is it easy to use the web site? + +###### +Does it have a background? + +#### Basic + +###### +Does the project runs quickly and effectively (Favoring of recursive, no unnecessary data requests, etc.)? + +###### +Is there a test file for this code? + +###### +Are the tests checking each possible case? + +###### +Does the code obey the [good practices](https://public.01-edu.org/subjects/good-practices.en)? + +#### Social + +###### +Did you learn anything from this project? + +###### +Would you recommend/nominate this program as an example for the rest of the school? \ No newline at end of file diff --git a/subjects/groupie-tracker/groupie-tracker-visualization.en.md b/subjects/groupie-tracker/groupie-tracker-visualization.en.md new file mode 100644 index 000000000..340ba9087 --- /dev/null +++ b/subjects/groupie-tracker/groupie-tracker-visualization.en.md @@ -0,0 +1,28 @@ +## groupie-tracker-visualization + +### Objectives + +You must follow the same [principles](https://public.01-edu.org/subjects/groupie-tracker/groupie-tracker.en) as the first subject. + +Groupie-tracker-visualization consists on manipulating the data coming from the API and displaying it in the most presentable way possible to you, following the [*Schneiderman's 8 Golden Rules of Interface Design*](https://www.interaction-design.org/literature/article/shneiderman-s-eight-golden-rules-will-help-you-design-better-interfaces) : + +- Strive for consistency +- Enable frequent users to use shortcuts +- Offer informative feedback +- Design dialogue to yield closure +- Offer simple error handling +- Permit easy reversal of actions +- Support internal locus of control +- Reduce short-term memory load + +This project will help you learn about: + +- The basics of human-computer interface. +- The basics of CSS. +- Linking CSS and HTML. + +### Instructions + +- Your project must contain **CSS**. +- The code must respect the [**good practices**](https://public.01-edu.org/subjects/good-practices.en). +- We suggest you to search for the principles of a good website design. diff --git a/subjects/groupie-tracker/groupie-tracker-visualizations.audit.en.md b/subjects/groupie-tracker/groupie-tracker-visualizations.audit.en.md new file mode 100644 index 000000000..a376bf83c --- /dev/null +++ b/subjects/groupie-tracker/groupie-tracker-visualizations.audit.en.md @@ -0,0 +1,35 @@ +#### Functional + +###### Do the colors used allow a good visual contrast (ex: it is difficult to read a yellow text on a white background)? + +###### Is the design [consistent](https://digitalcommunications.wp.st-andrews.ac.uk/2016/04/07/why-is-consistency-important-in-web-design/)? (examples: every page follows the same palette of colors, is all centered or is it everything aligned to the right, etc.) + +###### Is the design [responsive](https://smallbiztrends.com/2013/05/what-is-responsive-web-design.html)? (when you change the width/ height of the page, is the site consistent?) + +###### Is the [interaction design](https://en.m.wikipedia.org/wiki/Interaction_design) good (is the interface easily usable)? + +##### Try to explore an inexistent page. + +###### Is the design for the 404 HTTP status covered? + +#### General + +###### +Is it easy to use the web site? + +###### +Does it have a background? + +#### Basic + +###### +Does the project runs quickly and effectively (Favoring of recursive, no unnecessary data requests, etc.)? + +###### +Is there a test file for this code? + +###### +Are the tests checking each possible case? + +###### +Does the code obey the [good practices](https://public.01-edu.org/subjects/good-practices.en)? + +#### Social + +###### +Did you learn anything from this project? + +###### +Would you recommend/nominate this program as an example for the rest of the school? \ No newline at end of file diff --git a/subjects/groupie-tracker/groupie-tracker-visualizations.en.md b/subjects/groupie-tracker/groupie-tracker-visualizations.en.md new file mode 100644 index 000000000..de9bea8b5 --- /dev/null +++ b/subjects/groupie-tracker/groupie-tracker-visualizations.en.md @@ -0,0 +1,28 @@ +## groupie-tracker-visualizations + +### Objectives + +You must follow the same [principles](https://public.01-edu.org/subjects/groupie-tracker/groupie-tracker.en) as the first subject. + +Groupie-tracker-visualizations consists on manipulating the data coming from the API and displaying it in the most presentable way possible to you, following the [*Schneiderman's 8 Golden Rules of Interface Design*](https://www.interaction-design.org/literature/article/shneiderman-s-eight-golden-rules-will-help-you-design-better-interfaces) : + +- Strive for consistency +- Enable frequent users to use shortcuts +- Offer informative feedback +- Design dialogue to yield closure +- Offer simple error handling +- Permit easy reversal of actions +- Support internal locus of control +- Reduce short-term memory load + +This project will help you learn about: + +- The basics of human-computer interface. +- The basics of CSS. +- Linking CSS and HTML. + +### Instructions + +- Your project must contain **CSS**. +- The code must respect the [**good practices**](https://public.01-edu.org/subjects/good-practices.en). +- We suggest you to search for the principles of a good website design. diff --git a/subjects/groupie-trackers/groupie-trackers.audit.en.md b/subjects/groupie-tracker/groupie-tracker.audit.en.md similarity index 83% rename from subjects/groupie-trackers/groupie-trackers.audit.en.md rename to subjects/groupie-tracker/groupie-tracker.audit.en.md index 71e331597..0e1a2cc22 100644 --- a/subjects/groupie-trackers/groupie-trackers.audit.en.md +++ b/subjects/groupie-tracker/groupie-tracker.audit.en.md @@ -26,14 +26,16 @@ ##### Try to see the "locations" for the artist/band `"Travis Scott"` ``` - "las_vegas-usa" - "brooklyn-usa" - "boston-usa" - "washington-usa" + "santiago-chile" + "sao_paulo-usa" + "los_angeles-usa" + "houston-usa" + "atlanta-usa" + "new_orleans-usa" "philadelphia-usa" - "montreal-canada" - "toronto-usa" - "new_york-usa" + "london-uk" + "frauenfeld-switzerland" + "turku-finland" ``` ###### Does it present the right "locations" as above? @@ -51,7 +53,7 @@ ##### Try to trigger an event using some kind of action (ex: Clicking the mouse over a certain element, pressing a key on the keyboard, resizing or closing the browser window, a form being submitted, an error occurring, etc). ###### Does the event responds as expected? -###### Did the server crashed? +###### Did the server behaved as expected?(did not crashed) ###### Does the server use the right [HTTP method](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods)? @@ -59,9 +61,9 @@ ###### Are all the pages working? (Absence of 404 page?) -###### Does the project avoid [HTTP status 400](https://kinsta.com/knowledgebase/400-bad-request/#causes)? +###### Does the project handle [HTTP status 400 - Bad Requests](https://kinsta.com/knowledgebase/400-bad-request/#causes)? -###### Does the project avoid [HTTP status 500](https://www.restapitutorial.com/httpstatuscodes.html)? +###### Does the project handle [HTTP status 500 - Internal Server Errors](https://www.restapitutorial.com/httpstatuscodes.html)? ###### Is the communication between server and client well established? diff --git a/subjects/groupie-trackers/groupie-trackers.en.md b/subjects/groupie-tracker/groupie-tracker.en.md similarity index 99% rename from subjects/groupie-trackers/groupie-trackers.en.md rename to subjects/groupie-tracker/groupie-tracker.en.md index 86d130aa1..82e6fa5b0 100644 --- a/subjects/groupie-trackers/groupie-trackers.en.md +++ b/subjects/groupie-tracker/groupie-tracker.en.md @@ -1,4 +1,4 @@ -## groupie-trackers +## groupie-tracker ### Objectives diff --git a/subjects/grouping.en.md b/subjects/grouping.en.md new file mode 100644 index 000000000..189e01e60 --- /dev/null +++ b/subjects/grouping.en.md @@ -0,0 +1,40 @@ +## grouping + +### Instructions + +Write a program that receives two strings and replicates the use of brackets in regular expressions. Brackets in regular expressions returns the words that contain the expression inside of it. + +The program should handle the "`|`" operator, that searches for both strings on each side of the operator. + +The output of the program should be the results of the regular expression by order of appearance in the string, being themselves identified by a number. + +In case the regular expression is not valid, the last argument is empty or there are no matches the program returns a newline ("`\n`"). + +If the number of arguments is different from 2 the program should print a newline ("`\n`"). + +### Usage + +```console +student@ubuntu:~/[[ROOT]]/test$ go build +student@ubuntu:~/[[ROOT]]/test$ ./regbrackets "(a)" "I'm heavy, jumpsuit is on steady, Lighter when I'm lower, higher when I'm heavy" +1: heavy +2: steady +3: heavy +student@ubuntu:~/[[ROOT]]/test$ ./regbrackets "(e|n)" "I currently have 4 windows opened up… and I don’t know why." +1: currently +2: currently +3: have +4: windows +5: opened +6: opened +7: and +8: don’t +9: know +student@ubuntu:~/[[ROOT]]/test$ ./regbrackets "(hi)" "He swore he just saw his sushi move." +1: his +2: sushi +student@ubuntu:~/[[ROOT]]/test$ ./regbrackets "(s)" "" + +student@ubuntu:~/[[ROOT]]/test$ ./regbrackets "i" "Something in the air" + +student@ubuntu:~/[[ROOT]]/test$ diff --git a/subjects/halfcontestprog.en.md b/subjects/halfcontestprog.en.md new file mode 100644 index 000000000..01e273cc0 --- /dev/null +++ b/subjects/halfcontestprog.en.md @@ -0,0 +1,59 @@ +## halfcontest + +## **WARNING! VERY IMPORTANT!** + +For this exercise a function will be tested **with the exam own main**. However the student **still needs** to submit a structured program: + +This means that: + +- The package needs to be named `package main`. +- The submitted code needs one declared function main(```func main()```) even if empty. +- The function main declared needs to **also pass** the `Restrictions Checker`(illegal functions tester). It is advised for the student to just empty the function main after its own testings are done. +- Every other rules are obviously the same than for a `program`. + +### Instructions + +It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like). +Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32. + +The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for those interested. Sections 1.10.32 and 1.10.33 from "de Finibus Bonorum et Malorum" by Cicero are also reproduced in their exact original form, accompanied by English versions from the 1914 translation by H. Rackham. + +You are given 4 non-negative integers 'h1', 'm1', 'h2', and 'm2'. The contest starts at h1:m1 minutes and finishes at h2:m2 minutes. Your task is to find out when half of the contest will be over and return it in the format decribed in the example. +Contest cannot finish before it was started. + +### Expected function + +```go +func Halfcontest(h1, m1, h2, m2 int) int { + +} +``` + +### Usage + +Here is a possible program to test your function : + +```go +package main + +import ( + "fmt" +) + +func main() { + fmt.Println(Halfcontest(1, 15, 3, 33)) + fmt.Println(Halfcontest(10, 3, 11, 55)) + fmt.Println(Halfcontest(9, 2, 11, 3)) +} +``` + +And its output : + +```console +student@ubuntu:~/[[ROOT]]/test$ go build +student@ubuntu:~/[[ROOT]]/test$ ./test +224 +1059 +1002 +student@ubuntu:~/[[ROOT]]/test$ +``` diff --git a/subjects/index.en.md b/subjects/index.en.md index d948e1654..d1a217604 100644 --- a/subjects/index.en.md +++ b/subjects/index.en.md @@ -14,7 +14,7 @@ func Index(s string, toFind string) int { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/index.fr.md b/subjects/index.fr.md index 059ad7eae..28b64b12c 100644 --- a/subjects/index.fr.md +++ b/subjects/index.fr.md @@ -14,7 +14,7 @@ func Index(s string, toFind string) int { ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main diff --git a/subjects/inter.en.md b/subjects/inter.en.md index 3a293d05c..eb8257581 100644 --- a/subjects/inter.en.md +++ b/subjects/inter.en.md @@ -4,9 +4,9 @@ Write a program that takes two `string` and displays, without doubles, the characters that appear in both `string`, in the order they appear in the first one. -- The display will be followed by a newline (`'\n'`). +- The display will be followed by a newline (`'\n'`). -- If the number of arguments is different from 2, the program displays a newline (`'\n'`). +- If the number of arguments is different from 2, the program displays a newline (`'\n'`). ### Usage diff --git a/subjects/inter.fr.md b/subjects/inter.fr.md index 5f297414a..f5aa5ff0b 100644 --- a/subjects/inter.fr.md +++ b/subjects/inter.fr.md @@ -4,9 +4,9 @@ Écrire un programme qui prend deux `string` et qui affiche, sans doublons, les caractères qui apparaissent dans les deux `string`, dans l'ordre dans lequel ils apparaissent dans la première. -- L'affichage sera suivi d'un retour à la ligne (`'\n'`). +- L'affichage sera suivi d'un retour à la ligne (`'\n'`). -- Si le nombre d'arguments est différent de 2, le programme affiche un retour à la ligne (`'\n'`). +- Si le nombre d'arguments est différent de 2, le programme affiche un retour à la ligne (`'\n'`). ### Utilisation diff --git a/subjects/interestingnumber.en.md b/subjects/interestingnumber.en.md new file mode 100644 index 000000000..27afba8ce --- /dev/null +++ b/subjects/interestingnumber.en.md @@ -0,0 +1,58 @@ +## interesting_number + +## **WARNING! VERY IMPORTANT!** + +For this exercise a function will be tested **with the exam own main**. However the student **still needs** to submit a structured program: + +This means that: + +- The package needs to be named `package main`. +- The submitted code needs one declared function main(```func main()```) even if empty. +- The function main declared needs to **also pass** the `Restrictions Checker`(illegal functions tester). It is advised for the student to just empty the function main after its own testings are done. +- Every other rules are obviously the same than for a `program`. + +### Instructions + +It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like). +Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32. + +The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for those interested. Sections 1.10.32 and 1.10.33 from "de Finibus Bonorum et Malorum" by Cicero are also reproduced in their exact original form, accompanied by English versions from the 1914 translation by H. Rackham. + +Saken thinks that number is interesting if sum of its digits is divisible by 7. You are given a positive integer 'n', return the next interesting number (could be itself). + +### Expected function + +```go +func InterestingNumber(n int) int { + +} +``` + +### Usage + +Here is a possible program to test your function : + +```go +package main + +import ( + "fmt" +) + +func main() { + fmt.Println(Interesting_number(1)) + fmt.Println(Interesting_number(2)) + fmt.Println(Interesting_number(8)) +} +``` + +And its output : + +```console +student@ubuntu:~/[[ROOT]]/test$ go build +student@ubuntu:~/[[ROOT]]/test$ ./test +7 +7 +16 +student@ubuntu:~/[[ROOT]]/test$ +``` diff --git a/subjects/introduction.en.md b/subjects/introduction.en.md index a0bfd0472..ea0b0a5ed 100644 --- a/subjects/introduction.en.md +++ b/subjects/introduction.en.md @@ -29,11 +29,11 @@ ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519 -N '' cat ~/.ssh/id_ed25519.pub ``` -- Copy the result and paste it in the content field of adding an ssh key in your settings (adapt the link with your username). +- Copy the result and paste it in the content field of adding an ssh key in your settings (adapt the link with your username). [https://git.[[DOMAIN]]/choumi/settings/keys](https://git.[[DOMAIN]]/choumi/settings/keys) -- Confirm by clicking on the add key button. +- Confirm by clicking on the add key button. Once this is done the git clone command should work now. diff --git a/subjects/inverttree.en.md b/subjects/inverttree.en.md index 5a3ca76b6..381d7d475 100644 --- a/subjects/inverttree.en.md +++ b/subjects/inverttree.en.md @@ -11,18 +11,27 @@ This means that: - The function main declared needs to **also pass** the `Restrictions Checker`(illegal functions tester). It is advised for the student to just empty the function main after its own testings are done. - Every other rules are obviously the same than for a `program`. +### Instructions -### Instructions: Write a function that takes tree and inverts(flips) and returns it. -``` + +### Expected function and structure + +```go type TNode struct { Val int Left *TNode Right *TNode } + +func InvertTree(root *TNode) *TNode { + +} ``` + Example: -``` + +```shell Input: 7 / \ @@ -37,8 +46,3 @@ Output: / \ / \ 13 9 6 3 ``` -Expected function: -``` -func InvertTree(root *TNode) *TNode { -} -``` diff --git a/subjects/isalpha.en.md b/subjects/isalpha.en.md index 79a0913bf..6fefc896e 100644 --- a/subjects/isalpha.en.md +++ b/subjects/isalpha.en.md @@ -14,7 +14,7 @@ func IsAlpha(str string) bool { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/isalpha.fr.md b/subjects/isalpha.fr.md index 2de841d2d..f410a82ab 100644 --- a/subjects/isalpha.fr.md +++ b/subjects/isalpha.fr.md @@ -14,7 +14,7 @@ func IsAlpha(str string) bool { ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main diff --git a/subjects/islower.en.md b/subjects/islower.en.md index 8cab6d15e..1e4ebd06c 100644 --- a/subjects/islower.en.md +++ b/subjects/islower.en.md @@ -14,7 +14,7 @@ func IsLower(str string) bool { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/islower.fr.md b/subjects/islower.fr.md index 21d0af35e..a0657d8d5 100644 --- a/subjects/islower.fr.md +++ b/subjects/islower.fr.md @@ -14,7 +14,7 @@ func IsLower(str string) bool { ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programmes pour tester votre fonction : ```go package main diff --git a/subjects/isnegative.en.md b/subjects/isnegative.en.md index 22b7f4489..661bd32c4 100644 --- a/subjects/isnegative.en.md +++ b/subjects/isnegative.en.md @@ -2,7 +2,7 @@ ### Instructions -Write a [function](TODO-LINK) that prints `'T'` (true) on a single line if the `int` passed as parameter is negative, otherwise it prints `'F'` (false). +Write a function that prints `'T'` (true) on a single line if the `int` passed as parameter is negative, otherwise it prints `'F'` (false). ### Expected function @@ -14,7 +14,7 @@ func IsNegative(nb int) { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/isnegative.fr.md b/subjects/isnegative.fr.md index 55638c045..3633b5fdb 100644 --- a/subjects/isnegative.fr.md +++ b/subjects/isnegative.fr.md @@ -2,7 +2,7 @@ ### Instructions -Écrire une [fonction](TODO-LINK) qui affiche `'T'` (true) sur une seule ligne si l'`int` passé en paramètre est négatif, sinon elle affiche `'F'` (false). +Écrire une fonction qui affiche `'T'` (true) sur une seule ligne si l'`int` passé en paramètre est négatif, sinon elle affiche `'F'` (false). ### Fonction attendue @@ -14,7 +14,7 @@ func IsNegative(nb int) { ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main diff --git a/subjects/isnumeric.en.md b/subjects/isnumeric.en.md index 7e0bab04a..ff88e7c05 100644 --- a/subjects/isnumeric.en.md +++ b/subjects/isnumeric.en.md @@ -14,7 +14,7 @@ func IsNumeric(str string) bool { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/isnumeric.fr.md b/subjects/isnumeric.fr.md index a2db51efd..6ff3b314b 100644 --- a/subjects/isnumeric.fr.md +++ b/subjects/isnumeric.fr.md @@ -14,7 +14,7 @@ func IsNumeric(str string) bool { ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main diff --git a/subjects/ispowerof2.en.md b/subjects/ispowerof2.en.md index ea16e5f1f..b88fac2b7 100644 --- a/subjects/ispowerof2.en.md +++ b/subjects/ispowerof2.en.md @@ -6,9 +6,9 @@ Write a program that determines if a given number is a power of 2. This program must print `true` if the given number is a power of 2, otherwise it prints `false`. -- If there is more than one or no argument the program should print a newline ("`\n`"). +- If there is more than one or no argument the program should print a newline ("`\n`"). -- When there is only 1 argument, it will always be a positive valid int. +- When there is only 1 argument, it will always be a positive valid int. ### Usage : diff --git a/subjects/ispowerof2.fr.md b/subjects/ispowerof2.fr.md index 899644961..257a0fa8c 100644 --- a/subjects/ispowerof2.fr.md +++ b/subjects/ispowerof2.fr.md @@ -6,9 +6,9 @@ Ce programme doit afficher `true` si le nombre donné est une puissance de 2, autrement il affiche `false`. -- Si il y a plus d'un ou aucun argument le programme doit afficher un retour à la ligne (`'\n'`). +- Si il y a plus d'un ou aucun argument le programme doit afficher un retour à la ligne (`'\n'`). -- WSi il n'y a qu'un seul argument, ce sera toujours un int positif. +- WSi il n'y a qu'un seul argument, ce sera toujours un int positif. ### Usage : diff --git a/subjects/isprime.en.md b/subjects/isprime.en.md index 3e2d0d087..5da1d49f2 100644 --- a/subjects/isprime.en.md +++ b/subjects/isprime.en.md @@ -16,7 +16,7 @@ func IsPrime(nb int) bool { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/isprime.fr.md b/subjects/isprime.fr.md index c23473258..fb488387d 100644 --- a/subjects/isprime.fr.md +++ b/subjects/isprime.fr.md @@ -16,7 +16,7 @@ func IsPrime(nb int) bool { ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main diff --git a/subjects/isprintable.en.md b/subjects/isprintable.en.md index da19c3a9b..599592ce8 100644 --- a/subjects/isprintable.en.md +++ b/subjects/isprintable.en.md @@ -14,7 +14,7 @@ func IsPrintable(str string) bool { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/isprintable.fr.md b/subjects/isprintable.fr.md index c96ae4de3..cd8864779 100644 --- a/subjects/isprintable.fr.md +++ b/subjects/isprintable.fr.md @@ -14,7 +14,7 @@ func IsPrintable(str string) bool { ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main diff --git a/subjects/issorted.en.md b/subjects/issorted.en.md index d0ee93332..5c6f8824a 100644 --- a/subjects/issorted.en.md +++ b/subjects/issorted.en.md @@ -19,7 +19,7 @@ func IsSorted(f func(a, b int) int, tab []int) bool { ### Usage -Here is a possible [program](TODO-LINK) to test your function (without `f`): +Here is a possible program to test your function (without `f`): ```go package main diff --git a/subjects/issorted.fr.md b/subjects/issorted.fr.md index 176eb4f32..54bfdbe09 100644 --- a/subjects/issorted.fr.md +++ b/subjects/issorted.fr.md @@ -18,7 +18,7 @@ func IsSorted(f func(a, b int) int, tab []int) bool { ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction (sans `f`) : +Voici un éventuel programme pour tester votre fonction (sans `f`) : ```go package main diff --git a/subjects/isupper.en.md b/subjects/isupper.en.md index 80359b983..1fe7432e9 100644 --- a/subjects/isupper.en.md +++ b/subjects/isupper.en.md @@ -14,7 +14,7 @@ func IsUpper(str string) bool { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/iterativefactorial.en.md b/subjects/iterativefactorial.en.md index a27c1ee6f..2d58f5c54 100644 --- a/subjects/iterativefactorial.en.md +++ b/subjects/iterativefactorial.en.md @@ -16,7 +16,7 @@ func IterativeFactorial(nb int) int { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/iterativefactorial.fr.md b/subjects/iterativefactorial.fr.md index 81e018174..bb25fcc8e 100644 --- a/subjects/iterativefactorial.fr.md +++ b/subjects/iterativefactorial.fr.md @@ -16,7 +16,7 @@ func IterativeFactorial(nb int) int { ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main diff --git a/subjects/iterativepower.en.md b/subjects/iterativepower.en.md index dbc928c9e..99be7810e 100644 --- a/subjects/iterativepower.en.md +++ b/subjects/iterativepower.en.md @@ -16,14 +16,14 @@ func IterativePower(nb int, power int) int { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main import ( -        "fmt" -        piscine ".." + "fmt" + piscine ".." ) diff --git a/subjects/iterativepower.fr.md b/subjects/iterativepower.fr.md index 654478baf..6aba45db4 100644 --- a/subjects/iterativepower.fr.md +++ b/subjects/iterativepower.fr.md @@ -16,14 +16,14 @@ func IterativePower(nb int, power int) int { ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main import ( -        "fmt" -        piscine ".." + "fmt" + piscine ".." ) diff --git a/subjects/itoa.en.md b/subjects/itoa.en.md index f32591be9..f613beb43 100644 --- a/subjects/itoa.en.md +++ b/subjects/itoa.en.md @@ -2,9 +2,9 @@ ### Instructions -- Write a function that simulates the behaviour of the `Itoa` function in Go. `Itoa` transforms a number represented as an`int` in a number represented as a `string`. +- Write a function that simulates the behaviour of the `Itoa` function in Go. `Itoa` transforms a number represented as an`int` in a number represented as a `string`. -- For this exercise the handling of the signs + or - **does have** to be taken into account. +- For this exercise the handling of the signs + or - **does have** to be taken into account. ## Expected function diff --git a/subjects/itoa.fr.md b/subjects/itoa.fr.md index e7b8a100a..e6e0bad6e 100644 --- a/subjects/itoa.fr.md +++ b/subjects/itoa.fr.md @@ -2,9 +2,9 @@ ### Instructions -- Écrire une fonction qui reproduit le comportement de la fonction `Itoa` en Go. `Itoa` transforme un nombre représenté en `int` (entier) en `string` (chaîne de caractères). +- Écrire une fonction qui reproduit le comportement de la fonction `Itoa` en Go. `Itoa` transforme un nombre représenté en `int` (entier) en `string` (chaîne de caractères). -- Pour cet exercice la gestion des signes + ou - **doit être** prise en compte. +- Pour cet exercice la gestion des signes + ou - **doit être** prise en compte. ## Fonction attendue diff --git a/subjects/itoabase.en.md b/subjects/itoabase.en.md index 33338b168..17ee139e0 100644 --- a/subjects/itoabase.en.md +++ b/subjects/itoabase.en.md @@ -4,8 +4,8 @@ Write a function that: -- converts an `int` value to a `string` using the specified base in the argument -- and that returns this `string` +- converts an `int` value to a `string` using the specified base in the argument +- and that returns this `string` The base is expressed as an `int`, from 2 to 16. The characters comprising the base are the digits from 0 to 9, followed by uppercase letters from A to F. diff --git a/subjects/itoabase.fr.md b/subjects/itoabase.fr.md index ed1839422..30ed68b08 100644 --- a/subjects/itoabase.fr.md +++ b/subjects/itoabase.fr.md @@ -4,8 +4,8 @@ Écrire une fonction qui: -- convertit une valeur `int` en `string` en utilisant la base spécifiée en argument -- et qui retourne cette `string` +- convertit une valeur `int` en `string` en utilisant la base spécifiée en argument +- et qui retourne cette `string` Cette base est exprimée comme un `int`, de 2 à 16. Les caractères compris dans la base sont les chiffres de 0 à 9, suivis des lettres majuscules de A à F. diff --git a/subjects/itoabaseprog.en.md b/subjects/itoabaseprog.en.md index ec8d29fd6..e97b8cd9f 100644 --- a/subjects/itoabaseprog.en.md +++ b/subjects/itoabaseprog.en.md @@ -15,8 +15,8 @@ This means that: Write a function that: -- converts an `int` value to a `string` using the specified base in the argument -- and that returns this `string` +- converts an `int` value to a `string` using the specified base in the argument +- and that returns this `string` The base is expressed as an `int`, from 2 to 16. The characters comprising the base are the digits from 0 to 9, followed by uppercase letters from A to F. diff --git a/subjects/itoabaseprog.fr.md b/subjects/itoabaseprog.fr.md index 4af0cf4fb..d4a91fdd9 100644 --- a/subjects/itoabaseprog.fr.md +++ b/subjects/itoabaseprog.fr.md @@ -15,8 +15,8 @@ Cela signifie que: Écrire une fonction qui: -- convertit une valeur `int` en `string` en utilisant la base spécifiée en argument -- et qui retourne cette `string` +- convertit une valeur `int` en `string` en utilisant la base spécifiée en argument +- et qui retourne cette `string` Cette base est exprimée comme un `int`, de 2 à 16. Les caractères compris dans la base sont les chiffres de 0 à 9, suivis des lettres majuscules de A à F. diff --git a/subjects/itoaprog.en.md b/subjects/itoaprog.en.md index ee3f824d9..eac8e82c6 100644 --- a/subjects/itoaprog.en.md +++ b/subjects/itoaprog.en.md @@ -13,9 +13,9 @@ This means that: ### Instructions -- Write a function that simulates the behaviour of the `Itoa` function in Go. `Itoa` transforms a number represented as an`int` in a number represented as a `string`. +- Write a function that simulates the behaviour of the `Itoa` function in Go. `Itoa` transforms a number represented as an `int` in a number represented as a `string`. -- For this exercise the handling of the signs + or - **does have** to be taken into account. +- For this exercise the handling of the signs + or - **does have** to be taken into account. ## Expected function diff --git a/subjects/join.en.md b/subjects/join.en.md index fb53fa663..94851e3c1 100644 --- a/subjects/join.en.md +++ b/subjects/join.en.md @@ -14,7 +14,7 @@ func Join(strs []string, sep string) string { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/join.fr.md b/subjects/join.fr.md index 3d0f9b46c..6c36ae4ab 100644 --- a/subjects/join.fr.md +++ b/subjects/join.fr.md @@ -14,7 +14,7 @@ func Join(strs []string, sep string) string{ ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main diff --git a/subjects/lastrune.en.md b/subjects/lastrune.en.md index dbc7e466d..d2678a696 100644 --- a/subjects/lastrune.en.md +++ b/subjects/lastrune.en.md @@ -14,7 +14,7 @@ func LastRune(s string) rune { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/lastrune.fr.md b/subjects/lastrune.fr.md index 99ab87c72..2f30f71b5 100644 --- a/subjects/lastrune.fr.md +++ b/subjects/lastrune.fr.md @@ -14,7 +14,7 @@ func LastRune(s string) rune { ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main diff --git a/subjects/lastword.en.md b/subjects/lastword.en.md index faf259c17..d79d23e37 100644 --- a/subjects/lastword.en.md +++ b/subjects/lastword.en.md @@ -4,11 +4,11 @@ Write a program that takes a `string` and displays its last word, followed by a newline (`'\n'`). -- A word is a section of `string` delimited by spaces or by the start/end of the `string`. +- A word is a section of `string` delimited by spaces or by the start/end of the `string`. -- The output will be followed by a newline (`'\n'`). +- The output will be followed by a newline (`'\n'`). -- If the number of parameters is different from 1, or if there are no word, the program displays a newline (`'\n'`). +- If the number of parameters is different from 1, or if there are no word, the program displays a newline (`'\n'`). ### Usage diff --git a/subjects/lastword.fr.md b/subjects/lastword.fr.md index fba0f4071..b7a1e4eea 100644 --- a/subjects/lastword.fr.md +++ b/subjects/lastword.fr.md @@ -4,11 +4,11 @@ Écrire un programme qui prend une `string` et qui affiche son dernier mot, suivi d'un retour à la ligne (`'\n'`). -- Un mot est une section de `string` délimitée par des espaces ou par le début/fin d'une `string`. +- Un mot est une section de `string` délimitée par des espaces ou par le début/fin d'une `string`. -- L'output sera suivi d'un retour à la ligne (`'\n'`). +- L'output sera suivi d'un retour à la ligne (`'\n'`). -- Si le nombre de paramètres est différent de 1, ou si il n'y a pas de mot, le programme affiche un retour à la ligne (`'\n'`). +- Si le nombre de paramètres est différent de 1, ou si il n'y a pas de mot, le programme affiche un retour à la ligne (`'\n'`). ### Utilisation diff --git a/subjects/lcm.en.md b/subjects/lcm.en.md index 98688f3e7..49b437873 100644 --- a/subjects/lcm.en.md +++ b/subjects/lcm.en.md @@ -15,7 +15,7 @@ This means that: Write a function, `lcm`, that returns least common multiple. -All arguments tested will be positive `int` values. +It will be tested with positive `int` values and `0`. ### Expected function @@ -32,13 +32,9 @@ Here is a possible program to test your function : ```go package main -import ( - "fmt" - piscine ".." -) - func main() { - fmt.Println(piscine.Lcm(2, 7)) + fmt.Println(Lcm(2, 7)) + fmt.Println(Lcm(0, 4)) } ``` @@ -48,5 +44,6 @@ func main() { student@ubuntu:~/[[ROOT]]/test$ go build student@ubuntu:~/[[ROOT]]/test$ ./test 14 +0 student@ubuntu:~/[[ROOT]]/test$ ``` diff --git a/subjects/lem-in/lem-in-examples.en.md b/subjects/lem-in/lem-in-examples.en.md index b2f6f9377..b228e9110 100644 --- a/subjects/lem-in/lem-in-examples.en.md +++ b/subjects/lem-in/lem-in-examples.en.md @@ -65,7 +65,7 @@ h-n 1 4 1 2 6 0 ##end -3 4 1 +3 5 3 0-1 0-3 1-2 diff --git a/subjects/lem-in/lem-in.audit.en.md b/subjects/lem-in/lem-in.audit.en.md index e2043995a..401e7da82 100644 --- a/subjects/lem-in/lem-in.audit.en.md +++ b/subjects/lem-in/lem-in.audit.en.md @@ -112,7 +112,7 @@ student$ ./lem-in example02.txt 1 4 1 2 6 0 ##end -3 4 1 +3 5 3 0-1 0-3 1-2 diff --git a/subjects/lem-in/lem-in.en.md b/subjects/lem-in/lem-in.en.md index f2fa4c18b..c20377ad5 100644 --- a/subjects/lem-in/lem-in.en.md +++ b/subjects/lem-in/lem-in.en.md @@ -127,6 +127,11 @@ student$ ./lem-in test0.txt ##start 1 23 3 2 16 7 +3 16 3 +4 16 5 +5 9 3 +6 1 5 +7 4 8 ##end 0 9 5 0-4 @@ -135,12 +140,17 @@ student$ ./lem-in test0.txt 4-3 5-2 3-5 +4-2 +2-1 +7-6 +7-2 +7-4 +6-5 -L1-2 -L1-4 L2-2 -L1-0 L2-4 L3-2 -L2-0 L3-4 -L3-0 +L1-3 L2-2 +L1-4 L2-5 L3-3 +L1-0 L2-6 L3-4 +L2-0 L3-0 student$ ``` diff --git a/subjects/listat.en.md b/subjects/listat.en.md index c9ed4d2f4..cbd6a281d 100644 --- a/subjects/listat.en.md +++ b/subjects/listat.en.md @@ -4,7 +4,7 @@ Write a function `ListAt` that takes a pointer to the list `l` and an `int pos` as parameters. This function should return the `NodeL` in the position `pos` of the linked list `l`. -- In case of error the function should return `nil`. +- In case of error the function should return `nil`. ### Expected function and structure @@ -22,7 +22,7 @@ func ListAt(l *NodeL, pos int) *NodeL{ ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main @@ -51,8 +51,8 @@ And its output : ```console student@ubuntu:~/[[ROOT]]/test$ go build student@ubuntu:~/[[ROOT]]/test$ ./test -you -hello +1 +how are student@ubuntu:~/[[ROOT]]/test$ ``` diff --git a/subjects/listat.fr.md b/subjects/listat.fr.md index 53a2537d4..e84afc9ac 100644 --- a/subjects/listat.fr.md +++ b/subjects/listat.fr.md @@ -4,7 +4,7 @@ Écrire une fonction `ListAt` qui prend un pointeur sur la liste `l` et un `int pos` comme paramètres. Cette fonction devra afficher la `NodeL` à la position `pos` de la liste chaînée `l`. -- En cas d'erreur la fonction affichera `nil`. +- En cas d'erreur la fonction affichera `nil`. ### Fonction et structure attendues @@ -22,7 +22,7 @@ func ListAt(l *NodeL, pos int) *NodeL{ ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main diff --git a/subjects/listclear.en.md b/subjects/listclear.en.md index d9d9e036d..e62b3e0de 100644 --- a/subjects/listclear.en.md +++ b/subjects/listclear.en.md @@ -4,7 +4,7 @@ Write a function `ListClear` that deletes all `nodes` from a linked list `l`. -- Tip: assign the list's pointer to `nil`. +- Tip: assign the list's pointer to `nil`. ### Expected function and structure @@ -16,7 +16,7 @@ func ListClear(l *List) { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/listclear.fr.md b/subjects/listclear.fr.md index b4175b85d..5cbfab0e7 100644 --- a/subjects/listclear.fr.md +++ b/subjects/listclear.fr.md @@ -4,7 +4,7 @@ Écrire une fonction `ListClear` qui efface toutes les `nodes` d'une liste chaînée `l`. -- Indice: assigner le pointeur de la liste à `nil`. +- Indice: assigner le pointeur de la liste à `nil`. ### Fonction et structure attendues @@ -16,7 +16,7 @@ func ListClear(l *List) { ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main diff --git a/subjects/listfind.en.md b/subjects/listfind.en.md index 3386e7e78..861c5fa69 100644 --- a/subjects/listfind.en.md +++ b/subjects/listfind.en.md @@ -4,7 +4,7 @@ Write a function `ListFind` that returns the address of the first node in the list `l` that is determined to be equal to `ref` by the function `CompStr`. -- For this exercise the function `CompStr` must be used. +- For this exercise the function `CompStr` must be used. ### Expected function and structure @@ -30,7 +30,7 @@ func ListFind(l *List, ref interface{}, comp func(a, b interface{}) bool) *inter ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/listfind.fr.md b/subjects/listfind.fr.md index 2841556dc..8415665e1 100644 --- a/subjects/listfind.fr.md +++ b/subjects/listfind.fr.md @@ -4,7 +4,7 @@ Écrire une fonction `ListFind` qui retourne l'adresse de la première node dans la liste `l` qui est déterminée comme étant égale à `ref` par la fonction `CompStr`. -- Pour cet exercice la fonction `CompStr` doit être utilisée. +- Pour cet exercice la fonction `CompStr` doit être utilisée. ### Fonction et structure attendues @@ -30,7 +30,7 @@ func ListFind(l *List, ref interface{}, comp func(a, b interface{}) bool) *inter ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main diff --git a/subjects/listforeach.en.md b/subjects/listforeach.en.md index e785be33c..7c6ef7086 100644 --- a/subjects/listforeach.en.md +++ b/subjects/listforeach.en.md @@ -4,9 +4,9 @@ Write a function `ListForEach` that applies a function given as argument to the data within each node of the list `l`. -- The function given as argument must have a pointer as argument: `l *List` +- The function given as argument must have a pointer as argument: `l *List` -- Copy the functions `Add2_node` and `Subtract3_node` in the same file as the function `ListForEach` is defined. +- Copy the functions `Add2_node` and `Subtract3_node` in the same file as the function `ListForEach` is defined. ### Expected function and structure @@ -45,7 +45,7 @@ func Subtract3_node(node *NodeL) { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/listforeach.fr.md b/subjects/listforeach.fr.md index bf20c9aa2..729f85abc 100644 --- a/subjects/listforeach.fr.md +++ b/subjects/listforeach.fr.md @@ -4,9 +4,9 @@ Écrire une fonction `ListForEach` qui applique un fonction donnée en argument à la data contenue dans chacune des nodes d'une liste `l`. -- La fonction donnée en argument doit avoir un pointeur comme argument: `l *List` +- La fonction donnée en argument doit avoir un pointeur comme argument: `l *List` -- Copier les fonctions `Add2_node` et `Subtract3_node` dans le même fichier où la fonction `ListForEach` est définie. +- Copier les fonctions `Add2_node` et `Subtract3_node` dans le même fichier où la fonction `ListForEach` est définie. ### Fonction et struture attendues @@ -45,7 +45,7 @@ func Subtract3_node(node *NodeL) { ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main diff --git a/subjects/listforeachif.en.md b/subjects/listforeachif.en.md index 63fdb41ee..d2fe3f25d 100644 --- a/subjects/listforeachif.en.md +++ b/subjects/listforeachif.en.md @@ -4,13 +4,13 @@ Write a function `ListForEachIf` that applies a function given as argument to the data within some of the nodes of the list `l`. -- This function receives two functions: +- This function receives two functions: - - `f` is a function that is applied to the node. + - `f` is a function that is applied to the node. - - `cond` is a function that returns a `boolean` and it will be used to determine if the function `f` should be applied to the node. + - `cond` is a function that returns a `boolean` and it will be used to determine if the function `f` should be applied to the node. -- The function given as argument must have a pointer `*NodeL` as argument. +- The function given as argument must have a pointer `*NodeL` as argument. ### Expected function and structure @@ -62,7 +62,7 @@ func ListForEachIf(l *List, f func(*NodeL), cond func(*NodeL) bool) { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/listforeachif.fr.md b/subjects/listforeachif.fr.md index bb0087c23..e2afd2e6f 100644 --- a/subjects/listforeachif.fr.md +++ b/subjects/listforeachif.fr.md @@ -4,13 +4,13 @@ Écrire une fonction `ListForEachIf` qui applique un fonction donnée en argument à la data contenue dans certaines des nodes d'une liste `l`. -- Cette fonction reçoit deux fonctions: +- Cette fonction reçoit deux fonctions: - - `f` est la fonction qui est appliqué à la node. + - `f` est la fonction qui est appliqué à la node. - - `cond` est une fonction qui retourne un `boolean` et qui sera utilisée pour déterminer si la fonction`f` doit être appliquée à la node. + - `cond` est une fonction qui retourne un `boolean` et qui sera utilisée pour déterminer si la fonction`f` doit être appliquée à la node. -- La fonction donnée en argument doit avoir un pointeur `*NodeL` comme argument. +- La fonction donnée en argument doit avoir un pointeur `*NodeL` comme argument. ### Fonction et structure attendues @@ -62,7 +62,7 @@ func ListForEachIf(l *List, f func(*NodeL), cond func(*NodeL) bool) { ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main diff --git a/subjects/listlast.en.md b/subjects/listlast.en.md index 26b1ce0e2..3c72f13b3 100644 --- a/subjects/listlast.en.md +++ b/subjects/listlast.en.md @@ -24,7 +24,7 @@ func ListLast(l *List) interface{} { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/listlast.fr.md b/subjects/listlast.fr.md index c9b400b84..480addd42 100644 --- a/subjects/listlast.fr.md +++ b/subjects/listlast.fr.md @@ -24,7 +24,7 @@ func ListLast(l *List) interface{} { ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main diff --git a/subjects/listmerge.en.md b/subjects/listmerge.en.md index 7714cfecb..69af3a389 100644 --- a/subjects/listmerge.en.md +++ b/subjects/listmerge.en.md @@ -4,7 +4,7 @@ Write a function `ListMerge` that places elements of a list `l2` at the end of another list `l1`. -- New elements should not be created! +- New elements should not be created! ### Expected function and structure @@ -26,7 +26,7 @@ func ListMerge(l1 *List, l2 *List) { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/listmerge.fr.md b/subjects/listmerge.fr.md index 3d68628a3..702b926ee 100644 --- a/subjects/listmerge.fr.md +++ b/subjects/listmerge.fr.md @@ -26,7 +26,7 @@ func ListMerge(l1 *List, l2 *List) { ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main diff --git a/subjects/listpushback.en.md b/subjects/listpushback.en.md index 2067a3753..4902b1010 100644 --- a/subjects/listpushback.en.md +++ b/subjects/listpushback.en.md @@ -24,7 +24,7 @@ func ListPushBack(l *List, data interface{}) { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/listpushback.fr.md b/subjects/listpushback.fr.md index 5f55dd67c..e76314f75 100644 --- a/subjects/listpushback.fr.md +++ b/subjects/listpushback.fr.md @@ -24,7 +24,7 @@ func ListPushBack(l *List, data interface{}) { ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main diff --git a/subjects/listpushfront.en.md b/subjects/listpushfront.en.md index 938a5872a..5ae98e006 100644 --- a/subjects/listpushfront.en.md +++ b/subjects/listpushfront.en.md @@ -24,7 +24,7 @@ func ListPushFront(l *List, data interface{}) { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/listpushfront.fr.md b/subjects/listpushfront.fr.md index a077dd5e8..93d33569e 100644 --- a/subjects/listpushfront.fr.md +++ b/subjects/listpushfront.fr.md @@ -24,7 +24,7 @@ func ListPushFront(l *List, data interface{}) { ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main diff --git a/subjects/listpushpara.en.md b/subjects/listpushpara.en.md index 98716369d..5ba32e482 100644 --- a/subjects/listpushpara.en.md +++ b/subjects/listpushpara.en.md @@ -4,7 +4,7 @@ Write a program that creates a new linked list and includes each command-line argument in to the list. -- The first argument should be at the end of the list +- The first argument should be at the end of the list And its output : diff --git a/subjects/listpushparams.en.md b/subjects/listpushparams.en.md index 8ff23cfce..b3fa39bc2 100644 --- a/subjects/listpushparams.en.md +++ b/subjects/listpushparams.en.md @@ -4,9 +4,7 @@ Write a program that creates a new linked list and includes each command-line argument in to the list. -- The first argument should be at the end of the list - -```` +- The first argument should be at the end of the list And its output : diff --git a/subjects/listpushparams.fr.md b/subjects/listpushparams.fr.md index 92d3d3b9e..591e99bfe 100644 --- a/subjects/listpushparams.fr.md +++ b/subjects/listpushparams.fr.md @@ -14,7 +14,7 @@ func CountIf(f func(string) bool, tab []string) int { ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main diff --git a/subjects/listremoveif.en.md b/subjects/listremoveif.en.md index 427bfd273..6336f898d 100644 --- a/subjects/listremoveif.en.md +++ b/subjects/listremoveif.en.md @@ -24,7 +24,7 @@ func ListRemoveIf(l *List, data_ref interface{}) { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/listremoveif.fr.md b/subjects/listremoveif.fr.md index 652035671..610f9857e 100644 --- a/subjects/listremoveif.fr.md +++ b/subjects/listremoveif.fr.md @@ -24,7 +24,7 @@ func ListRemoveIf(l *List, data_ref interface{}) { ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main diff --git a/subjects/listremoveifprog.en.md b/subjects/listremoveifprog.en.md index 7064813ac..db00c0c52 100644 --- a/subjects/listremoveifprog.en.md +++ b/subjects/listremoveifprog.en.md @@ -31,4 +31,4 @@ type List struct { func ListRemoveIf(l *List, data_ref interface{}) { } -``` \ No newline at end of file +``` diff --git a/subjects/listreverse.en.md b/subjects/listreverse.en.md index 4c1a1ed87..a64b5cc03 100644 --- a/subjects/listreverse.en.md +++ b/subjects/listreverse.en.md @@ -24,7 +24,7 @@ func ListReverse(l *List) { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/listreverse.fr.md b/subjects/listreverse.fr.md index 0ea58d91a..5bc676bec 100644 --- a/subjects/listreverse.fr.md +++ b/subjects/listreverse.fr.md @@ -24,7 +24,7 @@ func ListReverse(l *List) { ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main diff --git a/subjects/listsize.en.md b/subjects/listsize.en.md index e59e97741..42bef0a8b 100644 --- a/subjects/listsize.en.md +++ b/subjects/listsize.en.md @@ -24,7 +24,7 @@ func ListSize(l *List) int { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/listsize.fr.md b/subjects/listsize.fr.md index bc5d8495a..de0dd961f 100644 --- a/subjects/listsize.fr.md +++ b/subjects/listsize.fr.md @@ -24,7 +24,7 @@ func ListSize(l *List) int { ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main diff --git a/subjects/listsizeprog.en.md b/subjects/listsizeprog.en.md index 3e1a2b702..5684ee644 100644 --- a/subjects/listsizeprog.en.md +++ b/subjects/listsizeprog.en.md @@ -31,4 +31,4 @@ type List struct { func ListSize(l *List) int { } -``` \ No newline at end of file +``` diff --git a/subjects/listsort.en.md b/subjects/listsort.en.md index b7242d725..48ea4d195 100644 --- a/subjects/listsort.en.md +++ b/subjects/listsort.en.md @@ -4,7 +4,7 @@ Write a function `ListSort` that sorts the nodes of a linked list by ascending order. -- The `NodeI` structure will be the only one used. +- The `NodeI` structure will be the only one used. ### Expected function and structure @@ -21,7 +21,7 @@ func ListSort(l *NodeI) *NodeI { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/listsort.fr.md b/subjects/listsort.fr.md index 9f888c67f..f1bd1b170 100644 --- a/subjects/listsort.fr.md +++ b/subjects/listsort.fr.md @@ -4,7 +4,7 @@ Écrire une fonction `ListSort` qui trie les nodes d'une liste chaînée par ordre croissant. -- La structure `NodeI` sera la seule utilisée. +- La structure `NodeI` sera la seule utilisée. ### Fonction et structure attendues @@ -21,7 +21,7 @@ func ListSort(l *NodeI) *NodeI { ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main diff --git a/subjects/makerange.en.md b/subjects/makerange.en.md index b25cabe01..4e3e45946 100644 --- a/subjects/makerange.en.md +++ b/subjects/makerange.en.md @@ -21,7 +21,7 @@ func MakeRange(min, max int) []int { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/makerange.fr.md b/subjects/makerange.fr.md index b1894ba8d..003f1c51e 100644 --- a/subjects/makerange.fr.md +++ b/subjects/makerange.fr.md @@ -20,7 +20,7 @@ func MakeRange(min, max int) []int { ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main diff --git a/subjects/map.en.md b/subjects/map.en.md index 675602a31..3d6b1ddc7 100644 --- a/subjects/map.en.md +++ b/subjects/map.en.md @@ -14,7 +14,7 @@ func Map(f func(int) bool, arr []int) []bool { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/map.fr.md b/subjects/map.fr.md index 9fdd634a8..2be107000 100644 --- a/subjects/map.fr.md +++ b/subjects/map.fr.md @@ -14,7 +14,7 @@ func Map(f func(int) bool, arr []int) []bool { ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main diff --git a/subjects/max.en.md b/subjects/max.en.md index 652438d19..52638b8a7 100644 --- a/subjects/max.en.md +++ b/subjects/max.en.md @@ -14,7 +14,7 @@ func Max(arr []int) int { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/max.fr.md b/subjects/max.fr.md index 1ebf4cf56..67fba0918 100644 --- a/subjects/max.fr.md +++ b/subjects/max.fr.md @@ -14,7 +14,7 @@ func Max(arr []int) int { ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main diff --git a/subjects/maxprog.en.md b/subjects/maxprog.en.md index b4c20529a..42cccadbe 100644 --- a/subjects/maxprog.en.md +++ b/subjects/maxprog.en.md @@ -25,7 +25,7 @@ func Max(arr []int) int { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/merge.en.md b/subjects/merge.en.md index 4922b1dee..9f0d26344 100644 --- a/subjects/merge.en.md +++ b/subjects/merge.en.md @@ -66,7 +66,6 @@ Here is a possible program to test your function : ```go package main - func main() { mergedTree := &TreeNodeM{} t1 := NewRandTree() diff --git a/subjects/my-ls-1/my-ls-1.audit.en.md b/subjects/my-ls-1/my-ls-1.audit.en.md index 7733b49f6..bfd6dafc4 100644 --- a/subjects/my-ls-1/my-ls-1.audit.en.md +++ b/subjects/my-ls-1/my-ls-1.audit.en.md @@ -1,6 +1,6 @@ #### Functional -###### Has the requirement for the allowed packages been respected? (Reminder for this project: (only [standard packages](https://golang.org/pkg/) +###### Has the requirement for the allowed packages been respected? ##### Run both my-ls-1 and the system command `ls` with no arguments. diff --git a/subjects/my-ls-1/my-ls-1.en.md b/subjects/my-ls-1/my-ls-1.en.md index 044c4d57c..9963191d0 100644 --- a/subjects/my-ls-1/my-ls-1.en.md +++ b/subjects/my-ls-1/my-ls-1.en.md @@ -51,10 +51,6 @@ This project will help you learn about : - We suggest that you consult the `ls` command manual. -### Allowed packages - -- Only the [standard go](https://golang.org/pkg/) packages are allowed - ### Usage You can see how the `ls` command works, by using it on your terminal. diff --git a/subjects/nenokku.en.md b/subjects/nenokku.en.md new file mode 100644 index 000000000..f67080e05 --- /dev/null +++ b/subjects/nenokku.en.md @@ -0,0 +1,20 @@ +## nenokku + +### Instructions + +You are given unknown amount of operations. There are 3 types of operations, you should handle each appropriately: +1. "A word" - add the "word" into your "dictionary" of words. +2. "? word" - check if the "word" is in your "dictionary". +3. "x word" - end of operations. + +Intersection of words is counted as if it is in your dictionary (see example). +Write a program that takes as arguments operations. + +```console +$> ./main "? love" "? is" "A loveis" "? love" "? Who" "A Whoareyou" "? is" +NO +NO +YES +NO +YES +``` \ No newline at end of file diff --git a/subjects/nrune.en.md b/subjects/nrune.en.md index 3f33a0639..92f7c3987 100644 --- a/subjects/nrune.en.md +++ b/subjects/nrune.en.md @@ -16,7 +16,7 @@ func NRune(s string, n int) rune { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/nrune.fr.md b/subjects/nrune.fr.md index 0589bd063..0c9b2db8c 100644 --- a/subjects/nrune.fr.md +++ b/subjects/nrune.fr.md @@ -14,7 +14,7 @@ func NRune(s string, n int) rune { ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main diff --git a/subjects/nruneprog.en.md b/subjects/nruneprog.en.md index c1c9f9167..951977401 100644 --- a/subjects/nruneprog.en.md +++ b/subjects/nruneprog.en.md @@ -27,7 +27,7 @@ func NRune(s string, n int) rune { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/options.en.md b/subjects/options.en.md index dd6e38c75..490728dd3 100644 --- a/subjects/options.en.md +++ b/subjects/options.en.md @@ -4,21 +4,21 @@ Write a program that takes an undefined number of arguments which could be considered as `options` and writes on the standard output a representation of those `options` as groups of `bytes` followed by a newline (`'\n'`). -- An `option` is an argument that begins with a `-` and that can have multiple characters which could be : +- An `option` is an argument that begins with a `-` and that can have multiple characters which could be : -abcdefghijklmnopqrstuvwxyz -- All `options` are stocked in a single `int` and each `options` represents a bit of that `int`, and should be stocked like this : +- All `options` are stocked in a single `int` and each `options` represents a bit of that `int`, and should be stocked like this : - - 00000000 00000000 00000000 00000000 - - ******zy xwvutsrq ponmlkji hgfedcba + - 00000000 00000000 00000000 00000000 + - ******zy xwvutsrq ponmlkji hgfedcba -- Launching the program without arguments or with the `-h` flag activated must print all the valid `options` on the standard output, as shown on one of the following examples. +- Launching the program without arguments or with the `-h` flag activated must print all the valid `options` on the standard output, as shown on one of the following examples. -- Please note the `-h` flag has priority over the others flags when it is called first in one of the arguments. (See the examples) +- Please note the `-h` flag has priority over the others flags when it is called first in one of the arguments. (See the examples) -- A wrong `option` must print `Invalid Option` followed by a newline. +- A wrong `option` must print `Invalid Option` followed by a newline. -## Usage +### Usage ```console student@ubuntu:~/[[ROOT]]/test$ go build diff --git a/subjects/options.fr.md b/subjects/options.fr.md index a523f64c8..6f3ad9195 100644 --- a/subjects/options.fr.md +++ b/subjects/options.fr.md @@ -4,17 +4,17 @@ Écrire un programme qui prend un nombre indéfini d'arguments qui peuvent être considérés comme des `options` et qui affiche sur la sortie standard une représentation de ces `options` comme groupes de `bytes`(octets) suivi d'un retour à la ligne (`'\n'`). -- Une `option` est un argument qui commence avec un `-` et qui peux avoir de multiples caractères qui peuvent être : +- Une `option` est un argument qui commence avec un `-` et qui peux avoir de multiples caractères qui peuvent être : -abcdefghijklmnopqrstuvwxyz -- Toutes les `options` sont stockées dans un seul `int` et chaque `option` représente un bit de cet `int`, et doit être stocké comme ci-dessous : +- Toutes les `options` sont stockées dans un seul `int` et chaque `option` représente un bit de cet `int`, et doit être stocké comme ci-dessous : - - 00000000 00000000 00000000 00000000 - - ******zy xwvutsrq ponmlkji hgfedcba + - 00000000 00000000 00000000 00000000 + - ******zy xwvutsrq ponmlkji hgfedcba -- L'éxécution du programme sans argument ou avec l'option `-h` activée doit afficher toutes les `options` valides sur la sortie standard, comme montré dans un des exemples ci-dessous. +- L'éxécution du programme sans argument ou avec l'option `-h` activée doit afficher toutes les `options` valides sur la sortie standard, comme montré dans un des exemples ci-dessous. -- Une mauvaise `option` doit afficher `Invalid Option` suivi d'un retour à la ligne. +- Une mauvaise `option` doit afficher `Invalid Option` suivi d'un retour à la ligne. ## Utilisation diff --git a/subjects/piglatin.en.md b/subjects/piglatin.en.md new file mode 100644 index 000000000..890e6ba05 --- /dev/null +++ b/subjects/piglatin.en.md @@ -0,0 +1,32 @@ +## piglatin + +### Instructions + +Write a **program** that transforms a string passed as argument in its `Pig Latin` version. + +The rules used by Pig Latin are as follows: + +- If a word begins with a vowel, just add "ay" to the end. +- If it begins with a consonant, then we take all consonants before the first vowel and we put them on the end of the word and add "ay" at the end. + +If the word has no vowels the program should print "No vowels". + +If the number of arguments is different from one, the program prints a newline ("`\n`"). + +### Usage + +```console +student@ubuntu:~/student/test$ go build +student@ubuntu:~/student/test$ ./piglatin + +student@ubuntu:~/student/test$ ./piglatin pig | cat -e +igpay$ +student@ubuntu:~/student/test$ ./piglatin Is | cat -e +Isay$ +student@ubuntu:~/student/test$ ./piglatin crunch | cat -e +unchcray$ +student@ubuntu:~/student/test$ ./piglatin crnch | cat -e +No vowels$ +student@ubuntu:~/student/test$ ./piglatin something else | cat -e +$ +``` diff --git a/subjects/point.en.md b/subjects/point.en.md index a9109b8bb..85bae913e 100644 --- a/subjects/point.en.md +++ b/subjects/point.en.md @@ -4,11 +4,11 @@ Create a `.go` file. -- The code below has to be copied in that file. +- The code below has to be copied in that file. -- The necessary changes have to be applied so that the program works. +- The necessary changes have to be applied so that the program works. -- The program must be submitted inside a folder with the name `point`. +- The program must be submitted inside a folder with the name `point`. ### Code to be copied diff --git a/subjects/point.fr.md b/subjects/point.fr.md index 4cf7fbd4d..957ca9291 100644 --- a/subjects/point.fr.md +++ b/subjects/point.fr.md @@ -4,12 +4,11 @@ Créer un fichier `.go`. -- Le code ci-dessous doit être copié dans ce fichier. +- Le code ci-dessous doit être copié dans ce fichier. -- Les changements nécéssaires doivent être appliquer et the code below into that file - and do the necessary changes so that the program works. +- Les changements nécéssaires doivent être appliquer et the code below into that file and do the necessary changes so that the program works. -- Le programme doit être rendu dans un dossier nommé `boolean`. +- Le programme doit être rendu dans un dossier nommé `boolean`. ### Code à copier diff --git a/subjects/pointone.en.md b/subjects/pointone.en.md index ddd2d74df..d7aab1e87 100644 --- a/subjects/pointone.en.md +++ b/subjects/pointone.en.md @@ -2,7 +2,7 @@ ### Instructions -- Write a function that takes a **pointer to an int** as argument and gives to this int the value of 1. +- Write a function that takes a **pointer to an int** as argument and gives to this int the value of 1. ### Expected function @@ -14,20 +14,20 @@ func PointOne(n *int) { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main import ( - "fmt" - piscine ".." + "fmt" + piscine ".." ) func main() { - n := 0 - piscine.PointOne(&n) - fmt.Println(n) + n := 0 + piscine.PointOne(&n) + fmt.Println(n) } ``` diff --git a/subjects/pointone.fr.md b/subjects/pointone.fr.md index c39666550..66f29a449 100644 --- a/subjects/pointone.fr.md +++ b/subjects/pointone.fr.md @@ -2,7 +2,7 @@ ### Instructions -- Écrire une fonction qui prend un **pointeur sur int** en argument et qui assignes à cet int la valeur 1. +- Écrire une fonction qui prend un **pointeur sur int** en argument et qui assignes à cet int la valeur 1. ### Fonction attendue @@ -14,20 +14,20 @@ func PointOne(n *int) { ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main import ( - "fmt" - piscine ".." + "fmt" + piscine ".." ) func main() { - n := 0 - piscine.PointOne(&n) - fmt.Println(n) + n := 0 + piscine.PointOne(&n) + fmt.Println(n) } ``` diff --git a/subjects/printalphabet.en.md b/subjects/printalphabet.en.md index e676a275a..b682a208a 100644 --- a/subjects/printalphabet.en.md +++ b/subjects/printalphabet.en.md @@ -2,7 +2,7 @@ ### Instructions -Write a [program](TODO-LINK) that prints the Latin alphabet in lowercase on a single line. +Write a program that prints the Latin alphabet in lowercase on a single line. A line is a sequence of characters preceding the [end of line](https://en.wikipedia.org/wiki/Newline) character (`'\n'`). diff --git a/subjects/printalphabet.fr.md b/subjects/printalphabet.fr.md index 5501368a1..12a03c657 100644 --- a/subjects/printalphabet.fr.md +++ b/subjects/printalphabet.fr.md @@ -2,7 +2,7 @@ ### Instructions -Écrire un [programme](TODO-LINK) qui affiche l'alphabet latin en minuscule sur une seule ligne. +Écrire un programme qui affiche l'alphabet latin en minuscule sur une seule ligne. Une ligne est une suite de caractères précédant le caractère [fin de ligne](https://en.wikipedia.org/wiki/Newline) (`'\n'`). diff --git a/subjects/printbits.en.md b/subjects/printbits.en.md index e3d0b5328..259e21861 100644 --- a/subjects/printbits.en.md +++ b/subjects/printbits.en.md @@ -4,7 +4,7 @@ Write a program that takes a number as argument, and prints it in binary value **without a newline at the end**. -- If the the argument is not a number the program should print `00000000`. +- If the the argument is not a number the program should print `00000000`. ### Expected output : diff --git a/subjects/printbits.fr.md b/subjects/printbits.fr.md index fc699c085..724a1c24f 100644 --- a/subjects/printbits.fr.md +++ b/subjects/printbits.fr.md @@ -4,7 +4,7 @@ Écrire un programme qui prend un nombre en argument, et qui l'affiche en valeur binaire **sans newline à la fin**. -- Si l'argument n'est pas un nombre le programme doit afficher `00000000`. +- Si l'argument n'est pas un nombre le programme doit afficher `00000000`. ### Expected output : diff --git a/subjects/printchessboard.en.md b/subjects/printchessboard.en.md index c4ac06440..eebbe8ec0 100644 --- a/subjects/printchessboard.en.md +++ b/subjects/printchessboard.en.md @@ -16,5 +16,7 @@ student@ubuntu:~/[[ROOT]]/printchessboard$ ./printchessboard 4 3 | cat -e # # $ student@ubuntu:~/[[ROOT]]/printchessboard$ ./printchessboard 7 | cat -e Error$ +student@ubuntu:~/[[ROOT]]/printchessboard$ ./printchessboard 0 0 | cat -e +Error$ student@ubuntu:~/[[ROOT]]/printchessboard$ ``` diff --git a/subjects/printcomb.en.md b/subjects/printcomb.en.md index c55575f35..280ce5b5a 100644 --- a/subjects/printcomb.en.md +++ b/subjects/printcomb.en.md @@ -2,7 +2,7 @@ ### Instructions -Write a [function](TODO-LINK) that prints in ascending order on a single line all unique combinations of three different digits so that the first digit is lower than the second and the second is lower than the third. +Write a function that prints in ascending order on a single line all unique combinations of three different digits so that the first digit is lower than the second and the second is lower than the third. These combinations are separated by a comma and a space. @@ -16,7 +16,7 @@ func PrintComb() { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/printcomb.fr.md b/subjects/printcomb.fr.md index 714344d45..53bae5e6d 100644 --- a/subjects/printcomb.fr.md +++ b/subjects/printcomb.fr.md @@ -2,7 +2,7 @@ ### Instructions -Écrire une [fonction](TODO-LINK) qui affiche sur une seule ligne dans l'ordre croissant toutes les combinaisons possibles de trois chiffres différents tels que le premier est inférieur au second et le second est inférieur au troisième. +Écrire une fonction qui affiche sur une seule ligne dans l'ordre croissant toutes les combinaisons possibles de trois chiffres différents tels que le premier est inférieur au second et le second est inférieur au troisième. Les combinaisons sont séparées par une virgule et un espace. @@ -16,7 +16,7 @@ func PrintComb() { ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main diff --git a/subjects/printcomb2.en.md b/subjects/printcomb2.en.md index e287e4811..becea7252 100644 --- a/subjects/printcomb2.en.md +++ b/subjects/printcomb2.en.md @@ -2,7 +2,7 @@ ### Instructions -Write a [function](TODO-LINK) that prints in ascending order on a single line all possible combinations of two different two-digit numbers. +Write a function that prints in ascending order on a single line all possible combinations of two different two-digit numbers. These combinations are separated by a comma and a space. @@ -16,7 +16,7 @@ func PrintComb2() { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/printcomb2.fr.md b/subjects/printcomb2.fr.md index 7c640405c..cf52e375a 100644 --- a/subjects/printcomb2.fr.md +++ b/subjects/printcomb2.fr.md @@ -2,7 +2,7 @@ ### Instructions -Écrire une [fonction](TODO-LINK) qui affiche sur une seule ligne dans l'ordre croissant toutes les combinaisons possibles de deux nombres différents à deux chiffres. +Écrire une fonction qui affiche sur une seule ligne dans l'ordre croissant toutes les combinaisons possibles de deux nombres différents à deux chiffres. Les combinaisons sont séparées par une virgule et un espace. @@ -16,7 +16,7 @@ func PrintComb2() { ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main diff --git a/subjects/printcombn.en.md b/subjects/printcombn.en.md index 80fb42b71..c26caa0d8 100644 --- a/subjects/printcombn.en.md +++ b/subjects/printcombn.en.md @@ -2,15 +2,15 @@ ### Instructions -- Write a function that prints all possible combinations of **n** different digits in ascending order. +- Write a function that prints all possible combinations of **n** different digits in ascending order. -- n will be defined as : 0 < n < 10 +- n will be defined as : 0 < n < 10 below are your references for the **printing format** expected. -- (for n = 1) '0, 1, 2, 3, ...8, 9' +- (for n = 1) '0, 1, 2, 3, ...8, 9' -- (for n = 3) '012, 013, 014, 015, 016, 017, 018, 019, 023,...689, 789' +- (for n = 3) '012, 013, 014, 015, 016, 017, 018, 019, 023,...689, 789' ### Expected function @@ -22,7 +22,7 @@ func PrintCombN(n int) { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/printcombn.fr.md b/subjects/printcombn.fr.md index e6fe2018a..0e3776677 100644 --- a/subjects/printcombn.fr.md +++ b/subjects/printcombn.fr.md @@ -2,15 +2,15 @@ ### Instructions -- Écrire une fonction qui affiche toutes les combinaisons possibles de **n** chiffres différents en ordre croissant. +- Écrire une fonction qui affiche toutes les combinaisons possibles de **n** chiffres différents en ordre croissant. -- n sera défini tel que: 0 < n < 10 +- n sera défini tel que: 0 < n < 10 ci-dessous vos références pour le **format d'affichage** attendu. -- (pour n = 1) '0, 1, 2, 3, ...8, 9' +- (pour n = 1) '0, 1, 2, 3, ...8, 9' -- (pour n = 3) '012, 013, 014, 015, 016, 017, 018, 019, 023,...689, 789' +- (pour n = 3) '012, 013, 014, 015, 016, 017, 018, 019, 023,...689, 789' ### Fonction attendue @@ -22,7 +22,7 @@ func PrintCombN(n int) { ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main diff --git a/subjects/printdigits.fr.md b/subjects/printdigits.fr.md index cfa96dca2..948e31d3e 100644 --- a/subjects/printdigits.fr.md +++ b/subjects/printdigits.fr.md @@ -2,7 +2,7 @@ ### Instructions -Écrire un [programme](TODO-LINK) qui affiche les chiffres décimaux dans l'ordre croissant (de `0` à `9`) sur une seule ligne. +Écrire un programme qui affiche les chiffres décimaux dans l'ordre croissant (de `0` à `9`) sur une seule ligne. Une ligne est une suite de caractères précédant le caractère [fin de ligne](https://en.wikipedia.org/wiki/Newline) (`'\n'`). diff --git a/subjects/printdigitsprog.en.md b/subjects/printdigitsprog.en.md index a0f50a9cc..ef2b48dc3 100644 --- a/subjects/printdigitsprog.en.md +++ b/subjects/printdigitsprog.en.md @@ -2,7 +2,7 @@ ### Instructions -Write a [program](TODO-LINK) that prints the decimal digits in ascending order (from `0` to `9`) on a single line. +Write a program that prints the decimal digits in ascending order (from `0` to `9`) on a single line. A line is a sequence of characters preceding the [end of line](https://en.wikipedia.org/wiki/Newline) character (`'\n'`). @@ -13,4 +13,4 @@ student@ubuntu:~/printdigitsprog$ go build student@ubuntu:~/printdigitsprog$ ./main 0123456789 student@ubuntu:~/printdigitsprog$ -``` \ No newline at end of file +``` diff --git a/subjects/printhex.en.md b/subjects/printhex.en.md index eaaffc5fd..31ca6614c 100644 --- a/subjects/printhex.en.md +++ b/subjects/printhex.en.md @@ -4,8 +4,8 @@ Write a program that takes a positive (or zero) number expressed in base 10, and displays it in base 16 (with lowercase letters) followed by a newline (`'\n'`). -- If the number of parameters is different from 1, the program displays a newline. -- Error cases have to be handled as shown in the example below. +- If the number of parameters is different from 1, the program displays a newline. +- Error cases have to be handled as shown in the example below. ### Usage @@ -21,5 +21,5 @@ student@ubuntu:~/[[ROOT]]/test$ ./test student@ubuntu:~/[[ROOT]]/test$ ./test "123 132 1" | cat -e 0$ -student@ubuntu:~/[[ROOT]]/test$ +student@ubuntu:~/[[ROOT]]/test$ ``` diff --git a/subjects/printhex.fr.md b/subjects/printhex.fr.md index 59b3a274d..4727fe9d1 100644 --- a/subjects/printhex.fr.md +++ b/subjects/printhex.fr.md @@ -4,9 +4,8 @@ Écrire un programme qui prend un nombre positif (ou zéro) écrit en base 10, et qui l'affiche en base 16 (avec les lettres en minuscule) suivi d'un retour à la ligne (`'\n'`). -- Si le nombre de paramètres est différent de 1, le programme affiche un retour à la ligne. -- Les cas d'erreurs doivent être gérés comme montré dans l'exemple ci-dessous. - +- Si le nombre de paramètres est différent de 1, le programme affiche un retour à la ligne. +- Les cas d'erreurs doivent être gérés comme montré dans l'exemple ci-dessous. ### Utilisation @@ -22,5 +21,5 @@ student@ubuntu:~/[[ROOT]]/test$ ./test student@ubuntu:~/[[ROOT]]/test$ ./test "123 132 1" | cat -e 0$ -student@ubuntu:~/[[ROOT]]/test$ +student@ubuntu:~/[[ROOT]]/test$ ``` diff --git a/subjects/printnbr.en.md b/subjects/printnbr.en.md index 8bd391683..09c2b918a 100644 --- a/subjects/printnbr.en.md +++ b/subjects/printnbr.en.md @@ -16,17 +16,20 @@ func PrintNbr(n int) { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main -import piscine ".." - +import ( + piscine ".." + "github.com/01-edu/z01" +) func main() { piscine.PrintNbr(-123) piscine.PrintNbr(0) piscine.PrintNbr(123) + z01.PrintRune('\n') } ``` diff --git a/subjects/printnbr.fr.md b/subjects/printnbr.fr.md index a1594082d..e3c97f97c 100644 --- a/subjects/printnbr.fr.md +++ b/subjects/printnbr.fr.md @@ -16,7 +16,7 @@ func PrintNbr(n int) { ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main diff --git a/subjects/printnbrbase.en.md b/subjects/printnbrbase.en.md index 840e35f78..616da104a 100644 --- a/subjects/printnbrbase.en.md +++ b/subjects/printnbrbase.en.md @@ -8,9 +8,9 @@ If the base is not valid, the function prints `NV` (Not Valid): Validity rules for a base : -- A base must contain at least 2 characters. -- Each character of a base must be unique. -- A base should not contain `+` or `-` characters. +- A base must contain at least 2 characters. +- Each character of a base must be unique. +- A base should not contain `+` or `-` characters. The function has to manage negative numbers. (as shown in the example) @@ -24,7 +24,7 @@ func PrintNbrBase(nbr int, base string) { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/printnbrbase.fr.md b/subjects/printnbrbase.fr.md index 49195b9b8..76d817bac 100644 --- a/subjects/printnbrbase.fr.md +++ b/subjects/printnbrbase.fr.md @@ -8,9 +8,9 @@ Si la base n'est pas valide, la fonction affiche `NV` (Not Valid): Règles de validité d'une base : -- Une base doit contenir au moins 2 caractères. -- Chaque caractère d'une base doit être unique. -- Une base ne doit pas contenir les caractères `+` ou `-`. +- Une base doit contenir au moins 2 caractères. +- Chaque caractère d'une base doit être unique. +- Une base ne doit pas contenir les caractères `+` ou `-`. La fonction doit gérer les nombres négatifs (comme montré sur l'exemple). @@ -24,7 +24,7 @@ func PrintNbrBase(nbr int, base string) { ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main diff --git a/subjects/printnbrinorder.en.md b/subjects/printnbrinorder.en.md index 63b23bd82..832b6cb7c 100644 --- a/subjects/printnbrinorder.en.md +++ b/subjects/printnbrinorder.en.md @@ -16,7 +16,7 @@ func PrintNbrInOrder(n int) { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/printnbrinorder.fr.md b/subjects/printnbrinorder.fr.md index 63b23bd82..832b6cb7c 100644 --- a/subjects/printnbrinorder.fr.md +++ b/subjects/printnbrinorder.fr.md @@ -16,7 +16,7 @@ func PrintNbrInOrder(n int) { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/printreversealphabet.fr.md b/subjects/printreversealphabet.fr.md index b02d0d12c..382930e0e 100644 --- a/subjects/printreversealphabet.fr.md +++ b/subjects/printreversealphabet.fr.md @@ -2,7 +2,7 @@ ### Instructions -Écrire un [programme](TODO-LINK) qui affiche l'alphabet latin en minuscule dans l'ordre inverse (de `'z'` à `'a'`) sur une seule ligne. +Écrire un programme qui affiche l'alphabet latin en minuscule dans l'ordre inverse (de `'z'` à `'a'`) sur une seule ligne. Une ligne est une suite de caractères précédant le caractère [fin de ligne](https://en.wikipedia.org/wiki/Newline) (`'\n'`). diff --git a/subjects/printstr.en.md b/subjects/printstr.en.md index d85bb81dc..cd630b090 100644 --- a/subjects/printstr.en.md +++ b/subjects/printstr.en.md @@ -2,7 +2,7 @@ ### Instructions -- Write a function that prints one by one the characters of a `string` on the screen. +- Write a function that prints one by one the characters of a `string` on the screen. ### Expected function @@ -14,7 +14,7 @@ func PrintStr(str string) { ### Hints -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/printstr.fr.md b/subjects/printstr.fr.md index 6860b0890..270f31455 100644 --- a/subjects/printstr.fr.md +++ b/subjects/printstr.fr.md @@ -2,7 +2,7 @@ ### Instructions -- Écrire une fonction qui affiche un à un les caractères d'une `string` à l'écran. +- Écrire une fonction qui affiche un à un les caractères d'une `string` à l'écran. ### Fonction attendue @@ -14,7 +14,7 @@ func PrintStr(str string) { ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main diff --git a/subjects/printstrprog.en.md b/subjects/printstrprog.en.md index 59ff2a338..addf0f42d 100644 --- a/subjects/printstrprog.en.md +++ b/subjects/printstrprog.en.md @@ -2,7 +2,7 @@ ### Instructions -- Write a program that prints one by one the characters of a `string` passed as an argument of the program. +- Write a program that prints one by one the characters of a `string` passed as an argument of the program. ### Expected output : diff --git a/subjects/printstrprog.fr.md b/subjects/printstrprog.fr.md index e65da8410..043940b04 100644 --- a/subjects/printstrprog.fr.md +++ b/subjects/printstrprog.fr.md @@ -2,7 +2,7 @@ ### Instructions -- Écrire un programme qui affiche un à un les caractères d'une `string` passée en argument du programme. +- Écrire un programme qui affiche un à un les caractères d'une `string` passée en argument du programme. ### Utilisation : diff --git a/subjects/printwordstables.en.md b/subjects/printwordstables.en.md index fb92ca6ce..dc2f71415 100644 --- a/subjects/printwordstables.en.md +++ b/subjects/printwordstables.en.md @@ -18,12 +18,12 @@ func PrintWordsTables(table []string) { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main -import piscine ".." +import piscine ".." func main() { str := "Hello how are you?" diff --git a/subjects/printwordstables.fr.md b/subjects/printwordstables.fr.md index e5be061c7..c636bc569 100644 --- a/subjects/printwordstables.fr.md +++ b/subjects/printwordstables.fr.md @@ -18,12 +18,12 @@ func PrintWordsTables(table []string) { ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main -import piscine ".." +import piscine ".." func main() { diff --git a/subjects/push-swap/push-swap.en.md b/subjects/push-swap/push-swap.en.md index dcb9eb320..83035aa69 100644 --- a/subjects/push-swap/push-swap.en.md +++ b/subjects/push-swap/push-swap.en.md @@ -21,7 +21,7 @@ These are the instructions that you can use to sort the stack : - `ra` rotate stack `a` (shift up all elements of stack `a` by 1, the first element becomes the last one) - `rb` rotate stack `b` - `rr`execute `ra` and `rb` -- `rra` reverse rotate `a` (shift down all elements of stack `a` by 1, the first element becomes the last one) +- `rra` reverse rotate `a` (shift down all elements of stack `a` by 1, the last element becomes the first one) - `rrb` reverse rotate `b` - `rrr` execute `rra` and `rrb` diff --git a/subjects/raid1a.en.md b/subjects/raid1a.en.md index aa683d8a9..0e02c9126 100644 --- a/subjects/raid1a.en.md +++ b/subjects/raid1a.en.md @@ -6,7 +6,7 @@ Write a function `Raid1a` that prints a **valid** rectangle of width `x` and of The function must draw the rectangles as in the examples. -`x` and `y` will always be positive numbers. +`x` and `y` will always be positive numbers. Otherwise, the function should print nothing. ### Expected function diff --git a/subjects/raid1b.en.md b/subjects/raid1b.en.md index cc90bf521..41b705682 100644 --- a/subjects/raid1b.en.md +++ b/subjects/raid1b.en.md @@ -6,7 +6,7 @@ Write a function `Raid1b` that prints a **valid** rectangle of width `x` and of The function must draw the rectangles as in the examples. -`x` and `y` will always be positive numbers. +`x` and `y` will always be positive numbers. Otherwise, the function should print nothing. ### Expected function diff --git a/subjects/raid1c.en.md b/subjects/raid1c.en.md index 82bef4324..77aa21ee4 100644 --- a/subjects/raid1c.en.md +++ b/subjects/raid1c.en.md @@ -6,7 +6,7 @@ Write a function `Raid1c` that prints a **valid** rectangle of width `x` and of The function must draw the rectangles as in the examples. -`x` and `y` will always be positive numbers. +`x` and `y` will always be positive numbers. Otherwise, the function should print nothing. ### Expected function diff --git a/subjects/raid1d.en.md b/subjects/raid1d.en.md index 32f8495ad..3bfd67d46 100644 --- a/subjects/raid1d.en.md +++ b/subjects/raid1d.en.md @@ -6,7 +6,7 @@ Write a function `Raid1d` that prints a **valid** rectangle of width `x` and of The function must draw the rectangles as in the examples. -`x` and `y` will always be positive numbers. +`x` and `y` will always be positive numbers. Otherwise, the function should print nothing. ### Expected function diff --git a/subjects/raid1e.en.md b/subjects/raid1e.en.md index 3762f2714..36d54a6e4 100644 --- a/subjects/raid1e.en.md +++ b/subjects/raid1e.en.md @@ -6,7 +6,7 @@ Write a function `Raid1e` that prints a **valid** rectangle of width `x` and of The function must draw the rectangles as in the examples. -`x` and `y` will always be positive numbers. +`x` and `y` will always be positive numbers. Otherwise, the function should print nothing. ### Expected function diff --git a/subjects/raid2.en.md b/subjects/raid2.en.md index 3313f028b..e22f7752e 100644 --- a/subjects/raid2.en.md +++ b/subjects/raid2.en.md @@ -2,9 +2,9 @@ ### Instructions -- Create a program that resolves a sudoku. +- Create a program that resolves a sudoku. -- A valid sudoku has only one possible solution. +- A valid sudoku has only one possible solution. ### Usage diff --git a/subjects/raid2.fr.md b/subjects/raid2.fr.md index b39fb9bcf..ff843ad37 100644 --- a/subjects/raid2.fr.md +++ b/subjects/raid2.fr.md @@ -2,9 +2,9 @@ ### Instructions -- Créer un programme qui résout un sudoku. +- Créer un programme qui résout un sudoku. -- Un sudoku valide a seulement une solution possible. +- Un sudoku valide a seulement une solution possible. ### Usage diff --git a/subjects/raid3.en.md b/subjects/raid3.en.md index f207f2216..a2eea0cc2 100644 --- a/subjects/raid3.en.md +++ b/subjects/raid3.en.md @@ -6,11 +6,11 @@ This raid is based on the `raid1` functions. Create a program `raid3` that takes a `string` as an argument and displays the name of the matching `raid1` and its dimensions. -- If the argument is not a `raid1` the program should print `Not a Raid function`. +- If the argument is not a `raid1` the program should print `Not a Raid function`. -- All answers must end with a newline (`'\n'`). +- All answers must end with a newline (`'\n'`). -- If there is more than one `raid1` matches, the program must display them all alphabetically ordered and separated by a `||`. +- If there is more than one `raid1` matches, the program must display them all alphabetically ordered and separated by a `||`. ### Usage diff --git a/subjects/raid3.fr.md b/subjects/raid3.fr.md index 733bd7730..8bb400df8 100644 --- a/subjects/raid3.fr.md +++ b/subjects/raid3.fr.md @@ -6,11 +6,11 @@ Ce raid est basé sur les fonctions du `raid1`. Créer un programme `raid3` qui prend une `string` comme argument et qui affiche le nom du `raid1` correspondant et ses dimensions. -- Si l'argument n'est pas un des `raid1` le programme affiche `Not a Raid function`. +- Si l'argument n'est pas un des `raid1` le programme affiche `Not a Raid function`. -- Toutes les réponses doivent se terminer avec un retour à la ligne (`'\n'`). +- Toutes les réponses doivent se terminer avec un retour à la ligne (`'\n'`). -- Si il y a plus d'un `raid1` correspondant, le programme doit les afficher tous en ordre alphabétique et séparé par un `||`. +- Si il y a plus d'un `raid1` correspondant, le programme doit les afficher tous en ordre alphabétique et séparé par un `||`. ### Utilisation diff --git a/subjects/range.en.md b/subjects/range.en.md index 18acdb1df..cdee44ce0 100644 --- a/subjects/range.en.md +++ b/subjects/range.en.md @@ -4,11 +4,11 @@ Write a program which must: -- **Allocate (with `make`)** an array of integers. +- **Allocate (with `make`)** an array of integers. -- Fill it with consecutive values that begins at the first argument and end at the second argument (Including the values of thoses arguments !). +- Fill it with consecutive values that begins at the first argument and end at the second argument (Including the values of thoses arguments !). -- That prints the array. +- That prints the array. Errors should be handled. diff --git a/subjects/range.fr.md b/subjects/range.fr.md index 46974c035..cd5bedde4 100644 --- a/subjects/range.fr.md +++ b/subjects/range.fr.md @@ -4,11 +4,11 @@ Écrire un programme qui doit: -- Allouer (avec `make`) une slice d'entiers. +- Allouer (avec `make`) une slice d'entiers. -- Le remplir avec des valeurs consécutives qui commencent au premier argument et qui finissent au deuxième (En incluant les valeurs des deux arguments !) +- Le remplir avec des valeurs consécutives qui commencent au premier argument et qui finissent au deuxième (En incluant les valeurs des deux arguments !) -- Et qui affiche cette slice. +- Et qui affiche cette slice. Les erreurs doivent être gérées. diff --git a/subjects/reachablenumberprog.en.md b/subjects/reachablenumberprog.en.md new file mode 100644 index 000000000..8dd4ea9cc --- /dev/null +++ b/subjects/reachablenumberprog.en.md @@ -0,0 +1,53 @@ +## reachable_number + +## **WARNING! VERY IMPORTANT!** + +For this exercise a function will be tested **with the exam own main**. However the student **still needs** to submit a structured program: + +This means that: + +- The package needs to be named `package main`. +- The submitted code needs one declared function main(```func main()```) even if empty. +- The function main declared needs to **also pass** the `Restrictions Checker`(illegal functions tester). It is advised for the student to just empty the function main after its own testings are done. +- Every other rules are obviously the same than for a `program`. + +### Instructions + +Let us define a function f(x) by the following: first we add 1 to x, and then while the last digit of the number equals 0, we shall be deleting 0. Let us call 'y' reachable if we can apply **f** to **x** (zero or more times), and get **y**. 102 is reachable from 10098: f(f(f(10098))) = f(f(10099)) = f(101) = f(102). Any number is reachable from itself. You are given a positive number **n**, count how many integers are reachable from **n**. + +### Expected function + +```go +func Reachablenumber(n int) int { + +} +``` + +### Usage + +Here is a possible program to test your function : + +```go +package main + +import ( + "fmt" +) + +func main() { + fmt.Println(Reachablenumber(1)) + fmt.Println(Reachablenumber(10)) + fmt.Println(Reachablenumber(1001)) +} +``` + +And its output : + +```console +student@ubuntu:~/[[ROOT]]/test$ go build +student@ubuntu:~/[[ROOT]]/test$ ./test +9 +19 +36 +student@ubuntu:~/[[ROOT]]/test$ +``` diff --git a/subjects/rectangle.en.md b/subjects/rectangle.en.md index 85f5fe23b..be3bd7866 100644 --- a/subjects/rectangle.en.md +++ b/subjects/rectangle.en.md @@ -5,15 +5,15 @@ Consider that a point is defined by its coordinates and that a rectangle is defined by the points of the upper left and lower right corners. -- Define two structures named, `point` and `rectangle`. +- Define two structures named, `point` and `rectangle`. -- The struct `point` has to have two variables, `x` and `y`, type `int`. +- The struct `point` has to have two variables, `x` and `y`, type `int`. -- The struct `rectangle` has to have two variables, `upLeft` and `downRight` type `point`. +- The struct `rectangle` has to have two variables, `upLeft` and `downRight` type `point`. -- The goal is to make a program that: - - Given a slice of points of size `n` returns the smallest rectangle that contains all the points in the vector of points. The name of that function is `defineRectangle`. - - And which calculates and prints the area of that rectangle you define. +- The goal is to make a program that: + - Given a slice of points of size `n` returns the smallest rectangle that contains all the points in the vector of points. The name of that function is `defineRectangle`. + - And which calculates and prints the area of that rectangle you define. ### Expected main and function for the program diff --git a/subjects/rectangle.fr.md b/subjects/rectangle.fr.md index 0797dea59..038f378e2 100644 --- a/subjects/rectangle.fr.md +++ b/subjects/rectangle.fr.md @@ -4,15 +4,15 @@ Considérer qu'un point est défini par ses coordonnées et qu'un rectangle est défini par les points de son coin du haut à gauche et son coin du bas à droite. -- Définir deux structures nommées, `point` et `rectangle`. +- Définir deux structures nommées, `point` et `rectangle`. -- La structure `point` doit avoir deux variables, `x` et `y`, de type `int`. +- La structure `point` doit avoir deux variables, `x` et `y`, de type `int`. -- La structure `rectangle` doit avoir deux variables, `upLeft` et `downRight` de type `point`. +- La structure `rectangle` doit avoir deux variables, `upLeft` et `downRight` de type `point`. -- Le but est de faire un programme qui: - - Avec une slice de points donnée de taille `n` retournes le plus petit rectangle qui contient tous les points dans le vecteur de points0. Le nom de cette fonction est `defineRectangle`. - - Et qui calcules et affiche l'airethe de ce rectangle défini. +- Le but est de faire un programme qui: + - Avec une slice de points donnée de taille `n` retournes le plus petit rectangle qui contient tous les points dans le vecteur de points0. Le nom de cette fonction est `defineRectangle`. + - Et qui calcules et affiche l'airethe de ce rectangle défini. ### Main et fonctions attendues pour ce programme diff --git a/subjects/recursivefactorial.en.md b/subjects/recursivefactorial.en.md index 7013a4153..84f212342 100644 --- a/subjects/recursivefactorial.en.md +++ b/subjects/recursivefactorial.en.md @@ -18,7 +18,7 @@ func RecursiveFactorial(nb int) int { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/recursivefactorial.fr.md b/subjects/recursivefactorial.fr.md index 182500f63..4d64e80b4 100644 --- a/subjects/recursivefactorial.fr.md +++ b/subjects/recursivefactorial.fr.md @@ -18,7 +18,7 @@ func RecursiveFactorial(nb int) int { ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main diff --git a/subjects/recursivepower.en.md b/subjects/recursivepower.en.md index a8e8a7eb8..9f83dbdf6 100644 --- a/subjects/recursivepower.en.md +++ b/subjects/recursivepower.en.md @@ -18,7 +18,7 @@ func RecursivePower(nb int, power int) int { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/recursivepower.fr.md b/subjects/recursivepower.fr.md index f71823441..5d3bdc4d7 100644 --- a/subjects/recursivepower.fr.md +++ b/subjects/recursivepower.fr.md @@ -18,7 +18,7 @@ func RecursivePower(nb int, power int) int { ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main diff --git a/subjects/reduceint.en.md b/subjects/reduceint.en.md new file mode 100644 index 000000000..ad649b9c2 --- /dev/null +++ b/subjects/reduceint.en.md @@ -0,0 +1,62 @@ +## reduceint + +## **WARNING! VERY IMPORTANT!** + +For this exercise a function will be tested **with the exam own main**. However the student **still needs** to submit a structured program: + +This means that: + +- The package needs to be named `package main`. +- The submitted code needs one declared function main(```func main()```) even if empty. +- The function main declared needs to **also pass** the `Restrictions Checker`(illegal functions tester). It is advised for the student to just empty the function main after its own testings are done. +- Every other rules are obviously the same than for a `program`. + +### Instructions + +Write a function called `reduceint` that simulates the behaviour of reduce from JavaScript. + +The function should have as parameters a function, `f func(int, int) int` and a slice of integers, `arr []int`. You should apply for each element of the slice the arithmetic function, saving it and printing. + +### Expected function + +```go +func ReduceInt(f func(int, int) int, arr []int) { + +} +``` + +### Usage + +Here is a possible program to test your function : + +```go +package main + +func main() { + mul := func(acc int, cur int) int { + return acc * cur + } + sum := func(acc int, cur int) int { + return acc + cur + } + div := func(acc int, cur int) int { + return acc / cur + } + as := []int{500, 2} + ReduceInt(mul, as) + ReduceInt(sum, as) + ReduceInt(div, as) +} + +``` + +And its output : + +```console +student@ubuntu:~/[[ROOT]]/test$ go build +student@ubuntu:~/[[ROOT]]/test$ ./test +1000 +502 +250 +student@ubuntu:~/[[ROOT]]/test$ +``` diff --git a/subjects/reverse.en.md b/subjects/reverse.en.md index 9535f5f3a..2db9daa6d 100644 --- a/subjects/reverse.en.md +++ b/subjects/reverse.en.md @@ -39,7 +39,7 @@ Here is a possible program to test your function : package main import ( - "fmt" + "fmt" ) func pushBack(n *NodeAddL, num int) *NodeAddL{ @@ -62,7 +62,6 @@ func main() { } fmt.Println() } - ``` Its output: diff --git a/subjects/reverserange.en.md b/subjects/reverserange.en.md index 78199ae40..ac060a15d 100644 --- a/subjects/reverserange.en.md +++ b/subjects/reverserange.en.md @@ -4,11 +4,11 @@ Write a program which must: -- **Allocate (with `make`)** an array of integers. +- **Allocate (with `make`)** an array of integers. -- Fill it with consecutive values that begins at the second argument and end at the first argument (Including the values of thoses arguments !). +- Fill it with consecutive values that begins at the second argument and end at the first argument (Including the values of thoses arguments !). -- That prints the array. +- That prints the array. Errors should be handled. diff --git a/subjects/reverserange.fr.md b/subjects/reverserange.fr.md index 0c153d36d..fc145494e 100644 --- a/subjects/reverserange.fr.md +++ b/subjects/reverserange.fr.md @@ -4,11 +4,11 @@ Écrire un programme qui doit: -- Allouer (avec `make`) une slice d'entiers. +- Allouer (avec `make`) une slice d'entiers. -- Le remplir avec des valeurs consécutives qui commencent au deuxième argument et qui finissent au premier (en incluant les valeurs des deux arguments !) +- Le remplir avec des valeurs consécutives qui commencent au deuxième argument et qui finissent au premier (en incluant les valeurs des deux arguments !) -- Et qui affiche cette slice. +- Et qui affiche cette slice. Les erreurs doivent être gérées. diff --git a/subjects/reversestrcap.en.md b/subjects/reversestrcap.en.md index b9b37c2c9..a028f3b1d 100644 --- a/subjects/reversestrcap.en.md +++ b/subjects/reversestrcap.en.md @@ -7,8 +7,6 @@ Write a program that takes one or more `string` as arguments and that, **for eac in lowercase -then it displays the result followed by a newline (`'\n'`). -A word is a sequence of alphanumerical characters. - If there are no parameter, the program displays a newline. ### Usage diff --git a/subjects/revivethreenums.en.md b/subjects/revivethreenums.en.md new file mode 100644 index 000000000..ec4f9b674 --- /dev/null +++ b/subjects/revivethreenums.en.md @@ -0,0 +1,58 @@ +## revive_three_nums + +## **WARNING! VERY IMPORTANT!** + +For this exercise a function will be tested **with the exam own main**. However the student **still needs** to submit a structured program: + +This means that: + +- The package needs to be named `package main`. +- The submitted code needs one declared function main(```func main()```) even if empty. +- The function main declared needs to **also pass** the `Restrictions Checker`(illegal functions tester). It is advised for the student to just empty the function main after its own testings are done. +- Every other rules are obviously the same than for a `program`. + +### Instructions + +It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like). +Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32. + +The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for those interested. Sections 1.10.32 and 1.10.33 from "de Finibus Bonorum et Malorum" by Cicero are also reproduced in their exact original form, accompanied by English versions from the 1914 translation by H. Rackham. + +There are basically three integers: **a**, **b**, **c**. You are given 4 integers: **b+c**, **a+b**, **c+a**, **a+b+c** (not necessarily in this order). Return maximum of a, b, c. + +### Expected function + +```go +func Revive_three_nums(a, b, c, d int) int { + +} +``` + +### Usage + +Here is a possible program to test your function : + +```go +package main + +import ( + "fmt" +) + +func main() { + fmt.Println(Revive_three_nums(3, 6, 5, 4)) + fmt.Println(Revive_three_nums(40, 40, 40, 60)) + fmt.Println(Revive_three_nums(201, 101, 101, 200)) +} +``` + +And its output : + +```console +student@ubuntu:~/[[ROOT]]/test$ go build +student@ubuntu:~/[[ROOT]]/test$ ./test +3 +20 +100 +student@ubuntu:~/[[ROOT]]/test$ +``` diff --git a/subjects/revwstr.en.md b/subjects/revwstr.en.md index b7f789657..a95f9db4f 100644 --- a/subjects/revwstr.en.md +++ b/subjects/revwstr.en.md @@ -4,11 +4,11 @@ Write a program that takes a `string` as a parameter, and prints its words in reverse. -- A word is a sequence of **alphanumerical** characters. +- A word is a sequence of **alphanumerical** characters. -- If the number of parameters is different from 1, the program will display newline (`'\n'`). +- If the number of parameters is different from 1, the program will display newline (`'\n'`). -- In the parameters that are going to be tested, there will not be any extra spaces. (meaning that there will not be additionnal spaces at the beginning or at the end of the `string`and that words will always be separated by exactly one space). +- In the parameters that are going to be tested, there will not be any extra spaces. (meaning that there will not be additional spaces at the beginning or at the end of the `string` and that words will always be separated by exactly one space). ### Usage diff --git a/subjects/revwstr.fr.md b/subjects/revwstr.fr.md index 4d2344d7d..2eb541fda 100644 --- a/subjects/revwstr.fr.md +++ b/subjects/revwstr.fr.md @@ -4,11 +4,11 @@ Écrire un programme qui prend une `string` comme paramètre, et affiche ses mots en sens inverse. -- Un mot est une suite de caractères **alphanumériques.** +- Un mot est une suite de caractères **alphanumériques.** -- Si le nombre de paramètres est différent de 1, le programme affiche un retour à la ligne (`'\n'`). +- Si le nombre de paramètres est différent de 1, le programme affiche un retour à la ligne (`'\n'`). -- Dans les paramètres qui seront testés, il n'y aura pas d'espaces extra. (ce qui signifie qu'il n'y aura pas d'espaces additionnels, ni au début, ni à la fin de la `string` et que les mots seront toujours séparés par un seul espace). +- Dans les paramètres qui seront testés, il n'y aura pas d'espaces extra. (ce qui signifie qu'il n'y aura pas d'espaces additionnels, ni au début, ni à la fin de la `string` et que les mots seront toujours séparés par un seul espace). ### Utilisation @@ -22,5 +22,5 @@ student@ubuntu:~/[[ROOT]]/test$ ./test "he stared at the mountain" mountain the at stared he student@ubuntu:~/[[ROOT]]/test$ ./test "" | cat-e $ -student@ubuntu:~/[[ROOT]]/test$ +student@ubuntu:~/[[ROOT]]/test$ ``` diff --git a/subjects/romannumbers.en.md b/subjects/romannumbers.en.md new file mode 100644 index 000000000..b9ab87e04 --- /dev/null +++ b/subjects/romannumbers.en.md @@ -0,0 +1,54 @@ +## romannumbers + +### Instructions + +Write a program called `rn`. The objective is to convert a number, given as an argument, into a roman number and print it with its roman number calculation. + +The program should have a limit of `4000`. In case of an invalid number, for example `"hello"` or `0` the program should print `ERROR: can not convert to roman digit`. + +Roman Numerals reminder: + +| I | 1 | +|:-:|:----:| +| V | 5 | +| X | 10 | +| L | 50 | +| C | 100 | +| D | 500 | +| M | 1000 | + +For example, the number 1732 would be denoted MDCCXXXII in Roman numerals. However, Roman numerals are not a purely additive number system. In particular, instead of using four symbols to represent a 4, 40, 9, 90, etc. (i.e., IIII, XXXX, VIIII, LXXXX, etc.), such numbers are instead denoted by preceding the symbol for 5, 50, 10, 100, etc., with a symbol indicating subtraction. For example, 4 is denoted IV, 9 as IX, 40 as XL, etc. + +The following table gives the Roman numerals for the first few positive integers. + +| 1 | I | 11 | XI | 21 | XXI | +|:--:|:----:|:--:|:-----:|:--:|:------:| +| 2 | II | 12 | XII | 22 | XXII | +| 3 | III | 13 | XIII | 23 | XXIII | +| 4 | IV | 14 | XIV | 24 | XXIV | +| 5 | V | 15 | XV | 25 | XXV | +| 6 | VI | 16 | XVI | 26 | XXVI | +| 7 | VII | 17 | XVII | 27 | XXVII | +| 8 | VIII | 18 | XVIII | 28 | XXVIII | +| 9 | XIX | 19 | XIX | 29 | XXIX | +| 10 | X | 20 | XX | 30 | XXX | + +## Usage + +```console +student@ubuntu:~/[[ROOT]]/test$ go build +student@ubuntu:~/[[ROOT]]/test$ ./rn hello +ERROR: can not convert to roman digit +student@ubuntu:~/[[ROOT]]/test$ ./rn 123 +C+X+X+I+I+I +CXXIII +student@ubuntu:~/[[ROOT]]/test$ ./rn 999 +(M-C)+(C-X)+(X-I) +CMXCIX +student@ubuntu:~/[[ROOT]]/test$ ./rn 3999 +M+M+M+(M-C)+(C-X)+(X-I) +MMMCMXCIX +student@ubuntu:~/[[ROOT]]/test$ ./rn 4000 +ERROR: can not convert to roman digit +student@ubuntu:~/[[ROOT]]/test$ +``` diff --git a/subjects/rot13.en.md b/subjects/rot13.en.md index d21f41cc1..5f44a700b 100644 --- a/subjects/rot13.en.md +++ b/subjects/rot13.en.md @@ -5,11 +5,11 @@ Write a program that takes a `string` and displays it, replacing each of its letters by the letter 13 spaces ahead in alphabetical order. -- 'z' becomes 'm' and 'Z' becomes 'M'. Case remains unaffected. +- 'z' becomes 'm' and 'Z' becomes 'M'. The case of the letter stays the same. -- The output will be followed by a newline (`'\n'`). +- The output will be followed by a newline (`'\n'`). -- If the number of arguments is different from 1, the program displays a newline (`'\n'`). +- If the number of arguments is different from 1, the program displays a newline (`'\n'`). ### Usage diff --git a/subjects/rot13.fr.md b/subjects/rot13.fr.md index 6174cb695..a17a91e07 100644 --- a/subjects/rot13.fr.md +++ b/subjects/rot13.fr.md @@ -4,11 +4,11 @@ Écrire un programme qui prend une `string` et qui l'affiche, en remplaçant chacune de ses lettres par la lettre qui est 13 positions plus loin dans l'ordre alphabétique. -- 'z' devient 'm' et 'Z' devient 'M'. Les majuscules restent des majuscules, de même pour les minuscules. +- 'z' devient 'm' et 'Z' devient 'M'. Les majuscules restent des majuscules, de même pour les minuscules. -- l'output sera suivi d'un retour à la ligne (`'\n'`). +- l'output sera suivi d'un retour à la ligne (`'\n'`). -- Si le nombre d'arguments est différent de 1, le programme affiche un retour à la ligne (`'\n'`). +- Si le nombre d'arguments est différent de 1, le programme affiche un retour à la ligne (`'\n'`). ### Utilisation diff --git a/subjects/rot14.en.md b/subjects/rot14.en.md index 482df7c8c..db6880ee7 100644 --- a/subjects/rot14.en.md +++ b/subjects/rot14.en.md @@ -14,7 +14,7 @@ func Rot14(str string) string { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/rot14.fr.md b/subjects/rot14.fr.md index a277fd2bd..678c02dc0 100644 --- a/subjects/rot14.fr.md +++ b/subjects/rot14.fr.md @@ -4,7 +4,7 @@ Écrire une fonction `rot14` qui retourne la `string` en paramètre transformée en `string rot14`. -- Il faut savoir ce que `rot13` signifie. +- Il faut savoir ce que `rot13` signifie. ### Fonction attendue @@ -16,7 +16,7 @@ func Rot14(str string) string { ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main diff --git a/subjects/sametree.en.md b/subjects/sametree.en.md index 9418f2d16..ebe13d864 100644 --- a/subjects/sametree.en.md +++ b/subjects/sametree.en.md @@ -38,51 +38,52 @@ Example 1: Input: - 1 - / \ - 2 3 + 1 + / \ + 2 3 - [1,2,3] + [1,2,3] - 1 - / \ - 2 3 - - [1,2,3] + 1 + / \ + 2 3 + + [1,2,3] Output: true Input: - 1 - / - 2 - - [1,2], + 1 + / + 2 + + [1,2] + + 1 + \ + 2 - 1 - \ - 2 - - [1,null,2] + [1,null,2] Output: false Input: ``` - 1 - / \ - 2 1 - - [1,2,1], - - 1 - / \ - 1 2 - - [1,1,2] + 1 + / \ + 2 1 + + [1,2,1] + + 1 + / \ + 1 2 + + [1,1,2] ``` + Output: false ### Usage @@ -93,10 +94,10 @@ Here is a possible program to test your function : package main func main() { - t1 := NewRandTree() - t2 := NewRandTree() + t1 := NewRandTree() + t2 := NewRandTree() - fmt.Println(IsSameTree(t1, t2)) + fmt.Println(IsSameTree(t1, t2)) } ``` diff --git a/subjects/searchreplace.en.md b/subjects/searchreplace.en.md index d7a7158f3..275a72530 100644 --- a/subjects/searchreplace.en.md +++ b/subjects/searchreplace.en.md @@ -4,9 +4,9 @@ Write a program that takes 3 arguments, the first argument is a `string` in which to replace a letter (the 2nd argument) by another one (the 3rd argument). -- If the number of arguments is different from 3, the program displays a newline (`'\n'`). +- If the number of arguments is different from 3, the program displays a newline (`'\n'`). -- If the second argument is not contained in the first one (the string) then the program rewrites the `string` followed by a newline (`'\n'`). +- If the second argument is not contained in the first one (the string) then the program rewrites the `string` followed by a newline (`'\n'`). ### Usage diff --git a/subjects/searchreplace.fr.md b/subjects/searchreplace.fr.md index 2dc772ce5..de0e90a5a 100644 --- a/subjects/searchreplace.fr.md +++ b/subjects/searchreplace.fr.md @@ -4,9 +4,9 @@ Écrire un programme qui prends 3 arguments, le premier argument est une `string` dans laquelle une lettre (le 2éme argument) est remplacée par une autre (3éme argument). -- Si le nombre d'aruments n'est pas 3, le programme affiche un retour à la ligne (`'\n'`). +- Si le nombre d'aruments n'est pas 3, le programme affiche un retour à la ligne (`'\n'`). -- Si le second argument n'est pas contenu dans le premier (la `string`) alors le programme réécris la `string` suivi d'un retour à la ligne (`'\n'`). +- Si le second argument n'est pas contenu dans le premier (la `string`) alors le programme réécris la `string` suivi d'un retour à la ligne (`'\n'`). ### Utilisation diff --git a/subjects/sliceprog.en.md b/subjects/sliceprog.en.md new file mode 100644 index 000000000..8051399bc --- /dev/null +++ b/subjects/sliceprog.en.md @@ -0,0 +1,60 @@ +## slice + +## **WARNING! VERY IMPORTANT!** + +For this exercise a function will be tested **with the exam own main**. However the student **still needs** to submit a structured program: + +This means that: + +- The package needs to be named `package main`. +- The submitted code needs one declared function main(```func main()```) even if empty. +- The function main declared needs to **also pass** the `Restrictions Checker`(illegal functions tester). It is advised for the student to just empty the function main after its own testings are done. +- Every other rules are obviously the same than for a `program`. + +### Instructions + +Write a **function** that replicates the javascript function `slice`. + +The function receives an array of strings and one or more integers, and returns an array of strings. The returned array is part of the received one but cut from the position indicated in the first int, until the position indicated by the second int. + +In case there only exists one int, the resulting array begins in the position indicated by the int and ends at the end of the received array. + +The ints can be lower than 0. + +### Expected function + +```go +func Slice(arr []string, nbrs... int) []string{ + +} +``` + + +### Usage + +Here is a possible program to test your function : + +```go +package main + +import "fmt" + +func main(){ + arr := []string{"coding", "algorithm", "ascii", "package", "golang"} + fmt.Println(Slice(arr, 1)) + fmt.Println(Slice(arr, 2, 4)) + fmt.Println(Slice(arr, -3)) + fmt.Println(Slice(arr, -2, -1)) + fmt.Println(Slice(arr, 2, 0)) +} +``` + +```console +student@ubuntu:~/student/test$ go build +student@ubuntu:~/student/test$ ./test +[algorithm ascii package golang] +[ascii package] +[ascii package golang] +[package] +[] +``` diff --git a/subjects/sortedlistmerge.en.md b/subjects/sortedlistmerge.en.md index a04d27dd5..bc0428faa 100644 --- a/subjects/sortedlistmerge.en.md +++ b/subjects/sortedlistmerge.en.md @@ -4,7 +4,7 @@ Write a function `SortedListMerge` that merges two lists `n1` and `n2` in ascending order. -- During the tests `n1` and `n2` will already be initially sorted. +- During the tests `n1` and `n2` will already be initially sorted. ### Expected function and structure @@ -16,7 +16,7 @@ func SortedListMerge(n1 *NodeI, n2 *NodeI) *NodeI { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/sortedlistmerge.fr.md b/subjects/sortedlistmerge.fr.md index 542774e0e..64c39c8b8 100644 --- a/subjects/sortedlistmerge.fr.md +++ b/subjects/sortedlistmerge.fr.md @@ -4,7 +4,7 @@ Écrire une fonction `SortedListMerge` qui merge deux listes `n1` et `n2` en ordre ascendant. -- Pendant les tests `n1` et `n2` seront déjà triées. +- Pendant les tests `n1` et `n2` seront déjà triées. ### Fonction et structure attendues @@ -16,7 +16,7 @@ func SortedListMerge(n1 *NodeI, n2 *NodeI) *NodeI { ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main diff --git a/subjects/sortintegertable.en.md b/subjects/sortintegertable.en.md index 7d5494e40..e0ba79e00 100644 --- a/subjects/sortintegertable.en.md +++ b/subjects/sortintegertable.en.md @@ -2,7 +2,7 @@ ### Instructions -- Write a function that reorder an array of `int` in ascending order. +- Write a function that reorder an array of `int` in ascending order. ### Expected function @@ -14,7 +14,7 @@ func SortIntegerTable(table []int) { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/sortlist.en.md b/subjects/sortlist.en.md index 53f9d8ccc..fc054af1c 100644 --- a/subjects/sortlist.en.md +++ b/subjects/sortlist.en.md @@ -4,9 +4,9 @@ Write a function that must: -- Sort the list given as a parameter, using the function cmp to select the order to apply, +- Sort the list given as a parameter, using the function cmp to select the order to apply, -- Return a pointer to the first element of the sorted list. +- Return a pointer to the first element of the sorted list. Duplications must remain. @@ -29,7 +29,7 @@ func SortList (l *NodeList, cmp func(a,b int) bool) *NodeList{ } ``` -- For example, the following function used as `cmp` will sort the list in ascending order : +- For example, the following function used as `cmp` will sort the list in ascending order : ```go func ascending(a, b int) bool{ diff --git a/subjects/sortlist.fr.md b/subjects/sortlist.fr.md index e6a9ff7a6..c7b52e18f 100644 --- a/subjects/sortlist.fr.md +++ b/subjects/sortlist.fr.md @@ -4,9 +4,9 @@ Écrire une fonction qui doit : -- Trier la liste donnée en paramètre en utilisant la fonction cmp pour sélectionner l'ordre à appliquer, +- Trier la liste donnée en paramètre en utilisant la fonction cmp pour sélectionner l'ordre à appliquer, -- Retourner un pointeur au premier élément de la liste triée. +- Retourner un pointeur au premier élément de la liste triée. Les duplications doivent rester. @@ -29,7 +29,7 @@ func SortList (l *NodeList, cmp func(a,b int) bool) *NodeList{ } ``` -- Par exemple, la fonction suivante utilisée comme `cmp` triera la liste dans l'ordre croissant : +- Par exemple, la fonction suivante utilisée comme `cmp` triera la liste dans l'ordre croissant : ```go func ascending(a, b int) bool{ diff --git a/subjects/sortlistinsert.en.md b/subjects/sortlistinsert.en.md index ec51d44f9..027eb9b74 100644 --- a/subjects/sortlistinsert.en.md +++ b/subjects/sortlistinsert.en.md @@ -4,7 +4,7 @@ Write a function `SortListInsert` that inserts `data_ref` in the linked list `l` while keeping the list sorted in ascending order. -- During the tests the list passed as an argument will be already sorted. +- During the tests the list passed as an argument will be already sorted. ### Expected function and structure @@ -16,7 +16,7 @@ func SortListInsert(l *NodeI, data_ref int) *NodeI{ ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/sortlistinsert.fr.md b/subjects/sortlistinsert.fr.md index 952d87d5e..c6e2112ce 100644 --- a/subjects/sortlistinsert.fr.md +++ b/subjects/sortlistinsert.fr.md @@ -5,7 +5,7 @@ Écrire une fonction `SortListInsert` qui insère `data_ref` dans la liste chaînée `l` tout en gardant cette liste triée par ordre croissant. -- Pendant les tests la liste passée en argument sera déjà triée. +- Pendant les tests la liste passée en argument sera déjà triée. ### Fonction et structure attendues @@ -17,7 +17,7 @@ func SortListInsert(l *NodeI, data_ref int) *NodeI{ ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main diff --git a/subjects/sortll.en.md b/subjects/sortll.en.md index 2ce278c49..84830e9b1 100644 --- a/subjects/sortll.en.md +++ b/subjects/sortll.en.md @@ -32,13 +32,14 @@ func Sortll(node *NodeAddL) *NodeAddL { ``` ### Usage + Here is a possible program to test your function: ```go package main import ( - "fmt" + "fmt" ) // I implemented pushBack for this diff --git a/subjects/sortwordarr.en.md b/subjects/sortwordarr.en.md index 0d5b270de..5960ce31f 100644 --- a/subjects/sortwordarr.en.md +++ b/subjects/sortwordarr.en.md @@ -14,7 +14,7 @@ func SortWordArr(array []string) { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/sortwordarr.fr.md b/subjects/sortwordarr.fr.md index 097a95c0d..07f0379ed 100644 --- a/subjects/sortwordarr.fr.md +++ b/subjects/sortwordarr.fr.md @@ -14,7 +14,7 @@ func SortWordArr(array []string) { ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main diff --git a/subjects/sortwordarrprog.en.md b/subjects/sortwordarrprog.en.md index 23914ad3e..af3f0e029 100644 --- a/subjects/sortwordarrprog.en.md +++ b/subjects/sortwordarrprog.en.md @@ -25,7 +25,7 @@ func SortWordArr(array []string) { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/sortwordarrprog.fr.md b/subjects/sortwordarrprog.fr.md index 17b2f777d..639d8336f 100644 --- a/subjects/sortwordarrprog.fr.md +++ b/subjects/sortwordarrprog.fr.md @@ -25,7 +25,7 @@ func SortWordArr(array []string) { ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main diff --git a/subjects/split.en.md b/subjects/split.en.md index 3f1a14ec9..fd8e6e467 100644 --- a/subjects/split.en.md +++ b/subjects/split.en.md @@ -16,7 +16,7 @@ func Split(str, charset string) []string { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/split.fr.md b/subjects/split.fr.md index 69cb3efb4..0a6d4f319 100644 --- a/subjects/split.fr.md +++ b/subjects/split.fr.md @@ -16,7 +16,7 @@ func Split(str, charset string) []string { ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main diff --git a/subjects/splitprog.fr.md b/subjects/splitprog.fr.md index 1b03afb3e..312502bc3 100644 --- a/subjects/splitprog.fr.md +++ b/subjects/splitprog.fr.md @@ -11,7 +11,6 @@ Cela signifie que: - La fonction main déclarée doit **aussi passer** le `Restrictions Checker`(le testeur de fonctions illégales). Il est conseillé à l'étudiant de rendre une fonction main vide après ses tests finis. - Toutes les autres régles sont les mêmes que pour un `programme`. - ### Instructions Écrire une fonction qui sépare les mots d'une `string`, qui les met dans un tableau de `string`. @@ -44,7 +43,6 @@ func main() { } ``` - Et son résultat : ```console diff --git a/subjects/splitwhitespaces.en.md b/subjects/splitwhitespaces.en.md index 14ba16c1b..d2f29673a 100644 --- a/subjects/splitwhitespaces.en.md +++ b/subjects/splitwhitespaces.en.md @@ -16,7 +16,7 @@ func SplitWhiteSpaces(str string) []string { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/sqrt.en.md b/subjects/sqrt.en.md index ead4759dc..dbfe7c800 100644 --- a/subjects/sqrt.en.md +++ b/subjects/sqrt.en.md @@ -14,7 +14,7 @@ func Sqrt(nb int) int { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/sqrt.fr.md b/subjects/sqrt.fr.md index 1df230ea5..e0c34b055 100644 --- a/subjects/sqrt.fr.md +++ b/subjects/sqrt.fr.md @@ -14,7 +14,7 @@ func Sqrt(nb int) int { ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main diff --git a/subjects/strlen.en.md b/subjects/strlen.en.md index 342699099..bea50067d 100644 --- a/subjects/strlen.en.md +++ b/subjects/strlen.en.md @@ -2,7 +2,7 @@ ### Instructions -- Write a function that counts the `runes` of a `string` and that returns that count. +- Write a function that counts the `runes` of a `string` and that returns that count. ### Expected function @@ -14,7 +14,7 @@ func StrLen(str string) int { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/strlen.fr.md b/subjects/strlen.fr.md index fc343e71a..1a45ba32c 100644 --- a/subjects/strlen.fr.md +++ b/subjects/strlen.fr.md @@ -2,7 +2,7 @@ ### Instructions -- Écrire une fonction qui compte le nombre de `runes` d'une `string` et qui retourne le nombre trouvé. +- Écrire une fonction qui compte le nombre de `runes` d'une `string` et qui retourne le nombre trouvé. ### Fonction attendue @@ -14,7 +14,7 @@ func StrLen(str string) int { ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main diff --git a/subjects/strlenprog.en.md b/subjects/strlenprog.en.md index e89484f39..c69e90d5a 100644 --- a/subjects/strlenprog.en.md +++ b/subjects/strlenprog.en.md @@ -25,7 +25,7 @@ func StrLen(str string) int { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/strlenprog.fr.md b/subjects/strlenprog.fr.md index ce5205801..27e81301f 100644 --- a/subjects/strlenprog.fr.md +++ b/subjects/strlenprog.fr.md @@ -25,19 +25,18 @@ func StrLen(str string) int { ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main import ( "fmt" - piscine ".." ) func main() { str := "Hello World!" - nb := piscine.StrLen(str) + nb := StrLen(str) fmt.Println(nb) } ``` diff --git a/subjects/strrev.en.md b/subjects/strrev.en.md index e21834053..ff47f90e4 100644 --- a/subjects/strrev.en.md +++ b/subjects/strrev.en.md @@ -2,9 +2,9 @@ ### Instructions -- Write a function that reverses a `string`. +- Write a function that reverses a `string`. -- This function will **return** the s `string`. +- This function will **return** the s `string`. ### Expected function @@ -16,7 +16,7 @@ func StrRev(s string) string { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/strrev.fr.md b/subjects/strrev.fr.md index 1babd18f0..0ba8c64e3 100644 --- a/subjects/strrev.fr.md +++ b/subjects/strrev.fr.md @@ -2,9 +2,9 @@ ### Instructions -- Écrire une fonction qui inverse une chaîne de caractères(`string`). +- Écrire une fonction qui inverse une chaîne de caractères(`string`). -- Cette fonction **retournera** la chaîne de caractères s(`string`). +- Cette fonction **retournera** la chaîne de caractères s(`string`). ### Fonction attendue @@ -16,7 +16,7 @@ func StrRev(s string) string { ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main diff --git a/subjects/strrevprog.en.md b/subjects/strrevprog.en.md index 6b4a34004..c6f6574ed 100644 --- a/subjects/strrevprog.en.md +++ b/subjects/strrevprog.en.md @@ -2,7 +2,7 @@ ### Instructions -- Write a program that reverses a `string` and prints it in the standard output. +- Write a program that reverses a `string` and prints it in the standard output. ### Expected output : diff --git a/subjects/strrevprog.fr.md b/subjects/strrevprog.fr.md index 1233a6ef9..48581f8df 100644 --- a/subjects/strrevprog.fr.md +++ b/subjects/strrevprog.fr.md @@ -2,7 +2,7 @@ ### Instructions -- Écrire un programme qui inverse une `string` et qui l'affiche dans la sortie standard. +- Écrire un programme qui inverse une `string` et qui l'affiche dans la sortie standard. ### Utilisation : diff --git a/subjects/swap.en.md b/subjects/swap.en.md index 39d7ad703..09af35d90 100644 --- a/subjects/swap.en.md +++ b/subjects/swap.en.md @@ -2,7 +2,7 @@ ### Instructions -- Write a function that swaps the contents of two **pointers to an int** (`*int`). +- Write a function that swaps the contents of two **pointers to an int** (`*int`). ### Expected function @@ -14,7 +14,7 @@ func Swap(a *int, b *int) { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/swap.fr.md b/subjects/swap.fr.md index a4f439a7d..95864263a 100644 --- a/subjects/swap.fr.md +++ b/subjects/swap.fr.md @@ -2,7 +2,7 @@ ### Instructions -- Écrire une fonction qui échange les contenus de deux **pointeurs sur entier** (`*int`). +- Écrire une fonction qui échange les contenus de deux **pointeurs sur entier** (`*int`). ### Fonction attendue diff --git a/subjects/swapprog.en.md b/subjects/swapprog.en.md index 01e2f9252..74ff54727 100644 --- a/subjects/swapprog.en.md +++ b/subjects/swapprog.en.md @@ -13,7 +13,7 @@ This means that: ### Instructions -- Write a function that swaps the contents of two **pointers to an int** (`*int`). +- Write a function that swaps the contents of two **pointers to an int** (`*int`). ### Expected function diff --git a/subjects/sweetproblem.en.md b/subjects/sweetproblem.en.md new file mode 100644 index 000000000..5f6ecb30e --- /dev/null +++ b/subjects/sweetproblem.en.md @@ -0,0 +1,58 @@ +## sweet_problem + +## **WARNING! VERY IMPORTANT!** + +For this exercise a function will be tested **with the exam own main**. However the student **still needs** to submit a structured program: + +This means that: + +- The package needs to be named `package main`. +- The submitted code needs one declared function main(```func main()```) even if empty. +- The function main declared needs to **also pass** the `Restrictions Checker`(illegal functions tester). It is advised for the student to just empty the function main after its own testings are done. +- Every other rules are obviously the same than for a `program`. + +### Instructions + +It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like). +Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32. + +The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for those interested. Sections 1.10.32 and 1.10.33 from "de Finibus Bonorum et Malorum" by Cicero are also reproduced in their exact original form, accompanied by English versions from the 1914 translation by H. Rackham. + +Madina loves sweets, but she only has 3 types of sweets: red, green, blue. Her diet has some restrictions, she must not eat more than 2 sweets per day, and they must be of different color. Help her eat as many sweets as possible, return the maximum number of days she can keep eating 2 different sweets. + +### Expected function + +```go +func Sweetproblem(red, green, blue int) int { + +} +``` + +### Usage + +Here is a possible program to test your function : + +```go +package main + +import ( + "fmt" +) + +func main() { + fmt.Println(Sweetproblem(1, 1, 1)) + fmt.Println(Sweetproblem(7, 4, 10)) + fmt.Println(Sweetproblem(8, 2, 8)) +} +``` + +And its output : + +```console +student@ubuntu:~/[[ROOT]]/test$ go build +student@ubuntu:~/[[ROOT]]/test$ ./test +1 +10 +9 +student@ubuntu:~/[[ROOT]]/test$ +``` diff --git a/subjects/switchcase.en.md b/subjects/switchcase.en.md index 8301402ec..d915a0888 100644 --- a/subjects/switchcase.en.md +++ b/subjects/switchcase.en.md @@ -4,11 +4,11 @@ Write a program that takes a `string` and reverses the case of all its letters. -- Other characters remain unchanged. +- Other characters remain unchanged. -- The result must be followed by a newline (`'\n'`). +- The result must be followed by a newline (`'\n'`). -- If the number of arguments is different from 1, the program displays a newline (`'\n'`). +- If the number of arguments is different from 1, the program displays a newline (`'\n'`). ### Usage diff --git a/subjects/switchcase.fr.md b/subjects/switchcase.fr.md index 81f7b2272..a8c006487 100644 --- a/subjects/switchcase.fr.md +++ b/subjects/switchcase.fr.md @@ -4,11 +4,11 @@ Écrire un programme qui prend une `string` et qui inverses les majuscules en minuscules et vice-versa. -- Tout autre caractère reste inchangé. +- Tout autre caractère reste inchangé. -- Le résultat doit être suivi d'un retour à la ligne (`'\n'`). +- Le résultat doit être suivi d'un retour à la ligne (`'\n'`). -- Si le nombre d'arguments est différent de 1, le programme affiche un retour à la ligne (`'\n'`). +- Si le nombre d'arguments est différent de 1, le programme affiche un retour à la ligne (`'\n'`). ### Utilisation diff --git a/subjects/tabmult.en.md b/subjects/tabmult.en.md index 0d1e73a2b..0141a7338 100644 --- a/subjects/tabmult.en.md +++ b/subjects/tabmult.en.md @@ -4,7 +4,7 @@ Write a program that displays a number's multiplication table. -- The parameter will always be a strictly positive number that fits in an `int`. Said number multiplied by 9 will also fit in an `int`. +- The parameter will always be a strictly positive number that fits in an `int`. Said number multiplied by 9 will also fit in an `int`. ### Usage diff --git a/subjects/tabmult.fr.md b/subjects/tabmult.fr.md index 66cc27f20..fa47c11da 100644 --- a/subjects/tabmult.fr.md +++ b/subjects/tabmult.fr.md @@ -4,7 +4,7 @@ Écrire un programme qui affiche la table de multiplication d'un nombre. -- Le paramètre sera toujours un nombre strictement positif qui rentre dans un `int`. Ce paramètre multiplié par 9 rentrera aussi dans un `int`. +- Le paramètre sera toujours un nombre strictement positif qui rentre dans un `int`. Ce paramètre multiplié par 9 rentrera aussi dans un `int`. ### Utilisation diff --git a/subjects/tolower.en.md b/subjects/tolower.en.md index a6c1f98f6..0d509cd59 100644 --- a/subjects/tolower.en.md +++ b/subjects/tolower.en.md @@ -14,7 +14,7 @@ func ToLower(s string) string { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/tolower.fr.md b/subjects/tolower.fr.md index c6863c9cc..918a0bd6d 100644 --- a/subjects/tolower.fr.md +++ b/subjects/tolower.fr.md @@ -14,7 +14,7 @@ func ToLower(s string) string { ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main diff --git a/subjects/toupper.en.md b/subjects/toupper.en.md index 3a6a27a0e..193239c1b 100644 --- a/subjects/toupper.en.md +++ b/subjects/toupper.en.md @@ -14,7 +14,7 @@ func ToUpper(s string) string { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/trimatoi.en.md b/subjects/trimatoi.en.md index ba6571cf6..af0f39a8b 100644 --- a/subjects/trimatoi.en.md +++ b/subjects/trimatoi.en.md @@ -2,13 +2,13 @@ ### Instructions -- Write a [function](TODO-LINK) that transforms a number within a `string` in a number represented as an `int`. +- Write a function that transforms a number within a `string` in a number represented as an `int`. -- For this exercise the handling of the signs + or - **has** to be taken into account. If one of the signs is encountered before any number it should determine the sign of the returned `int`. +- For this exercise the handling of the signs + or - **has** to be taken into account. If one of the signs is encountered before any number it should determine the sign of the returned `int`. -- This function will **only** have to return the `int`. In case of invalid input, the function should return `0`. +- This function will **only** have to return the `int`. In case of invalid input, the function should return `0`. -- Note: There will never be more than one sign by string in the tests. +- Note: There will never be more than one sign by string in the tests. ### Expected function @@ -20,7 +20,7 @@ func TrimAtoi(s string) int { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main @@ -36,8 +36,8 @@ func main() { s3 := "012 345" s4 := "Hello World!" s5 := "sd+x1fa2W3s4" - s6 := "sd-x1fa2W3s4" - s7 := "sdx1-fa2W3s4" + s6 := "sd-x1fa2W3s4" + s7 := "sdx1-fa2W3s4" n := piscine.TrimAtoi(s) n2 := piscine.TrimAtoi(s2) diff --git a/subjects/trimatoi.fr.md b/subjects/trimatoi.fr.md index 7c1059e29..e150ada1a 100644 --- a/subjects/trimatoi.fr.md +++ b/subjects/trimatoi.fr.md @@ -2,11 +2,11 @@ ### Instructions -- 'Écrire une [function](TODO-LINK) qui transforme un nombre dans une `string` en un nombre représenté en `int`(entier). +- 'Écrire une function qui transforme un nombre dans une `string` en un nombre représenté en `int`(entier). -- Pour cet exercice la gestion des signes + ou - **doit être** prise en compte. Si un des signes se situe avant un chiffre alors il déterminera le signe de l'`int` retourné. +- Pour cet exercice la gestion des signes + ou - **doit être** prise en compte. Si un des signes se situe avant un chiffre alors il déterminera le signe de l'`int` retourné. -- Cette fonction aura **seulement** à retourner l'`int` (entier). En cas d'input invalide, la fonction devra retourné `0`. +- Cette fonction aura **seulement** à retourner l'`int` (entier). En cas d'input invalide, la fonction devra retourné `0`. ### Fonction attendue @@ -18,8 +18,7 @@ func TrimAtoi(s string) int { ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : - +Voici un éventuel programme pour tester votre fonction : ```go package main @@ -35,8 +34,8 @@ func main() { s3 := "012 345" s4 := "Hello World!" s5 := "sd+x1fa2W3s4" - s6 := "sd-x1fa2W3s4" - s7 := "sdx1-fa2W3s4" + s6 := "sd-x1fa2W3s4" + s7 := "sdx1-fa2W3s4" n := piscine.TrimAtoi(s) n2 := piscine.TrimAtoi(s2) diff --git a/subjects/twosum.en.md b/subjects/twosum.en.md index 6b86cdcf1..bbf043fd7 100644 --- a/subjects/twosum.en.md +++ b/subjects/twosum.en.md @@ -26,19 +26,18 @@ func TwoSum(nums []int, target int) []int { } ``` -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main import ( "fmt" - piscine ".." ) func main() { case1 := []int{1, 2, 3, 4} - out := piscine.TwoSum(case1, 5) + out := TwoSum(case1, 5) fmt.Println(out) } ``` diff --git a/subjects/ultimatedivmod.en.md b/subjects/ultimatedivmod.en.md index 3b6185479..dc02d9cfc 100644 --- a/subjects/ultimatedivmod.en.md +++ b/subjects/ultimatedivmod.en.md @@ -2,7 +2,7 @@ ### Instructions -- Write a function that will be formatted as below. +- Write a function that will be formatted as below. ### Expected function @@ -12,20 +12,20 @@ func UltimateDivMod(a *int, b *int) { } ``` -- This function will divide the int **a** and **b**. -- The result of this division will be stored in the int pointed by **a**. -- The remainder of this division will be stored in the int pointed by **b**. +- This function will divide the int **a** and **b**. +- The result of this division will be stored in the int pointed by **a**. +- The remainder of this division will be stored in the int pointed by **b**. ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main import ( - "fmt" - piscine ".." + "fmt" + piscine ".." ) func main() { diff --git a/subjects/ultimatedivmod.fr.md b/subjects/ultimatedivmod.fr.md index a09cebfe3..9d863d015 100644 --- a/subjects/ultimatedivmod.fr.md +++ b/subjects/ultimatedivmod.fr.md @@ -24,8 +24,8 @@ Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : package main import ( - "fmt" - piscine ".." + "fmt" + piscine ".." ) func main() { diff --git a/subjects/ultimatepointone.en.md b/subjects/ultimatepointone.en.md index af9c66097..e556c6214 100644 --- a/subjects/ultimatepointone.en.md +++ b/subjects/ultimatepointone.en.md @@ -2,7 +2,7 @@ ### Instructions -- Write a function that takes a **pointer to a pointer to a pointer to an int** as argument and gives to this int the value of 1. +- Write a function that takes a **pointer to a pointer to a pointer to an int** as argument and gives to this int the value of 1. ### Expected function @@ -14,14 +14,14 @@ func UltimatePointOne(n ***int) { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main import ( - "fmt" - piscine ".." + "fmt" + piscine ".." ) func main() { diff --git a/subjects/ultimatepointone.fr.md b/subjects/ultimatepointone.fr.md index 338721c6a..e12859e04 100644 --- a/subjects/ultimatepointone.fr.md +++ b/subjects/ultimatepointone.fr.md @@ -2,7 +2,7 @@ ### Instructions -- Écrire une fonction qui prend un **pointeur sur pointeur sur pointeur sur int** en argument et qui assignes à cet int la valeur 1. +- Écrire une fonction qui prend un **pointeur sur pointeur sur pointeur sur int** en argument et qui assignes à cet int la valeur 1. ### Fonction attendue @@ -14,14 +14,14 @@ func UltimatePointOne(n ***int) { ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main import ( - "fmt" - piscine ".." + "fmt" + piscine ".." ) func main() { diff --git a/subjects/union.en.md b/subjects/union.en.md index b7db67a35..737698f40 100644 --- a/subjects/union.en.md +++ b/subjects/union.en.md @@ -4,7 +4,7 @@ Write a program that takes two `string` and displays, without doubles, the characters that appear in either one of the `string`. -The display will be in the order characters appear in the command line, and will be followed by a newline (`'\n'`). +The display will be in the order that the characters will appear on the command line and will be followed by a newline (`'\n'`). If the number of arguments is different from 2, then the program displays newline (`'\n'`). @@ -12,15 +12,15 @@ If the number of arguments is different from 2, then the program displays newlin ```console student@ubuntu:~/[[ROOT]]/union$ go build -student@ubuntu:~/[[ROOT]]/union$ ./union zpadinton "paqefwtdjetyiytjneytjoeyjnejeyj" | cat -e +student@ubuntu:~/[[ROOT]]/union$ ./union zpadinton paqefwtdjetyiytjneytjoeyjnejeyj | cat -e zpadintoqefwjy$ student@ubuntu:~/[[ROOT]]/union$ ./union ddf6vewg64f gtwthgdwthdwfteewhrtag6h4ffdhsd | cat -e df6vewg4thras$ -student@ubuntu:~/[[ROOT]]/union$ ./union "rien" "cette phrase ne cache rien" | cat -e +student@ubuntu:~/[[ROOT]]/union$ ./union rien "cette phrase ne cache rien" | cat -e rienct phas$ student@ubuntu:~/[[ROOT]]/union$ ./union | cat -e $ -student@ubuntu:~/[[ROOT]]/union$ ./union "rien" | cat -e +student@ubuntu:~/[[ROOT]]/union$ ./union rien | cat -e $ student@ubuntu:~/[[ROOT]]/union$ ``` diff --git a/subjects/unmatch.en.md b/subjects/unmatch.en.md index ba6cc6ae0..d28f63bbe 100644 --- a/subjects/unmatch.en.md +++ b/subjects/unmatch.en.md @@ -4,7 +4,7 @@ Write a function, `Unmatch`, that returns the element of the slice (arr) that does not have a correspondent pair. -- If all the number have a correspondent pair, it shoud return `-1`. +- If all the number have a correspondent pair, it shoud return `-1`. ### Expected function @@ -16,7 +16,7 @@ func Unmatch(arr []int) int { ### Usage -Here is a possible [program](TODO-LINK) to test your function : +Here is a possible program to test your function : ```go package main diff --git a/subjects/unmatch.fr.md b/subjects/unmatch.fr.md index 5f959cfd1..41c370a1c 100644 --- a/subjects/unmatch.fr.md +++ b/subjects/unmatch.fr.md @@ -14,7 +14,7 @@ func Unmatch(arr []int) int { ### Utilisation -Voici un éventuel [programme](TODO-LINK) pour tester votre fonction : +Voici un éventuel programme pour tester votre fonction : ```go package main diff --git a/subjects/volumechanger.en.md b/subjects/volumechanger.en.md new file mode 100644 index 000000000..35c462c94 --- /dev/null +++ b/subjects/volumechanger.en.md @@ -0,0 +1,60 @@ +## volumechanger + +## **WARNING! VERY IMPORTANT!** + +For this exercise a function will be tested **with the exam own main**. However the student **still needs** to submit a structured program: + +This means that: + +- The package needs to be named `package main`. +- The submitted code needs one declared function main(```func main()```) even if empty. +- The function main declared needs to **also pass** the `Restrictions Checker`(illegal functions tester). It is advised for the student to just empty the function main after its own testings are done. +- Every other rules are obviously the same than for a `program`. + +### Instructions + +It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like). +Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32. + +Dagar loves watching TV. He always makes the volume to be **b**. Today he is angry, because he found out that someone changed the volume, and now, the volume is **a**. +His remote controller can change the volume by: -5, -2, -1, +1, +2, +5. +Please help Dagar, to minimize number of button presses, and calculate how many times he should press buttons of remote controller so that it changes from **a** to **b**. +There are **t** requests in total. +Input and output should be displayed in standard input and output respectively. + +### Expected function + +```go +func Volumechanger(a, b int) int { + +} +``` + +### Usage + +Here is a possible program to test your function : + +```go +package main + +import ( + "fmt" +) + +func main() { + fmt.Println(Volumechanger(4, 0)) + fmt.Println(Volumechanger(5, 14)) + fmt.Println(Volumechanger(3, 9)) +} +``` + +And its output : + +```console +student@ubuntu:~/[[ROOT]]/test$ go build +student@ubuntu:~/[[ROOT]]/test$ ./test +2 +3 +2 +student@ubuntu:~/[[ROOT]]/test$ +``` diff --git a/subjects/who-are-you.en.md b/subjects/who-are-you.en.md index eb2ac4b89..ca02813db 100644 --- a/subjects/who-are-you.en.md +++ b/subjects/who-are-you.en.md @@ -8,6 +8,6 @@ The only though that comes to your mind is a tag that says: `subject Id: 70`" Create the file `who-are-you.sh` which will remind you who you are by showing your name only. -- Where to look : https://[[DOMAIN]]/assets/superhero/all.json +- Where to look : https://[[DOMAIN]]/assets/superhero/all.json -- What to use : `curl` and `jq` +- What to use : `curl` and `jq` diff --git a/subjects/who-are-you.fr.md b/subjects/who-are-you.fr.md index fae5775bd..c94268f80 100644 --- a/subjects/who-are-you.fr.md +++ b/subjects/who-are-you.fr.md @@ -8,6 +8,6 @@ Tout ce qui vous vient à l'esprit est une étiquette sur laquelle est écrite: Créer le fichier `who-are-you.sh` qui vous rappellera qui vous êtes en affichant votre Nom seulement. -- Où chercher : https://[[DOMAIN]]/assets/superhero/all.json +- Où chercher : https://[[DOMAIN]]/assets/superhero/all.json -- Quoi utiliser : `curl` et `jq` +- Quoi utiliser : `curl` et `jq` diff --git a/subjects/ztail.en.md b/subjects/ztail.en.md index 936707877..ade99f112 100644 --- a/subjects/ztail.en.md +++ b/subjects/ztail.en.md @@ -4,15 +4,15 @@ Write a program called `ztail` that has the same behaviour as the system command `tail`, but which takes at least one file as argument. -- The only option to be handled is `-c`. This option will be used in all tests. +- The only option to be handled is `-c`. This option will be used in all tests. -- For this program the "os" package can be used. +- For this program the "os" package can be used. -- For the program to pass the tests the convention for the return code of program in Unix systems should be followed (see os.Exit). +- For the program to pass the tests the convention for the return code of program in Unix systems should be followed (see os.Exit). -- Handle the errors and output the same error messages as `tail`. +- Handle the errors and output the same error messages as `tail`. -- For more information consult the man page for `tail`. +- For more information consult the man page for `tail`. ### Note: diff --git a/subjects/ztail.fr.md b/subjects/ztail.fr.md index f8885d571..8166d2875 100644 --- a/subjects/ztail.fr.md +++ b/subjects/ztail.fr.md @@ -4,10 +4,10 @@ Écrire un programme `ztail` qui a le même comportement que la ligne de commande `tail`, mais qui prend au moins 1 fichier comme argument. -- La seule option qui doit être géré est `-c`. Cette option sera utilisé dans tous les tests. +- La seule option qui doit être géré est `-c`. Cette option sera utilisé dans tous les tests. -- Pour ce programme le package "os" peut être utilisé. +- Pour ce programme le package "os" peut être utilisé. -- Pour que le programme passe les tests la convention pour le retour code de programme en systémes Unix devra être suivi(voir os.Exit). +- Pour que le programme passe les tests la convention pour le retour code de programme en systémes Unix devra être suivi(voir os.Exit). -- Pour plus d'informtations consulter la page du man de `tail`. +- Pour plus d'informtations consulter la page du man de `tail`.