school

thing1's amazing school repo
Log | Files | Refs | Submodules | README

commit dc7732b6f073d5450657d94c815ca445a1a08fbd
parent 997fd49c81a86696db6f62ce8c5bdde038c7cebb
Author: thing1 <thing1@seacrossedlovers.xyz>
Date:   Tue, 24 Sep 2024 15:28:45 +0100

fixed some demos

Diffstat:
Mcomp/lucas-standen-NEA/code2/examples/Makefile | 1-
Mcomp/lucas-standen-NEA/code2/examples/raylib_example | 0
Mcomp/lucas-standen-NEA/code2/examples/raylib_example.zpy | 2+-
Mcomp/lucas-standen-NEA/code2/examples/str_example | 0
Mcomp/lucas-standen-NEA/code2/examples/str_example.zpy | 1+
Acomp/work/35/binaryseach | 0
Acomp/work/35/binaryseach.c | 44++++++++++++++++++++++++++++++++++++++++++++
7 files changed, 46 insertions(+), 2 deletions(-)

diff --git a/comp/lucas-standen-NEA/code2/examples/Makefile b/comp/lucas-standen-NEA/code2/examples/Makefile @@ -2,6 +2,5 @@ all: zpy raylib_example.zpy -o raylib_example -f -lraylib -f -lm -i raylib.h zpy fib_example.zpy -o fib_example -f -ggdb zpy str_example.zpy -o str_example -f -ggdb - zpy guestbook.zpy -o guestbook -f -ggdb clean: rm -rf fib_example raylib_example str_example diff --git a/comp/lucas-standen-NEA/code2/examples/raylib_example b/comp/lucas-standen-NEA/code2/examples/raylib_example Binary files differ. diff --git a/comp/lucas-standen-NEA/code2/examples/raylib_example.zpy b/comp/lucas-standen-NEA/code2/examples/raylib_example.zpy @@ -1,6 +1,6 @@ (defun main int) (InitWindow 800 800 "test_test") - (SetTargetFPS 60) + (SetTargetFPS 30) (let img:Image (LoadImage "dvd.png")) (let tex:Texture (LoadTextureFromImage img)) diff --git a/comp/lucas-standen-NEA/code2/examples/str_example b/comp/lucas-standen-NEA/code2/examples/str_example Binary files differ. diff --git a/comp/lucas-standen-NEA/code2/examples/str_example.zpy b/comp/lucas-standen-NEA/code2/examples/str_example.zpy @@ -2,4 +2,5 @@ (let str:string* (String "hello")) (printchar str->_str[0]) (str->free str) + (printstr "<first_letter\n") (endfun) diff --git a/comp/work/35/binaryseach b/comp/work/35/binaryseach Binary files differ. diff --git a/comp/work/35/binaryseach.c b/comp/work/35/binaryseach.c @@ -0,0 +1,44 @@ +#include <stdio.h> +#include <stdbool.h> +#include <stdlib.h> +#include <string.h> + +char *arr[] = { + "ali", + "ben", + "carl", + "joe", + "ken", + "lara", + "mo", + "oli", + "pam", + "stan", + "tara" +}; +int len = 11; + +char *binsearch(char *tofind){ + int l = len/2; + char *start = arr[0]; + char *end = arr[len]; + char *mid = arr[l]; + + while (mid != tofind){ + if (strcmp(mid, tofind) < 0){ + start = mid; + l /= 2; + mid = arr[len - l]; + }else { + end = mid; + l /= 2; + mid = arr[len - l] + } + } + + return start; +} + +int main(){ + binsearch("pam"); +}