Deadfish Joust is a deadfish-based game created by User:A, consisting of two contestants who attempt to modify an accumulator to make the accumulator as close to their value as possible. It has the lowest learning curve compared to other programming games, as even BF Joust has at least 8 instructions, and Deadfish Joust only has 4 instructions.
The two contestants are given a random number between 0 and 255. There will be no such cases like two contestants have the same number. The goal of this contest is to make the resulting program set the accumulator to the random value that the contestants are given.
The contest consists of two people typing a Deadfish program. Each person can't see what the other person is typing. Once a person clicks run (,or types a run command, if the joust server is console-based), they cannot change their program anymore.
When the two contestants are done, the computer merges two of the programs together.
Take aaaaaaa and bbbbbbb as an an example. The computer will do this:
If code a is shorter than code b (and vice versa), such as aaaaa and bbbbbbb, the computer will not do anything else to the extra part.
Take this as an example:
a=12345 b=asdfghj ab=1a2s3d4f5g
Then, the program will be executed, and the computer will check whether the resulting accumulator value is closer to contestant a's number or contestant b's number. If the result is closer to whatever contestant's number, then that contestant wins.
Instructions in deadfish Joust
The instructions in deadfish Joust is less than the usual set of deadfish commands. These are:
i: increment the accumulator d: decrement the accumulator s: square the accumulator q: square root the accumulator, making sure that the accumulator is an integer
The output instruction is unneccecary, as the computer will not check the output. o is a no-op, similar to other instructions.
This is an incomplete server for this game (contestants can see what the other is typing):
import random import math anm=random.randint(0,255) bnm=random.randint(0,255) print("Contestant a, you are given:",anm) print("Contestant b, you are given:",bnm) a=input() b=input() c="" for i in range(min(len(a),len(b))): c=c+a[i]+b[i] print(c) print("---Deadfish execution! Please wait...---") ac=0 for i in c: print(i, ":", ac) if ac==256 or ac==-1: ac=0 elif ac==-1: ac=255 elif i=='i': ac+=1 elif i=='d': ac-=1 elif i=='s': ac*=ac elif i=='q': ac=int(math.sqrt(ac)) print(i, ":", ac) print(ac%256) if abs((ac%256)-anm)<abs((ac%256)-bnm): print("Contestant a wins!") else: print("Contestant b wins!")