Skip to content

Instantly share code, notes, and snippets.

View elizabethengelman's full-sized avatar

Elizabeth Engelman elizabethengelman

View GitHub Profile

Mastermind is a two-player code-breaking game where one player makes a code (in your program this will be the human player) and another player guesses the code (in your program this will be the computer player). Your task is to create a game that allows a human to play against the computer. The computer should be able to guess the correct code (created by the human player). The code is made up of four colors and can include duplicates. There are six available colors from which to choose: red, green, orange, yellow, blue, purple.

  • For the first iteration, the human player (the code-maker) just responds to the computer player with yes or no. The computer has as many chances to guess as they need.

  • The next iteration will allow for the human player to respond with number of pegs that are correct (right color in right place) and the number of pegs that are the right color, but the wrong place. e.g.

code | guess | num1 | num2 
-----+-------+------+------
RRGR | RRRG  |   2  |   2
RRGR | RRRB  |   2
-- Function returning the state for a single ilk as of the given block height
CREATE FUNCTION api.get_ilk(ilk_identifier TEXT, block_height BIGINT DEFAULT api.max_block())
RETURNS api.ilk_state
AS $$
WITH ilk AS (
SELECT id FROM maker.ilks WHERE identifier = ilk_identifier
),
rates AS (
SELECT
rate,

Anonymous Event Research

Anonymous Events

  • Per the solidity documentation:

    The hash of the signature of the event is one of the topics except if you declared the event with anonymous specifier. This means that it is not possible to filter for specific anonymous events by name.

  • An event is "anonymous" when the anonymous specifier is added to the event definition:
    event TestEvent(
          address indexed _from,
          uint256 indexed _value
    ) anonymous;
    
@elizabethengelman
elizabethengelman / gotcha.md
Last active April 12, 2019 17:23
Golang Big Float gotcha
  • when creating a big float, there are two different constructors. The biggest difference I could see what the default precision for each:
    • new(big.Float) has a default precision of 0
    • big.NewFloat has a default precision of 53
  • this gets interesting when setting a either of these to a large number:
    • new(big.Float) seems to dynamically change the default precision to whatever is needed
      b := new(big.Float)
      b.SetUint64(16629421200200000000)
      //yields
      

<*big.Float | 0xc0003ece10>: {

  1. get account address from storage path: In order to get state diffing working for full (non-archive) nodes, we removed the account address lookup (from the storage path), since for Maker work we will already have the address and are able to keccak hash it to find out the path. But, for other use cases, it may be helpful to persist the account address.
    • wire up/fix addressByPath method for a full node,
    • persist the account address in the csv (in addition to, or instead of the accountLeafKey)
  2. investigate how reorgs affect pruning
    • The logic that we’re using to decide if a root is okay to be pruned or not is in the allowedRootToBeDereferenced method.
    • we’re keeping track of how many times a given root hash has been used for state diff processing:
  • if once, then it has just been processe
type BiteModel struct {
  Ilk              - NA
  Urn              - NA
  iInk             - wad
  Ink              - wad
  Art              - wad
  IArt             - wad
  Tab              - wad
  NFlip            - NA
Request sent to brix:
<?xml version="1.0" encoding="UTF-8"?>
<BRIX>
<AccessControl method="AccessControlAuthenticate" summ="true">
<AuthRequest>
<AuthID/>
</AuthRequest>
</AccessControl>
<Base>
<Employees>
//------------------------------------------------------------------------------------------------------------------
// YOUR CODE: Create your Zoo "object literal" and Animal "constructor" and "prototypes" here.
//------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------
// DRIVER CODE: Do **NOT** change anything below this point. Your task is to implement code above to make this work.
//------------------------------------------------------------------------------------------------------------------
<!DOCTYPE html>
<html lang="en">
<head>
<!-- This loads the zoo.js script so that the Zoo constructor and zoo instance are available in the console. -->
<script src="zoo.js"></script>
<title>Zoo</title>
</head>
<body>
This is a really cool zoo.
</body>