| name | correct guesses | games together | ratio |
|---|---|---|---|
| oleander | 2 | 4 | 0.500 |
| kimapr | 1 | 4 | 0.250 |
| name | correct guesses | games together | ratio |
|---|---|---|---|
| oleander | 2 | 4 | 0.500 |
| kimapr | 1 | 4 | 0.250 |
submitted at
0 likes
submitted at
0 likes
submitted at
3 likes
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | # the actual value the program is looking for (we pretend that the guess function is unaware of this variable) TRUE_VALUE=$(($(dd if=/dev/urandom count=1 2> /dev/null | cksum | cut -d' ' -f1) % 100)) # $1 should be the guess # using echo as return is for little skibidi toilets, hence im using error codes # (this function is implemented for testing purposes) submit() { echo "guess: $1" # Too big if (( $1 < TRUE_VALUE )); then return -1 # overflows to 255 elif (( $1 > TRUE_VALUE )); then return 1 elif [[ $1 -eq $TRUE_VALUE ]]; then return 0 else while true; do printf "crazy? i was crazy once. they put me in a room. a rubber room. a rubber room with rats. the rats made me ..." done fi } guess() { # I was initially planning to do a perfectly suboptimal search (binary search, but guessing all values in the wrong direction before proceeding), but then it occurred to me... i couldn't be bothered for i in {0..100}; do submit $i if [[ $? -eq "0" ]]; then echo "welp that was fun, im off" return 0 fi done } guess |
submitted at
0 likes
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | import keras import math import numpy as np # create a dataset data = np.arange(0.001, 100, 0.00025) np.random.shuffle(data) # take a sample for testing purposes split_data = np.array_split(data, 4) x_train = np.concatenate((split_data[0], split_data[1], split_data[2])) x_test = split_data[3] split_data = None # wipe my temp variable y_train = np.reciprocal(np.sqrt(x_train)) y_test = np.reciprocal(np.sqrt(x_test)) # set up a model / topology or whatever model = keras.models.Sequential([ keras.layers.Input(shape=(1,)), keras.layers.Dense(32, activation='relu'), keras.layers.Dense(16, activation='relu'), keras.layers.Dense(16, activation='relu'), keras.layers.Dense(1, activation='exponential') ]) # define a loss function loss_fn = keras.losses.MeanSquaredLogarithmicError() model.dropout = keras.layers.Dropout(0.0) # compile the model, with the loss function model.compile(optimizer='adam', loss=loss_fn, metrics=['mean_absolute_percentage_error'], auto_scale_loss=True) # adjust the model to minimise loss model.fit(x_train, y_train, validation_data=(x_test, y_test), epochs=3) # evaluate the model's performance # for the purposes of this, I think 1 colour channel is fine model.evaluate(x_test, y_test, verbose=2) while True: # bad bad bad error management, but good enough. Don't want it to hard crash after spending ages training. try: value = float(input("Enter test value: ").strip()) prediction = model.predict(np.reshape(value, (1))) print("1 / sqrt({0}) ≈ {1}".format(value, prediction)) except KeyboardInterrupt: break # (effectively just exit, but without importing sys) except: print("Invalid value! Please retry") |
post a comment