-
Notifications
You must be signed in to change notification settings - Fork 933
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bridge #1118
Bridge #1118
Conversation
Fixed the tests. Since I swap the current and the previous tricks, I needed to swap those in the binary representations. def change_order(hex_value):
int_value = int(hex_value, 16) # Convert the hex string to an integer
binary_str = bin(int_value)[2:] # Convert the integer to binary and remove the '0b' prefix
length_required = 571
binary_str_padded = binary_str.zfill(length_required)
index_previous_start, index_previous_end = 129, 337
index_current_start, index_current_end = 337, 545
new_string_binary = binary_str_padded[:index_previous_start] + binary_str_padded[index_current_start:index_current_end] + binary_str_padded[index_previous_start: index_previous_end] + binary_str_padded[index_current_end:]
int_value_from_binary = int(new_string_binary, 2)
hex_str = hex(int_value_from_binary)
return hex_str
file_path = "./bridge(use_double_dummy_result=false).txt"
with open(file_path, 'r') as file:
lines = file.readlines()
for idx, line in enumerate(lines):
# only apply to lines after bidding
if "binvec" in line and idx > 700:
hex_value = line.split(', ')[-1].split(')')[0] # Extract the hex value
new_hex_value = change_order(hex_value)
lines[idx] = line.replace(hex_value, new_hex_value) # Replace old hex value with the new one
with open(file_path, 'w') as file:
file.writelines(lines) |
Taken @MattX's review into account |
Thanks for this and to @MattX for the review. We should be able to pull this in soon. I'll just quickly run it by Ed early next week. |
BTW @ZiggerZZ, you can always simply regenerate those playthroughs given the new implementation using this script: https://github.com/google-deepmind/open_spiel/blob/master/open_spiel/scripts/regenerate_playthroughs.sh |
Thanks @lanctot! I wanted to verify the correctness of the implementation by writing that logic of modifying the existing observation tensors. |
Hello!
This is the implementation of #1117. It is not ready to be merged yet - I need to change all
binvec
s inbridge(use_double_dummy_result=false).txt
to reflect the change of the order of the tricks (from[previous, current]
to[current, previous]
). As suggested by @elkhrt, I didn't introduceabsolute_order
parameter.If this approach is fine with you, I'll update the tests and the PR will be ready to be merged.