From dc7732b6f073d5450657d94c815ca445a1a08fbd Mon Sep 17 00:00:00 2001 From: thing1 Date: Tue, 24 Sep 2024 15:28:45 +0100 Subject: fixed some demos --- comp/lucas-standen-NEA/code2/examples/Makefile | 1 - .../code2/examples/raylib_example | Bin 1085488 -> 1085488 bytes .../code2/examples/raylib_example.zpy | 2 +- comp/lucas-standen-NEA/code2/examples/str_example | Bin 24840 -> 24856 bytes .../code2/examples/str_example.zpy | 1 + comp/work/35/binaryseach | Bin 0 -> 15456 bytes comp/work/35/binaryseach.c | 44 +++++++++++++++++++++ 7 files changed, 46 insertions(+), 2 deletions(-) create mode 100755 comp/work/35/binaryseach create mode 100644 comp/work/35/binaryseach.c (limited to 'comp') diff --git a/comp/lucas-standen-NEA/code2/examples/Makefile b/comp/lucas-standen-NEA/code2/examples/Makefile index 04bb54c..13178a5 100644 --- 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 index 28f2a9d..74d52ed 100755 Binary files a/comp/lucas-standen-NEA/code2/examples/raylib_example and b/comp/lucas-standen-NEA/code2/examples/raylib_example differ diff --git a/comp/lucas-standen-NEA/code2/examples/raylib_example.zpy b/comp/lucas-standen-NEA/code2/examples/raylib_example.zpy index 10f326e..90ef8b8 100644 --- 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 index ede98e9..8f86844 100755 Binary files a/comp/lucas-standen-NEA/code2/examples/str_example and b/comp/lucas-standen-NEA/code2/examples/str_example differ diff --git a/comp/lucas-standen-NEA/code2/examples/str_example.zpy b/comp/lucas-standen-NEA/code2/examples/str_example.zpy index 9b67f5f..7311660 100644 --- 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 " +#include +#include +#include + +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"); +} -- cgit v1.2.3